summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-greek.c2
-rw-r--r--src/3rdparty/libpng/pnglibconf.h4
-rw-r--r--src/3rdparty/s60/eiksoftkeyimage.h2
-rw-r--r--src/3rdparty/sqlite/sqlite3.c23
m---------src/3rdparty/v80
-rw-r--r--src/corelib/Qt5CoreConfigExtras.cmake.in10
-rw-r--r--src/corelib/Qt5CoreMacros.cmake321
-rw-r--r--src/corelib/animation/qabstractanimation.cpp501
-rw-r--r--src/corelib/animation/qabstractanimation.h2
-rw-r--r--src/corelib/animation/qabstractanimation_p.h111
-rw-r--r--src/corelib/animation/qanimationgroup.cpp2
-rw-r--r--src/corelib/animation/qanimationgroup.h2
-rw-r--r--src/corelib/animation/qanimationgroup_p.h2
-rw-r--r--src/corelib/animation/qparallelanimationgroup.cpp2
-rw-r--r--src/corelib/animation/qparallelanimationgroup.h2
-rw-r--r--src/corelib/animation/qparallelanimationgroup_p.h2
-rw-r--r--src/corelib/animation/qpauseanimation.cpp2
-rw-r--r--src/corelib/animation/qpauseanimation.h2
-rw-r--r--src/corelib/animation/qpropertyanimation.cpp2
-rw-r--r--src/corelib/animation/qpropertyanimation.h2
-rw-r--r--src/corelib/animation/qpropertyanimation_p.h2
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.cpp2
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.h2
-rw-r--r--src/corelib/animation/qsequentialanimationgroup_p.h2
-rw-r--r--src/corelib/animation/qvariantanimation.cpp2
-rw-r--r--src/corelib/animation/qvariantanimation.h2
-rw-r--r--src/corelib/animation/qvariantanimation_p.h2
-rw-r--r--src/corelib/arch/alpha/qatomic_alpha.s2
-rw-r--r--src/corelib/arch/arm/qatomic_arm.cpp2
-rw-r--r--src/corelib/arch/generic/qatomic_generic_unix.cpp2
-rw-r--r--src/corelib/arch/generic/qatomic_generic_windows.cpp2
-rw-r--r--src/corelib/arch/ia64/qatomic_ia64.s2
-rw-r--r--src/corelib/arch/macosx/qatomic32_ppc.s2
-rw-r--r--src/corelib/arch/mips/qatomic_mips32.s2
-rw-r--r--src/corelib/arch/mips/qatomic_mips64.s2
-rw-r--r--src/corelib/arch/parisc/q_ldcw.s2
-rw-r--r--src/corelib/arch/parisc/qatomic_parisc.cpp2
-rw-r--r--src/corelib/arch/powerpc/qatomic32.s2
-rw-r--r--src/corelib/arch/powerpc/qatomic64.s2
-rw-r--r--src/corelib/arch/qatomic_alpha.h2
-rw-r--r--src/corelib/arch/qatomic_arch.h2
-rw-r--r--src/corelib/arch/qatomic_arm.h2
-rw-r--r--src/corelib/arch/qatomic_armv5.h2
-rw-r--r--src/corelib/arch/qatomic_armv6.h2
-rw-r--r--src/corelib/arch/qatomic_armv7.h2
-rw-r--r--src/corelib/arch/qatomic_avr32.h2
-rw-r--r--src/corelib/arch/qatomic_bfin.h2
-rw-r--r--src/corelib/arch/qatomic_bootstrap.h2
-rw-r--r--src/corelib/arch/qatomic_generic.h2
-rw-r--r--src/corelib/arch/qatomic_i386.h2
-rw-r--r--src/corelib/arch/qatomic_ia64.h2
-rw-r--r--src/corelib/arch/qatomic_integrity.h2
-rw-r--r--src/corelib/arch/qatomic_macosx.h2
-rw-r--r--src/corelib/arch/qatomic_mips.h2
-rw-r--r--src/corelib/arch/qatomic_parisc.h2
-rw-r--r--src/corelib/arch/qatomic_powerpc.h2
-rw-r--r--src/corelib/arch/qatomic_s390.h2
-rw-r--r--src/corelib/arch/qatomic_sh.h2
-rw-r--r--src/corelib/arch/qatomic_sh4a.h2
-rw-r--r--src/corelib/arch/qatomic_sparc.h2
-rw-r--r--src/corelib/arch/qatomic_symbian.h2
-rw-r--r--src/corelib/arch/qatomic_vxworks.h2
-rw-r--r--src/corelib/arch/qatomic_windows.h2
-rw-r--r--src/corelib/arch/qatomic_windowsce.h2
-rw-r--r--src/corelib/arch/qatomic_x86_64.h2
-rw-r--r--src/corelib/arch/sh/qatomic_sh.cpp2
-rw-r--r--src/corelib/arch/sparc/qatomic32.s2
-rw-r--r--src/corelib/arch/sparc/qatomic64.s2
-rw-r--r--src/corelib/arch/sparc/qatomic_sparc.cpp2
-rw-r--r--src/corelib/codecs/codecs.pri3
-rw-r--r--src/corelib/codecs/codecs.qdoc2
-rw-r--r--src/corelib/codecs/qfontlaocodec.cpp2
-rw-r--r--src/corelib/codecs/qfontlaocodec_p.h2
-rw-r--r--src/corelib/codecs/qiconvcodec.cpp2
-rw-r--r--src/corelib/codecs/qiconvcodec_p.h2
-rw-r--r--src/corelib/codecs/qisciicodec.cpp2
-rw-r--r--src/corelib/codecs/qisciicodec_p.h2
-rw-r--r--src/corelib/codecs/qlatincodec.cpp2
-rw-r--r--src/corelib/codecs/qlatincodec_p.h2
-rw-r--r--src/corelib/codecs/qsimplecodec.cpp10
-rw-r--r--src/corelib/codecs/qsimplecodec_p.h6
-rw-r--r--src/corelib/codecs/qtextcodec.cpp68
-rw-r--r--src/corelib/codecs/qtextcodec.h9
-rw-r--r--src/corelib/codecs/qtextcodec_p.h2
-rw-r--r--src/corelib/codecs/qtextcodec_symbian.cpp689
-rw-r--r--src/corelib/codecs/qtextcodecplugin.cpp2
-rw-r--r--src/corelib/codecs/qtextcodecplugin.h2
-rw-r--r--src/corelib/codecs/qtsciicodec.cpp2
-rw-r--r--src/corelib/codecs/qtsciicodec_p.h2
-rw-r--r--src/corelib/codecs/qutfcodec.cpp2
-rw-r--r--src/corelib/codecs/qutfcodec_p.h2
-rw-r--r--src/corelib/concurrent/qfuture.cpp2
-rw-r--r--src/corelib/concurrent/qfuture.h2
-rw-r--r--src/corelib/concurrent/qfutureinterface.cpp2
-rw-r--r--src/corelib/concurrent/qfutureinterface.h2
-rw-r--r--src/corelib/concurrent/qfutureinterface_p.h2
-rw-r--r--src/corelib/concurrent/qfuturesynchronizer.cpp2
-rw-r--r--src/corelib/concurrent/qfuturesynchronizer.h2
-rw-r--r--src/corelib/concurrent/qfuturewatcher.cpp2
-rw-r--r--src/corelib/concurrent/qfuturewatcher.h2
-rw-r--r--src/corelib/concurrent/qfuturewatcher_p.h2
-rw-r--r--src/corelib/concurrent/qrunnable.cpp2
-rw-r--r--src/corelib/concurrent/qrunnable.h2
-rw-r--r--src/corelib/concurrent/qtconcurrentcompilertest.h2
-rw-r--r--src/corelib/concurrent/qtconcurrentexception.cpp2
-rw-r--r--src/corelib/concurrent/qtconcurrentexception.h2
-rw-r--r--src/corelib/concurrent/qtconcurrentfilter.cpp2
-rw-r--r--src/corelib/concurrent/qtconcurrentfilter.h2
-rw-r--r--src/corelib/concurrent/qtconcurrentfilterkernel.h2
-rw-r--r--src/corelib/concurrent/qtconcurrentfunctionwrappers.h2
-rw-r--r--src/corelib/concurrent/qtconcurrentiteratekernel.cpp2
-rw-r--r--src/corelib/concurrent/qtconcurrentiteratekernel.h2
-rw-r--r--src/corelib/concurrent/qtconcurrentmap.cpp2
-rw-r--r--src/corelib/concurrent/qtconcurrentmap.h2
-rw-r--r--src/corelib/concurrent/qtconcurrentmapkernel.h2
-rw-r--r--src/corelib/concurrent/qtconcurrentmedian.h2
-rw-r--r--src/corelib/concurrent/qtconcurrentreducekernel.h2
-rw-r--r--src/corelib/concurrent/qtconcurrentresultstore.cpp2
-rw-r--r--src/corelib/concurrent/qtconcurrentresultstore.h2
-rw-r--r--src/corelib/concurrent/qtconcurrentrun.cpp2
-rw-r--r--src/corelib/concurrent/qtconcurrentrun.h2
-rw-r--r--src/corelib/concurrent/qtconcurrentrunbase.h2
-rw-r--r--src/corelib/concurrent/qtconcurrentstoredfunctioncall.h2
-rw-r--r--src/corelib/concurrent/qtconcurrentthreadengine.cpp2
-rw-r--r--src/corelib/concurrent/qtconcurrentthreadengine.h2
-rw-r--r--src/corelib/concurrent/qthreadpool.cpp2
-rw-r--r--src/corelib/concurrent/qthreadpool.h2
-rw-r--r--src/corelib/concurrent/qthreadpool_p.h2
-rw-r--r--src/corelib/corelib.pro1
-rw-r--r--src/corelib/global/qconfig-dist.h2
-rw-r--r--src/corelib/global/qconfig-large.h2
-rw-r--r--src/corelib/global/qconfig-medium.h2
-rw-r--r--src/corelib/global/qconfig-minimal.h5
-rw-r--r--src/corelib/global/qconfig-nacl.h2
-rw-r--r--src/corelib/global/qconfig-small.h5
-rw-r--r--src/corelib/global/qendian.h2
-rw-r--r--src/corelib/global/qendian.qdoc2
-rw-r--r--src/corelib/global/qfeatures.h17
-rw-r--r--src/corelib/global/qfeatures.txt7
-rw-r--r--src/corelib/global/qglobal.cpp392
-rw-r--r--src/corelib/global/qglobal.h276
-rw-r--r--src/corelib/global/qlibraryinfo.cpp4
-rw-r--r--src/corelib/global/qlibraryinfo.h2
-rw-r--r--src/corelib/global/qmalloc.cpp8
-rw-r--r--src/corelib/global/qnamespace.h51
-rw-r--r--src/corelib/global/qnamespace.qdoc46
-rw-r--r--src/corelib/global/qnumeric.cpp2
-rw-r--r--src/corelib/global/qnumeric.h2
-rw-r--r--src/corelib/global/qnumeric_p.h2
-rw-r--r--src/corelib/global/qt_pch.h2
-rw-r--r--src/corelib/global/qt_windows.h2
-rw-r--r--src/corelib/io/io.pri57
-rw-r--r--src/corelib/io/qabstractfileengine.cpp2
-rw-r--r--src/corelib/io/qabstractfileengine.h2
-rw-r--r--src/corelib/io/qabstractfileengine_p.h2
-rw-r--r--src/corelib/io/qbuffer.cpp10
-rw-r--r--src/corelib/io/qbuffer.h2
-rw-r--r--src/corelib/io/qdatastream.cpp2
-rw-r--r--src/corelib/io/qdatastream.h2
-rw-r--r--src/corelib/io/qdatastream_p.h2
-rw-r--r--src/corelib/io/qdataurl.cpp68
-rw-r--r--src/corelib/io/qdataurl_p.h4
-rw-r--r--src/corelib/io/qdebug.cpp2
-rw-r--r--src/corelib/io/qdebug.h21
-rw-r--r--src/corelib/io/qdir.cpp4
-rw-r--r--src/corelib/io/qdir.h2
-rw-r--r--src/corelib/io/qdir_p.h2
-rw-r--r--src/corelib/io/qdiriterator.cpp2
-rw-r--r--src/corelib/io/qdiriterator.h2
-rw-r--r--src/corelib/io/qfile.cpp2
-rw-r--r--src/corelib/io/qfile.h2
-rw-r--r--src/corelib/io/qfile_p.h2
-rw-r--r--src/corelib/io/qfileinfo.cpp2
-rw-r--r--src/corelib/io/qfileinfo.h2
-rw-r--r--src/corelib/io/qfileinfo_p.h2
-rw-r--r--src/corelib/io/qfilesystemengine.cpp2
-rw-r--r--src/corelib/io/qfilesystemengine_mac.cpp2
-rw-r--r--src/corelib/io/qfilesystemengine_p.h2
-rw-r--r--src/corelib/io/qfilesystemengine_symbian.cpp406
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp2
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp63
-rw-r--r--src/corelib/io/qfilesystementry.cpp2
-rw-r--r--src/corelib/io/qfilesystementry_p.h2
-rw-r--r--src/corelib/io/qfilesystemiterator_p.h2
-rw-r--r--src/corelib/io/qfilesystemiterator_symbian.cpp127
-rw-r--r--src/corelib/io/qfilesystemiterator_unix.cpp2
-rw-r--r--src/corelib/io/qfilesystemiterator_win.cpp2
-rw-r--r--src/corelib/io/qfilesystemmetadata_p.h2
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp371
-rw-r--r--src/corelib/io/qfilesystemwatcher.h10
-rw-r--r--src/corelib/io/qfilesystemwatcher_dnotify.cpp461
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents.cpp492
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents_p.h132
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify.cpp37
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify_p.h17
-rw-r--r--src/corelib/io/qfilesystemwatcher_kqueue.cpp296
-rw-r--r--src/corelib/io/qfilesystemwatcher_kqueue_p.h15
-rw-r--r--src/corelib/io/qfilesystemwatcher_p.h17
-rw-r--r--src/corelib/io/qfilesystemwatcher_polling.cpp151
-rw-r--r--src/corelib/io/qfilesystemwatcher_polling_p.h (renamed from src/corelib/io/qfilesystemwatcher_dnotify_p.h)113
-rw-r--r--src/corelib/io/qfilesystemwatcher_symbian.cpp273
-rw-r--r--src/corelib/io/qfilesystemwatcher_win.cpp35
-rw-r--r--src/corelib/io/qfilesystemwatcher_win_p.h10
-rw-r--r--src/corelib/io/qfsfileengine.cpp2
-rw-r--r--src/corelib/io/qfsfileengine.h2
-rw-r--r--src/corelib/io/qfsfileengine_iterator.cpp2
-rw-r--r--src/corelib/io/qfsfileengine_iterator_p.h2
-rw-r--r--src/corelib/io/qfsfileengine_p.h2
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp2
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp5
-rw-r--r--src/corelib/io/qiodevice.cpp2
-rw-r--r--src/corelib/io/qiodevice.h2
-rw-r--r--src/corelib/io/qiodevice_p.h2
-rw-r--r--src/corelib/io/qnoncontiguousbytedevice.cpp2
-rw-r--r--src/corelib/io/qnoncontiguousbytedevice_p.h2
-rw-r--r--src/corelib/io/qprocess.cpp14
-rw-r--r--src/corelib/io/qprocess.h2
-rw-r--r--src/corelib/io/qprocess_p.h2
-rw-r--r--src/corelib/io/qprocess_symbian.cpp1072
-rw-r--r--src/corelib/io/qprocess_unix.cpp2
-rw-r--r--src/corelib/io/qprocess_win.cpp125
-rw-r--r--src/corelib/io/qprocess_wince.cpp330
-rw-r--r--src/corelib/io/qresource.cpp4
-rw-r--r--src/corelib/io/qresource.h2
-rw-r--r--src/corelib/io/qresource_iterator.cpp2
-rw-r--r--src/corelib/io/qresource_iterator_p.h2
-rw-r--r--src/corelib/io/qresource_p.h2
-rw-r--r--src/corelib/io/qsettings.cpp2
-rw-r--r--src/corelib/io/qsettings.h2
-rw-r--r--src/corelib/io/qsettings_mac.cpp2
-rw-r--r--src/corelib/io/qsettings_p.h2
-rw-r--r--src/corelib/io/qsettings_win.cpp2
-rw-r--r--src/corelib/io/qstandardpaths.cpp4
-rw-r--r--src/corelib/io/qstandardpaths.h5
-rw-r--r--src/corelib/io/qstandardpaths_mac.cpp6
-rw-r--r--src/corelib/io/qstandardpaths_unix.cpp13
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp5
-rw-r--r--src/corelib/io/qtemporarydir.cpp2
-rw-r--r--src/corelib/io/qtemporarydir.h2
-rw-r--r--src/corelib/io/qtemporaryfile.cpp2
-rw-r--r--src/corelib/io/qtemporaryfile.h2
-rw-r--r--src/corelib/io/qtextstream.cpp2
-rw-r--r--src/corelib/io/qtextstream.h2
-rw-r--r--src/corelib/io/qtldurl.cpp2
-rw-r--r--src/corelib/io/qtldurl_p.h2
-rw-r--r--src/corelib/io/qurl.cpp2
-rw-r--r--src/corelib/io/qurl.h2
-rw-r--r--src/corelib/io/qwindowspipereader.cpp315
-rw-r--r--src/corelib/io/qwindowspipereader_p.h (renamed from src/corelib/io/qfilesystemwatcher_symbian_p.h)106
-rw-r--r--src/corelib/io/qwindowspipewriter.cpp2
-rw-r--r--src/corelib/io/qwindowspipewriter_p.h2
-rw-r--r--src/corelib/itemmodels/itemmodels.pri20
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp (renamed from src/corelib/kernel/qabstractitemmodel.cpp)42
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.h (renamed from src/corelib/kernel/qabstractitemmodel.h)23
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel_p.h (renamed from src/corelib/kernel/qabstractitemmodel_p.h)2
-rw-r--r--src/corelib/itemmodels/qabstractproxymodel.cpp (renamed from src/widgets/itemviews/qabstractproxymodel.cpp)4
-rw-r--r--src/corelib/itemmodels/qabstractproxymodel.h (renamed from src/widgets/itemviews/qabstractproxymodel.h)6
-rw-r--r--src/corelib/itemmodels/qabstractproxymodel_p.h (renamed from src/widgets/itemviews/qabstractproxymodel_p.h)4
-rw-r--r--src/corelib/itemmodels/qidentityproxymodel.cpp (renamed from src/widgets/itemviews/qidentityproxymodel.cpp)2
-rw-r--r--src/corelib/itemmodels/qidentityproxymodel.h (renamed from src/widgets/itemviews/qidentityproxymodel.h)6
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.cpp (renamed from src/widgets/itemviews/qitemselectionmodel.cpp)8
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.h (renamed from src/widgets/itemviews/qitemselectionmodel.h)12
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel_p.h (renamed from src/widgets/itemviews/qitemselectionmodel_p.h)2
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.cpp (renamed from src/widgets/itemviews/qsortfilterproxymodel.cpp)18
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.h (renamed from src/widgets/itemviews/qsortfilterproxymodel.h)8
-rw-r--r--src/corelib/itemmodels/qstringlistmodel.cpp (renamed from src/widgets/itemviews/qstringlistmodel.cpp)6
-rw-r--r--src/corelib/itemmodels/qstringlistmodel.h (renamed from src/widgets/itemviews/qstringlistmodel.h)8
-rw-r--r--src/corelib/kernel/kernel.pri76
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.cpp42
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.h24
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher_p.h2
-rw-r--r--src/corelib/kernel/qbasictimer.cpp54
-rw-r--r--src/corelib/kernel/qbasictimer.h4
-rw-r--r--src/corelib/kernel/qcore_mac.cpp2
-rw-r--r--src/corelib/kernel/qcore_mac_p.h2
-rw-r--r--src/corelib/kernel/qcore_symbian_p.cpp317
-rw-r--r--src/corelib/kernel/qcore_symbian_p.h282
-rw-r--r--src/corelib/kernel/qcore_unix.cpp2
-rw-r--r--src/corelib/kernel/qcore_unix_p.h2
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp54
-rw-r--r--src/corelib/kernel/qcoreapplication.h8
-rw-r--r--src/corelib/kernel/qcoreapplication_mac.cpp2
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h2
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp2
-rw-r--r--src/corelib/kernel/qcorecmdlineargs_p.h2
-rw-r--r--src/corelib/kernel/qcoreevent.cpp5
-rw-r--r--src/corelib/kernel/qcoreevent.h5
-rw-r--r--src/corelib/kernel/qcoreglobaldata.cpp2
-rw-r--r--src/corelib/kernel/qcoreglobaldata_p.h2
-rw-r--r--src/corelib/kernel/qcrashhandler.cpp2
-rw-r--r--src/corelib/kernel/qcrashhandler_p.h2
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp6
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib_p.h4
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian.cpp1316
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian_p.h327
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp328
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix_p.h49
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp65
-rw-r--r--src/corelib/kernel/qeventdispatcher_win_p.h7
-rw-r--r--src/corelib/kernel/qeventloop.cpp2
-rw-r--r--src/corelib/kernel/qeventloop.h2
-rw-r--r--src/corelib/kernel/qfunctions_nacl.cpp2
-rw-r--r--src/corelib/kernel/qfunctions_nacl.h2
-rw-r--r--src/corelib/kernel/qfunctions_p.h2
-rw-r--r--src/corelib/kernel/qfunctions_vxworks.cpp2
-rw-r--r--src/corelib/kernel/qfunctions_vxworks.h2
-rw-r--r--src/corelib/kernel/qfunctions_wince.cpp2
-rw-r--r--src/corelib/kernel/qfunctions_wince.h2
-rw-r--r--src/corelib/kernel/qmath.cpp2
-rw-r--r--src/corelib/kernel/qmath.h2
-rw-r--r--src/corelib/kernel/qmath.qdoc2
-rw-r--r--src/corelib/kernel/qmetaobject.cpp23
-rw-r--r--src/corelib/kernel/qmetaobject.h2
-rw-r--r--src/corelib/kernel/qmetaobject_moc_p.h2
-rw-r--r--src/corelib/kernel/qmetaobject_p.h2
-rw-r--r--src/corelib/kernel/qmetaobjectbuilder.cpp35
-rw-r--r--src/corelib/kernel/qmetaobjectbuilder_p.h6
-rw-r--r--src/corelib/kernel/qmetatype.cpp158
-rw-r--r--src/corelib/kernel/qmetatype.h30
-rw-r--r--src/corelib/kernel/qmetatype_p.h85
-rw-r--r--src/corelib/kernel/qmetatypeswitcher_p.h2
-rw-r--r--src/corelib/kernel/qmimedata.cpp2
-rw-r--r--src/corelib/kernel/qmimedata.h2
-rw-r--r--src/corelib/kernel/qobject.cpp290
-rw-r--r--src/corelib/kernel/qobject.h38
-rw-r--r--src/corelib/kernel/qobject_impl.h38
-rw-r--r--src/corelib/kernel/qobject_p.h11
-rw-r--r--src/corelib/kernel/qobjectcleanuphandler.cpp2
-rw-r--r--src/corelib/kernel/qobjectcleanuphandler.h2
-rw-r--r--src/corelib/kernel/qobjectdefs.h20
-rw-r--r--src/corelib/kernel/qpointer.cpp22
-rw-r--r--src/corelib/kernel/qpointer.h39
-rw-r--r--src/corelib/kernel/qsharedmemory.cpp2
-rw-r--r--src/corelib/kernel/qsharedmemory.h2
-rw-r--r--src/corelib/kernel/qsharedmemory_p.h2
-rw-r--r--src/corelib/kernel/qsharedmemory_symbian.cpp173
-rw-r--r--src/corelib/kernel/qsharedmemory_unix.cpp2
-rw-r--r--src/corelib/kernel/qsharedmemory_win.cpp2
-rw-r--r--src/corelib/kernel/qsignalmapper.cpp2
-rw-r--r--src/corelib/kernel/qsignalmapper.h2
-rw-r--r--src/corelib/kernel/qsocketnotifier.cpp4
-rw-r--r--src/corelib/kernel/qsocketnotifier.h6
-rw-r--r--src/corelib/kernel/qsystemerror.cpp60
-rw-r--r--src/corelib/kernel/qsystemerror_p.h2
-rw-r--r--src/corelib/kernel/qsystemsemaphore.cpp2
-rw-r--r--src/corelib/kernel/qsystemsemaphore.h2
-rw-r--r--src/corelib/kernel/qsystemsemaphore_p.h2
-rw-r--r--src/corelib/kernel/qsystemsemaphore_symbian.cpp138
-rw-r--r--src/corelib/kernel/qsystemsemaphore_unix.cpp2
-rw-r--r--src/corelib/kernel/qsystemsemaphore_win.cpp2
-rw-r--r--src/corelib/kernel/qtcore_eval.cpp6
-rw-r--r--src/corelib/kernel/qtimer.cpp48
-rw-r--r--src/corelib/kernel/qtimer.h9
-rw-r--r--src/corelib/kernel/qtimerinfo_unix.cpp625
-rw-r--r--src/corelib/kernel/qtimerinfo_unix_p.h117
-rw-r--r--src/corelib/kernel/qtranslator.cpp2
-rw-r--r--src/corelib/kernel/qtranslator.h2
-rw-r--r--src/corelib/kernel/qtranslator_p.h2
-rw-r--r--src/corelib/kernel/qvariant.cpp393
-rw-r--r--src/corelib/kernel/qvariant.h28
-rw-r--r--src/corelib/kernel/qvariant_p.h144
-rw-r--r--src/corelib/kernel/qwineventnotifier.cpp2
-rw-r--r--src/corelib/kernel/qwineventnotifier.h2
-rw-r--r--src/corelib/plugin/qelfparser_p.cpp2
-rw-r--r--src/corelib/plugin/qelfparser_p.h2
-rw-r--r--src/corelib/plugin/qfactoryinterface.h2
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp2
-rw-r--r--src/corelib/plugin/qfactoryloader_p.h2
-rw-r--r--src/corelib/plugin/qlibrary.cpp96
-rw-r--r--src/corelib/plugin/qlibrary.h2
-rw-r--r--src/corelib/plugin/qlibrary_p.h2
-rw-r--r--src/corelib/plugin/qlibrary_unix.cpp2
-rw-r--r--src/corelib/plugin/qlibrary_win.cpp2
-rw-r--r--src/corelib/plugin/qplugin.h2
-rw-r--r--src/corelib/plugin/qplugin.qdoc2
-rw-r--r--src/corelib/plugin/qpluginloader.cpp62
-rw-r--r--src/corelib/plugin/qpluginloader.h2
-rw-r--r--src/corelib/plugin/qsystemlibrary.cpp2
-rw-r--r--src/corelib/plugin/qsystemlibrary_p.h2
-rw-r--r--src/corelib/plugin/quuid.cpp85
-rw-r--r--src/corelib/plugin/quuid.h36
-rw-r--r--src/corelib/statemachine/qabstractstate.cpp2
-rw-r--r--src/corelib/statemachine/qabstractstate.h2
-rw-r--r--src/corelib/statemachine/qabstractstate_p.h2
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp2
-rw-r--r--src/corelib/statemachine/qabstracttransition.h2
-rw-r--r--src/corelib/statemachine/qabstracttransition_p.h2
-rw-r--r--src/corelib/statemachine/qeventtransition.cpp2
-rw-r--r--src/corelib/statemachine/qeventtransition.h2
-rw-r--r--src/corelib/statemachine/qeventtransition_p.h2
-rw-r--r--src/corelib/statemachine/qfinalstate.cpp2
-rw-r--r--src/corelib/statemachine/qfinalstate.h2
-rw-r--r--src/corelib/statemachine/qhistorystate.cpp2
-rw-r--r--src/corelib/statemachine/qhistorystate.h2
-rw-r--r--src/corelib/statemachine/qhistorystate_p.h2
-rw-r--r--src/corelib/statemachine/qsignaleventgenerator_p.h2
-rw-r--r--src/corelib/statemachine/qsignaltransition.cpp2
-rw-r--r--src/corelib/statemachine/qsignaltransition.h2
-rw-r--r--src/corelib/statemachine/qsignaltransition_p.h2
-rw-r--r--src/corelib/statemachine/qstate.cpp2
-rw-r--r--src/corelib/statemachine/qstate.h2
-rw-r--r--src/corelib/statemachine/qstate_p.h2
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp2
-rw-r--r--src/corelib/statemachine/qstatemachine.h2
-rw-r--r--src/corelib/statemachine/qstatemachine_p.h2
-rw-r--r--src/corelib/thread/qatomic.cpp2
-rw-r--r--src/corelib/thread/qatomic.h4
-rw-r--r--src/corelib/thread/qmutex.cpp2
-rw-r--r--src/corelib/thread/qmutex.h2
-rw-r--r--src/corelib/thread/qmutex_linux.cpp2
-rw-r--r--src/corelib/thread/qmutex_mac.cpp2
-rw-r--r--src/corelib/thread/qmutex_p.h2
-rw-r--r--src/corelib/thread/qmutex_unix.cpp2
-rw-r--r--src/corelib/thread/qmutex_win.cpp2
-rw-r--r--src/corelib/thread/qmutexpool.cpp2
-rw-r--r--src/corelib/thread/qmutexpool_p.h2
-rw-r--r--src/corelib/thread/qoldbasicatomic.h (renamed from src/corelib/thread/qbasicatomic.h)2
-rw-r--r--src/corelib/thread/qorderedmutexlocker_p.h2
-rw-r--r--src/corelib/thread/qreadwritelock.cpp15
-rw-r--r--src/corelib/thread/qreadwritelock.h5
-rw-r--r--src/corelib/thread/qreadwritelock_p.h2
-rw-r--r--src/corelib/thread/qsemaphore.cpp2
-rw-r--r--src/corelib/thread/qsemaphore.h2
-rw-r--r--src/corelib/thread/qthread.cpp2
-rw-r--r--src/corelib/thread/qthread.h2
-rw-r--r--src/corelib/thread/qthread_p.h16
-rw-r--r--src/corelib/thread/qthread_unix.cpp2
-rw-r--r--src/corelib/thread/qthread_win.cpp2
-rw-r--r--src/corelib/thread/qthreadstorage.cpp2
-rw-r--r--src/corelib/thread/qthreadstorage.h2
-rw-r--r--src/corelib/thread/qwaitcondition.h2
-rw-r--r--src/corelib/thread/qwaitcondition.qdoc2
-rw-r--r--src/corelib/thread/qwaitcondition_unix.cpp2
-rw-r--r--src/corelib/thread/qwaitcondition_win.cpp2
-rw-r--r--src/corelib/thread/thread.pri4
-rw-r--r--src/corelib/tools/qalgorithms.h2
-rw-r--r--src/corelib/tools/qalgorithms.qdoc2
-rw-r--r--src/corelib/tools/qbitarray.cpp20
-rw-r--r--src/corelib/tools/qbitarray.h6
-rw-r--r--src/corelib/tools/qbytearray.cpp32
-rw-r--r--src/corelib/tools/qbytearray.h2
-rw-r--r--src/corelib/tools/qbytearraymatcher.cpp2
-rw-r--r--src/corelib/tools/qbytearraymatcher.h2
-rw-r--r--src/corelib/tools/qbytedata_p.h2
-rw-r--r--src/corelib/tools/qcache.h5
-rw-r--r--src/corelib/tools/qcache.qdoc2
-rw-r--r--src/corelib/tools/qchar.cpp2
-rw-r--r--src/corelib/tools/qchar.h2
-rw-r--r--src/corelib/tools/qcontainerfwd.h2
-rw-r--r--src/corelib/tools/qcontiguouscache.cpp2
-rw-r--r--src/corelib/tools/qcontiguouscache.h2
-rw-r--r--src/corelib/tools/qcryptographichash.cpp25
-rw-r--r--src/corelib/tools/qcryptographichash.h4
-rw-r--r--src/corelib/tools/qdatetime.cpp83
-rw-r--r--src/corelib/tools/qdatetime.h19
-rw-r--r--src/corelib/tools/qdatetime_p.h2
-rw-r--r--src/corelib/tools/qeasingcurve.cpp2
-rw-r--r--src/corelib/tools/qeasingcurve.h2
-rw-r--r--src/corelib/tools/qelapsedtimer.cpp2
-rw-r--r--src/corelib/tools/qelapsedtimer.h2
-rw-r--r--src/corelib/tools/qelapsedtimer_generic.cpp2
-rw-r--r--src/corelib/tools/qelapsedtimer_mac.cpp2
-rw-r--r--src/corelib/tools/qelapsedtimer_symbian.cpp2
-rw-r--r--src/corelib/tools/qelapsedtimer_unix.cpp2
-rw-r--r--src/corelib/tools/qelapsedtimer_win.cpp2
-rw-r--r--src/corelib/tools/qfreelist.cpp2
-rw-r--r--src/corelib/tools/qfreelist_p.h2
-rw-r--r--src/corelib/tools/qharfbuzz.cpp2
-rw-r--r--src/corelib/tools/qharfbuzz_p.h2
-rw-r--r--src/corelib/tools/qhash.cpp6
-rw-r--r--src/corelib/tools/qhash.h2
-rw-r--r--src/corelib/tools/qiterator.h2
-rw-r--r--src/corelib/tools/qiterator.qdoc2
-rw-r--r--src/corelib/tools/qline.cpp2
-rw-r--r--src/corelib/tools/qline.h2
-rw-r--r--src/corelib/tools/qlinkedlist.cpp2
-rw-r--r--src/corelib/tools/qlinkedlist.h2
-rw-r--r--src/corelib/tools/qlist.cpp10
-rw-r--r--src/corelib/tools/qlist.h2
-rw-r--r--src/corelib/tools/qlocale.cpp22
-rw-r--r--src/corelib/tools/qlocale.h14
-rw-r--r--src/corelib/tools/qlocale.qdoc6
-rw-r--r--src/corelib/tools/qlocale_data_p.h2
-rw-r--r--src/corelib/tools/qlocale_icu.cpp2
-rw-r--r--src/corelib/tools/qlocale_mac.mm2
-rw-r--r--src/corelib/tools/qlocale_p.h2
-rw-r--r--src/corelib/tools/qlocale_symbian.cpp2
-rw-r--r--src/corelib/tools/qlocale_tools.cpp6
-rw-r--r--src/corelib/tools/qlocale_tools_p.h2
-rw-r--r--src/corelib/tools/qlocale_unix.cpp2
-rw-r--r--src/corelib/tools/qlocale_win.cpp2
-rw-r--r--src/corelib/tools/qmap.cpp8
-rw-r--r--src/corelib/tools/qmap.h2
-rw-r--r--src/corelib/tools/qmargins.cpp2
-rw-r--r--src/corelib/tools/qmargins.h2
-rw-r--r--src/corelib/tools/qpair.h2
-rw-r--r--src/corelib/tools/qpair.qdoc2
-rw-r--r--src/corelib/tools/qpodlist_p.h2
-rw-r--r--src/corelib/tools/qpoint.cpp2
-rw-r--r--src/corelib/tools/qpoint.h2
-rw-r--r--src/corelib/tools/qqueue.cpp2
-rw-r--r--src/corelib/tools/qqueue.h2
-rw-r--r--src/corelib/tools/qrect.cpp2
-rw-r--r--src/corelib/tools/qrect.h53
-rw-r--r--src/corelib/tools/qrefcount.cpp2
-rw-r--r--src/corelib/tools/qrefcount.h2
-rw-r--r--src/corelib/tools/qregexp.cpp12
-rw-r--r--src/corelib/tools/qregexp.h6
-rw-r--r--src/corelib/tools/qringbuffer_p.h2
-rw-r--r--src/corelib/tools/qscopedpointer.cpp2
-rw-r--r--src/corelib/tools/qscopedpointer.h2
-rw-r--r--src/corelib/tools/qscopedpointer_p.h2
-rw-r--r--src/corelib/tools/qscopedvaluerollback.cpp2
-rw-r--r--src/corelib/tools/qscopedvaluerollback.h2
-rw-r--r--src/corelib/tools/qset.h18
-rw-r--r--src/corelib/tools/qset.qdoc2
-rw-r--r--src/corelib/tools/qshareddata.cpp2
-rw-r--r--src/corelib/tools/qshareddata.h2
-rw-r--r--src/corelib/tools/qsharedpointer.cpp2
-rw-r--r--src/corelib/tools/qsharedpointer.h2
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h2
-rw-r--r--src/corelib/tools/qsimd.cpp2
-rw-r--r--src/corelib/tools/qsimd_p.h2
-rw-r--r--src/corelib/tools/qsize.cpp2
-rw-r--r--src/corelib/tools/qsize.h2
-rw-r--r--src/corelib/tools/qstack.cpp2
-rw-r--r--src/corelib/tools/qstack.h2
-rw-r--r--src/corelib/tools/qstring.cpp93
-rw-r--r--src/corelib/tools/qstring.h105
-rw-r--r--src/corelib/tools/qstringbuilder.cpp2
-rw-r--r--src/corelib/tools/qstringbuilder.h2
-rw-r--r--src/corelib/tools/qstringlist.cpp2
-rw-r--r--src/corelib/tools/qstringlist.h2
-rw-r--r--src/corelib/tools/qstringmatcher.cpp2
-rw-r--r--src/corelib/tools/qstringmatcher.h2
-rw-r--r--src/corelib/tools/qtextboundaryfinder.cpp2
-rw-r--r--src/corelib/tools/qtextboundaryfinder.h2
-rw-r--r--src/corelib/tools/qtimeline.cpp2
-rw-r--r--src/corelib/tools/qtimeline.h2
-rw-r--r--src/corelib/tools/qtools_p.h2
-rw-r--r--src/corelib/tools/qunicodetables.cpp2
-rw-r--r--src/corelib/tools/qunicodetables_p.h2
-rw-r--r--src/corelib/tools/qvarlengtharray.h7
-rw-r--r--src/corelib/tools/qvarlengtharray.qdoc39
-rw-r--r--src/corelib/tools/qvector.cpp12
-rw-r--r--src/corelib/tools/qvector.h6
-rw-r--r--src/corelib/tools/qvsnprintf.cpp2
-rwxr-xr-xsrc/corelib/xml/make-parser.sh2
-rw-r--r--src/corelib/xml/qxmlstream.cpp10
-rw-r--r--src/corelib/xml/qxmlstream.g2
-rw-r--r--src/corelib/xml/qxmlstream.h2
-rw-r--r--src/corelib/xml/qxmlstream_p.h2
-rw-r--r--src/corelib/xml/qxmlutils.cpp2
-rw-r--r--src/corelib/xml/qxmlutils_p.h2
-rw-r--r--src/dbus/qdbus_symbols.cpp2
-rw-r--r--src/dbus/qdbus_symbols_p.h2
-rw-r--r--src/dbus/qdbusabstractadaptor.cpp2
-rw-r--r--src/dbus/qdbusabstractadaptor.h2
-rw-r--r--src/dbus/qdbusabstractadaptor_p.h2
-rw-r--r--src/dbus/qdbusabstractinterface.cpp2
-rw-r--r--src/dbus/qdbusabstractinterface.h2
-rw-r--r--src/dbus/qdbusabstractinterface_p.h2
-rw-r--r--src/dbus/qdbusargument.cpp2
-rw-r--r--src/dbus/qdbusargument.h2
-rw-r--r--src/dbus/qdbusargument_p.h8
-rw-r--r--src/dbus/qdbusconnection.cpp33
-rw-r--r--src/dbus/qdbusconnection.h2
-rw-r--r--src/dbus/qdbusconnection_p.h2
-rw-r--r--src/dbus/qdbusconnectioninterface.cpp2
-rw-r--r--src/dbus/qdbusconnectioninterface.h2
-rw-r--r--src/dbus/qdbusconnectionmanager_p.h2
-rw-r--r--src/dbus/qdbuscontext.cpp2
-rw-r--r--src/dbus/qdbuscontext.h2
-rw-r--r--src/dbus/qdbuscontext_p.h2
-rw-r--r--src/dbus/qdbusdemarshaller.cpp79
-rw-r--r--src/dbus/qdbuserror.cpp2
-rw-r--r--src/dbus/qdbuserror.h2
-rw-r--r--src/dbus/qdbusextratypes.cpp6
-rw-r--r--src/dbus/qdbusextratypes.h26
-rw-r--r--src/dbus/qdbusintegrator.cpp2
-rw-r--r--src/dbus/qdbusintegrator_p.h2
-rw-r--r--src/dbus/qdbusinterface.cpp2
-rw-r--r--src/dbus/qdbusinterface.h2
-rw-r--r--src/dbus/qdbusinterface_p.h2
-rw-r--r--src/dbus/qdbusinternalfilters.cpp2
-rw-r--r--src/dbus/qdbusintrospection.cpp2
-rw-r--r--src/dbus/qdbusintrospection_p.h2
-rw-r--r--src/dbus/qdbusmacros.h2
-rw-r--r--src/dbus/qdbusmarshaller.cpp2
-rw-r--r--src/dbus/qdbusmessage.cpp4
-rw-r--r--src/dbus/qdbusmessage.h2
-rw-r--r--src/dbus/qdbusmessage_p.h2
-rw-r--r--src/dbus/qdbusmetaobject.cpp2
-rw-r--r--src/dbus/qdbusmetaobject_p.h2
-rw-r--r--src/dbus/qdbusmetatype.cpp2
-rw-r--r--src/dbus/qdbusmetatype.h2
-rw-r--r--src/dbus/qdbusmetatype_p.h2
-rw-r--r--src/dbus/qdbusmisc.cpp2
-rw-r--r--src/dbus/qdbuspendingcall.cpp2
-rw-r--r--src/dbus/qdbuspendingcall.h2
-rw-r--r--src/dbus/qdbuspendingcall_p.h2
-rw-r--r--src/dbus/qdbuspendingreply.cpp2
-rw-r--r--src/dbus/qdbuspendingreply.h2
-rw-r--r--src/dbus/qdbusreply.cpp2
-rw-r--r--src/dbus/qdbusreply.h2
-rw-r--r--src/dbus/qdbusserver.cpp2
-rw-r--r--src/dbus/qdbusserver.h2
-rw-r--r--src/dbus/qdbusservicewatcher.cpp2
-rw-r--r--src/dbus/qdbusservicewatcher.h2
-rw-r--r--src/dbus/qdbusthreaddebug_p.h2
-rw-r--r--src/dbus/qdbusunixfiledescriptor.cpp2
-rw-r--r--src/dbus/qdbusunixfiledescriptor.h2
-rw-r--r--src/dbus/qdbusutil.cpp2
-rw-r--r--src/dbus/qdbusutil_p.h2
-rw-r--r--src/dbus/qdbusvirtualobject.cpp2
-rw-r--r--src/dbus/qdbusvirtualobject.h2
-rw-r--r--src/dbus/qdbusxmlgenerator.cpp2
-rw-r--r--src/dbus/qdbusxmlparser.cpp2
-rw-r--r--src/dbus/qdbusxmlparser_p.h2
-rw-r--r--src/gui/Qt5GuiConfigExtras.cmake.in4
-rw-r--r--src/gui/accessible/accessible.pri12
-rw-r--r--src/gui/accessible/qaccessible.cpp336
-rw-r--r--src/gui/accessible/qaccessible.h165
-rw-r--r--src/gui/accessible/qaccessible2.cpp371
-rw-r--r--src/gui/accessible/qaccessible2.h45
-rw-r--r--src/gui/accessible/qaccessible_mac.mm2469
-rw-r--r--src/gui/accessible/qaccessible_mac_carbon.cpp119
-rw-r--r--src/gui/accessible/qaccessible_mac_cocoa.mm239
-rw-r--r--src/gui/accessible/qaccessible_mac_p.h479
-rw-r--r--src/gui/accessible/qaccessiblebridge.cpp2
-rw-r--r--src/gui/accessible/qaccessiblebridge.h2
-rw-r--r--src/gui/accessible/qaccessibleobject.cpp39
-rw-r--r--src/gui/accessible/qaccessibleobject.h4
-rw-r--r--src/gui/accessible/qaccessibleplugin.cpp2
-rw-r--r--src/gui/accessible/qaccessibleplugin.h2
-rw-r--r--src/gui/accessible/qplatformaccessibility_qpa.cpp7
-rw-r--r--src/gui/accessible/qplatformaccessibility_qpa.h2
-rw-r--r--src/gui/egl/qegl.cpp2
-rw-r--r--src/gui/egl/qegl_p.h2
-rw-r--r--src/gui/egl/qegl_qpa.cpp2
-rw-r--r--src/gui/egl/qegl_stub.cpp2
-rw-r--r--src/gui/egl/qeglcontext_p.h2
-rw-r--r--src/gui/egl/qeglproperties.cpp2
-rw-r--r--src/gui/egl/qeglproperties_p.h2
-rw-r--r--src/gui/egl/qeglproperties_stub.cpp2
-rw-r--r--src/gui/image/qbitmap.cpp2
-rw-r--r--src/gui/image/qbitmap.h2
-rw-r--r--src/gui/image/qbmphandler.cpp2
-rw-r--r--src/gui/image/qbmphandler_p.h2
-rw-r--r--src/gui/image/qgifhandler.cpp2
-rw-r--r--src/gui/image/qgifhandler_p.h2
-rw-r--r--src/gui/image/qimage.cpp21
-rw-r--r--src/gui/image/qimage.h13
-rw-r--r--src/gui/image/qimage_neon.cpp2
-rw-r--r--src/gui/image/qimage_p.h2
-rw-r--r--src/gui/image/qimage_sse2.cpp2
-rw-r--r--src/gui/image/qimage_ssse3.cpp2
-rw-r--r--src/gui/image/qimageiohandler.cpp2
-rw-r--r--src/gui/image/qimageiohandler.h2
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks.cpp2
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks_p.h2
-rw-r--r--src/gui/image/qimagereader.cpp2
-rw-r--r--src/gui/image/qimagereader.h2
-rw-r--r--src/gui/image/qimagewriter.cpp2
-rw-r--r--src/gui/image/qimagewriter.h2
-rw-r--r--src/gui/image/qjpeghandler.cpp2
-rw-r--r--src/gui/image/qjpeghandler_p.h2
-rw-r--r--src/gui/image/qmnghandler.cpp2
-rw-r--r--src/gui/image/qmnghandler_p.h2
-rw-r--r--src/gui/image/qmovie.cpp11
-rw-r--r--src/gui/image/qmovie.h4
-rw-r--r--src/gui/image/qnativeimage.cpp2
-rw-r--r--src/gui/image/qnativeimage_p.h2
-rw-r--r--src/gui/image/qpaintengine_pic.cpp2
-rw-r--r--src/gui/image/qpaintengine_pic_p.h2
-rw-r--r--src/gui/image/qpicture.cpp13
-rw-r--r--src/gui/image/qpicture.h3
-rw-r--r--src/gui/image/qpicture_p.h2
-rw-r--r--src/gui/image/qpictureformatplugin.cpp2
-rw-r--r--src/gui/image/qpictureformatplugin.h2
-rw-r--r--src/gui/image/qpixmap.cpp10
-rw-r--r--src/gui/image/qpixmap.h6
-rw-r--r--src/gui/image/qpixmap_blitter.cpp2
-rw-r--r--src/gui/image/qpixmap_blitter_p.h34
-rw-r--r--src/gui/image/qpixmap_qpa.cpp2
-rw-r--r--src/gui/image/qpixmap_raster.cpp2
-rw-r--r--src/gui/image/qpixmap_raster_p.h2
-rw-r--r--src/gui/image/qpixmap_win.cpp2
-rw-r--r--src/gui/image/qpixmapcache.cpp2
-rw-r--r--src/gui/image/qpixmapcache.h2
-rw-r--r--src/gui/image/qpixmapcache_p.h2
-rw-r--r--src/gui/image/qplatformpixmap.cpp2
-rw-r--r--src/gui/image/qplatformpixmap_qpa.h2
-rw-r--r--src/gui/image/qpnghandler.cpp2
-rw-r--r--src/gui/image/qpnghandler_p.h2
-rw-r--r--src/gui/image/qppmhandler.cpp2
-rw-r--r--src/gui/image/qppmhandler_p.h2
-rw-r--r--src/gui/image/qtiffhandler.cpp20
-rw-r--r--src/gui/image/qtiffhandler_p.h2
-rw-r--r--src/gui/image/qvolatileimage.cpp2
-rw-r--r--src/gui/image/qvolatileimage_p.h2
-rw-r--r--src/gui/image/qvolatileimagedata.cpp2
-rw-r--r--src/gui/image/qvolatileimagedata_p.h2
-rw-r--r--src/gui/image/qvolatileimagedata_symbian.cpp2
-rw-r--r--src/gui/image/qxbmhandler.cpp2
-rw-r--r--src/gui/image/qxbmhandler_p.h2
-rw-r--r--src/gui/image/qxpmhandler.cpp2
-rw-r--r--src/gui/image/qxpmhandler_p.h2
-rw-r--r--src/gui/kernel/kernel.pri2
-rw-r--r--src/gui/kernel/qclipboard.cpp2
-rw-r--r--src/gui/kernel/qclipboard.h2
-rw-r--r--src/gui/kernel/qclipboard_qpa.cpp2
-rw-r--r--src/gui/kernel/qcursor.cpp12
-rw-r--r--src/gui/kernel/qcursor.h7
-rw-r--r--src/gui/kernel/qcursor_p.h2
-rw-r--r--src/gui/kernel/qcursor_qpa.cpp2
-rw-r--r--src/gui/kernel/qdnd.cpp2
-rw-r--r--src/gui/kernel/qdnd_p.h2
-rw-r--r--src/gui/kernel/qdrag.cpp2
-rw-r--r--src/gui/kernel/qdrag.h2
-rw-r--r--src/gui/kernel/qevent.cpp86
-rw-r--r--src/gui/kernel/qevent.h17
-rw-r--r--src/gui/kernel/qevent_p.h2
-rw-r--r--src/gui/kernel/qgenericplugin_qpa.cpp2
-rw-r--r--src/gui/kernel/qgenericplugin_qpa.h2
-rw-r--r--src/gui/kernel/qgenericpluginfactory_qpa.cpp2
-rw-r--r--src/gui/kernel/qgenericpluginfactory_qpa.h2
-rw-r--r--src/gui/kernel/qguiapplication.cpp155
-rw-r--r--src/gui/kernel/qguiapplication.h8
-rw-r--r--src/gui/kernel/qguiapplication_p.h23
-rw-r--r--src/gui/kernel/qguivariant.cpp164
-rw-r--r--src/gui/kernel/qinputpanel.cpp32
-rw-r--r--src/gui/kernel/qinputpanel.h11
-rw-r--r--src/gui/kernel/qinputpanel_p.h2
-rw-r--r--src/gui/kernel/qkeymapper.cpp2
-rw-r--r--src/gui/kernel/qkeymapper_p.h2
-rw-r--r--src/gui/kernel/qkeymapper_qpa.cpp2
-rw-r--r--src/gui/kernel/qkeysequence.cpp17
-rw-r--r--src/gui/kernel/qkeysequence.h2
-rw-r--r--src/gui/kernel/qkeysequence_p.h2
-rw-r--r--src/gui/kernel/qopenglcontext.cpp17
-rw-r--r--src/gui/kernel/qopenglcontext.h7
-rw-r--r--src/gui/kernel/qopenglcontext_p.h2
-rw-r--r--src/gui/kernel/qpalette.cpp11
-rw-r--r--src/gui/kernel/qpalette.h6
-rw-r--r--src/gui/kernel/qplatformclipboard_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformclipboard_qpa.h2
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.h2
-rw-r--r--src/gui/kernel/qplatformdrag_qpa.h2
-rw-r--r--src/gui/kernel/qplatforminputcontext_qpa.cpp24
-rw-r--r--src/gui/kernel/qplatforminputcontext_qpa.h7
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.cpp16
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.h6
-rw-r--r--src/gui/kernel/qplatformintegrationfactory_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformintegrationfactory_qpa_p.h2
-rw-r--r--src/gui/kernel/qplatformintegrationplugin_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformintegrationplugin_qpa.h2
-rw-r--r--src/gui/kernel/qplatformnativeinterface_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformnativeinterface_qpa.h2
-rw-r--r--src/gui/kernel/qplatformopenglcontext_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformopenglcontext_qpa.h2
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.cpp11
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.h4
-rw-r--r--src/gui/kernel/qplatformscreen_qpa_p.h (renamed from src/plugins/bearer/icd/iapmonitor.h)44
-rw-r--r--src/gui/kernel/qplatformsurface_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformsurface_qpa.h2
-rw-r--r--src/gui/kernel/qplatformtheme_qpa.cpp43
-rw-r--r--src/gui/kernel/qplatformtheme_qpa.h11
-rw-r--r--src/gui/kernel/qplatformthemefactory_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformthemefactory_qpa_p.h2
-rw-r--r--src/gui/kernel/qplatformthemeplugin_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformthemeplugin_qpa.h2
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.h2
-rw-r--r--src/gui/kernel/qscreen.cpp40
-rw-r--r--src/gui/kernel/qscreen.h3
-rw-r--r--src/gui/kernel/qscreen_p.h (renamed from src/plugins/bearer/icd/main.cpp)64
-rw-r--r--src/gui/kernel/qsessionmanager.h2
-rw-r--r--src/gui/kernel/qsessionmanager_qpa.cpp2
-rw-r--r--src/gui/kernel/qshortcutmap.cpp2
-rw-r--r--src/gui/kernel/qshortcutmap_p.h2
-rw-r--r--src/gui/kernel/qstylehints.cpp12
-rw-r--r--src/gui/kernel/qstylehints.h4
-rw-r--r--src/gui/kernel/qsurface.cpp2
-rw-r--r--src/gui/kernel/qsurface.h2
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp2
-rw-r--r--src/gui/kernel/qsurfaceformat.h2
-rw-r--r--src/gui/kernel/qt_gui_pch.h2
-rw-r--r--src/gui/kernel/qtouchdevice.cpp2
-rw-r--r--src/gui/kernel/qtouchdevice.h2
-rw-r--r--src/gui/kernel/qtouchdevice_p.h2
-rw-r--r--src/gui/kernel/qwindow.cpp111
-rw-r--r--src/gui/kernel/qwindow.h8
-rw-r--r--src/gui/kernel/qwindow_p.h2
-rw-r--r--src/gui/kernel/qwindowdefs.h2
-rw-r--r--src/gui/kernel/qwindowdefs_win.h2
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.cpp68
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.h17
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa_p.h28
-rw-r--r--src/gui/math3d/qgenericmatrix.cpp2
-rw-r--r--src/gui/math3d/qgenericmatrix.h2
-rw-r--r--src/gui/math3d/qmatrix4x4.cpp2
-rw-r--r--src/gui/math3d/qmatrix4x4.h2
-rw-r--r--src/gui/math3d/qquaternion.cpp2
-rw-r--r--src/gui/math3d/qquaternion.h2
-rw-r--r--src/gui/math3d/qvector2d.cpp2
-rw-r--r--src/gui/math3d/qvector2d.h2
-rw-r--r--src/gui/math3d/qvector3d.cpp2
-rw-r--r--src/gui/math3d/qvector3d.h2
-rw-r--r--src/gui/math3d/qvector4d.cpp2
-rw-r--r--src/gui/math3d/qvector4d.h2
-rw-r--r--src/gui/opengl/qopengl.cpp2
-rw-r--r--src/gui/opengl/qopengl.h2
-rw-r--r--src/gui/opengl/qopengl2pexvertexarray.cpp2
-rw-r--r--src/gui/opengl/qopengl2pexvertexarray_p.h2
-rw-r--r--src/gui/opengl/qopengl_p.h2
-rw-r--r--src/gui/opengl/qopenglbuffer.cpp2
-rw-r--r--src/gui/opengl/qopenglbuffer.h2
-rw-r--r--src/gui/opengl/qopenglcustomshaderstage.cpp2
-rw-r--r--src/gui/opengl/qopenglcustomshaderstage_p.h2
-rw-r--r--src/gui/opengl/qopenglengineshadermanager.cpp8
-rw-r--r--src/gui/opengl/qopenglengineshadermanager_p.h2
-rw-r--r--src/gui/opengl/qopenglengineshadersource_p.h2
-rw-r--r--src/gui/opengl/qopenglextensions_p.h2
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp2
-rw-r--r--src/gui/opengl/qopenglframebufferobject.h2
-rw-r--r--src/gui/opengl/qopenglframebufferobject_p.h2
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp2
-rw-r--r--src/gui/opengl/qopenglfunctions.h2
-rw-r--r--src/gui/opengl/qopenglgradientcache.cpp2
-rw-r--r--src/gui/opengl/qopenglgradientcache_p.h2
-rw-r--r--src/gui/opengl/qopenglpaintdevice.cpp2
-rw-r--r--src/gui/opengl/qopenglpaintdevice.h2
-rw-r--r--src/gui/opengl/qopenglpaintengine.cpp20
-rw-r--r--src/gui/opengl/qopenglpaintengine_p.h2
-rw-r--r--src/gui/opengl/qopenglshadercache_meego_p.h2
-rw-r--r--src/gui/opengl/qopenglshadercache_p.h2
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp3
-rw-r--r--src/gui/opengl/qopenglshaderprogram.h2
-rw-r--r--src/gui/opengl/qopengltexturecache.cpp6
-rw-r--r--src/gui/opengl/qopengltexturecache_p.h4
-rw-r--r--src/gui/opengl/qopengltextureglyphcache.cpp2
-rw-r--r--src/gui/opengl/qopengltextureglyphcache_p.h2
-rw-r--r--src/gui/opengl/qopengltriangulatingstroker.cpp2
-rw-r--r--src/gui/opengl/qopengltriangulatingstroker_p.h2
-rw-r--r--src/gui/opengl/qrbtree_p.h2
-rw-r--r--src/gui/opengl/qtriangulator.cpp75
-rw-r--r--src/gui/opengl/qtriangulator_p.h2
-rw-r--r--src/gui/painting/qbackingstore.cpp2
-rw-r--r--src/gui/painting/qbackingstore.h2
-rw-r--r--src/gui/painting/qbezier.cpp50
-rw-r--r--src/gui/painting/qbezier_p.h4
-rw-r--r--src/gui/painting/qblendfunctions.cpp2
-rw-r--r--src/gui/painting/qblendfunctions_p.h2
-rw-r--r--src/gui/painting/qblittable.cpp8
-rw-r--r--src/gui/painting/qblittable_p.h4
-rw-r--r--src/gui/painting/qbrush.cpp2
-rw-r--r--src/gui/painting/qbrush.h2
-rw-r--r--src/gui/painting/qcolor.cpp2
-rw-r--r--src/gui/painting/qcolor.h2
-rw-r--r--src/gui/painting/qcolor_p.cpp2
-rw-r--r--src/gui/painting/qcolor_p.h2
-rw-r--r--src/gui/painting/qcosmeticstroker.cpp2
-rw-r--r--src/gui/painting/qcosmeticstroker_p.h2
-rw-r--r--src/gui/painting/qcssutil.cpp2
-rw-r--r--src/gui/painting/qcssutil_p.h2
-rw-r--r--src/gui/painting/qdatabuffer_p.h2
-rw-r--r--src/gui/painting/qdrawhelper.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_arm_simd.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_arm_simd_p.h2
-rw-r--r--src/gui/painting/qdrawhelper_iwmmxt.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_mmx.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_mmx3dnow.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_mmx_p.h2
-rw-r--r--src/gui/painting/qdrawhelper_neon.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_neon_asm.S2
-rw-r--r--src/gui/painting/qdrawhelper_neon_p.h2
-rw-r--r--src/gui/painting/qdrawhelper_p.h2
-rw-r--r--src/gui/painting/qdrawhelper_sse.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_sse2.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_sse3dnow.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_sse_p.h2
-rw-r--r--src/gui/painting/qdrawhelper_ssse3.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_x86_p.h2
-rw-r--r--src/gui/painting/qdrawingprimitive_sse2_p.h2
-rw-r--r--src/gui/painting/qemulationpaintengine.cpp2
-rw-r--r--src/gui/painting/qemulationpaintengine_p.h2
-rw-r--r--src/gui/painting/qfixed_p.h2
-rw-r--r--src/gui/painting/qgrayraster.c62
-rw-r--r--src/gui/painting/qgrayraster_p.h2
-rw-r--r--src/gui/painting/qimagescale.cpp2
-rw-r--r--src/gui/painting/qimagescale_p.h2
-rw-r--r--src/gui/painting/qmath_p.h2
-rw-r--r--src/gui/painting/qmatrix.cpp2
-rw-r--r--src/gui/painting/qmatrix.h2
-rw-r--r--src/gui/painting/qmemrotate.cpp2
-rw-r--r--src/gui/painting/qmemrotate_p.h2
-rw-r--r--src/gui/painting/qoutlinemapper.cpp92
-rw-r--r--src/gui/painting/qoutlinemapper_p.h26
-rw-r--r--src/gui/painting/qpagedpaintdevice.cpp2
-rw-r--r--src/gui/painting/qpagedpaintdevice.h2
-rw-r--r--src/gui/painting/qpagedpaintdevice_p.h2
-rw-r--r--src/gui/painting/qpaintbuffer.cpp2
-rw-r--r--src/gui/painting/qpaintbuffer_p.h2
-rw-r--r--src/gui/painting/qpaintdevice.cpp2
-rw-r--r--src/gui/painting/qpaintdevice.h2
-rw-r--r--src/gui/painting/qpaintdevice.qdoc2
-rw-r--r--src/gui/painting/qpaintdevice_qpa.cpp2
-rw-r--r--src/gui/painting/qpaintengine.cpp2
-rw-r--r--src/gui/painting/qpaintengine.h2
-rw-r--r--src/gui/painting/qpaintengine_blitter.cpp645
-rw-r--r--src/gui/painting/qpaintengine_blitter_p.h61
-rw-r--r--src/gui/painting/qpaintengine_p.h2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp111
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h10
-rw-r--r--src/gui/painting/qpaintengineex.cpp4
-rw-r--r--src/gui/painting/qpaintengineex_p.h2
-rw-r--r--src/gui/painting/qpainter.cpp4
-rw-r--r--src/gui/painting/qpainter.h2
-rw-r--r--src/gui/painting/qpainter_p.h2
-rw-r--r--src/gui/painting/qpainterpath.cpp2
-rw-r--r--src/gui/painting/qpainterpath.h2
-rw-r--r--src/gui/painting/qpainterpath_p.h2
-rw-r--r--src/gui/painting/qpathclipper.cpp2
-rw-r--r--src/gui/painting/qpathclipper_p.h2
-rw-r--r--src/gui/painting/qpdf.cpp2
-rw-r--r--src/gui/painting/qpdf_p.h2
-rw-r--r--src/gui/painting/qpdfwriter.cpp2
-rw-r--r--src/gui/painting/qpdfwriter.h2
-rw-r--r--src/gui/painting/qpen.cpp2
-rw-r--r--src/gui/painting/qpen.h2
-rw-r--r--src/gui/painting/qpen_p.h2
-rw-r--r--src/gui/painting/qplatformbackingstore_qpa.cpp2
-rw-r--r--src/gui/painting/qplatformbackingstore_qpa.h2
-rw-r--r--src/gui/painting/qpolygon.cpp2
-rw-r--r--src/gui/painting/qpolygon.h2
-rw-r--r--src/gui/painting/qpolygonclipper_p.h2
-rw-r--r--src/gui/painting/qrasterdefs_p.h2
-rw-r--r--src/gui/painting/qrasterizer.cpp2
-rw-r--r--src/gui/painting/qrasterizer_p.h2
-rw-r--r--src/gui/painting/qregion.cpp2
-rw-r--r--src/gui/painting/qregion.h2
-rw-r--r--src/gui/painting/qrgb.h2
-rw-r--r--src/gui/painting/qstroker.cpp2
-rw-r--r--src/gui/painting/qstroker_p.h2
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp2
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h2
-rw-r--r--src/gui/painting/qtransform.cpp2
-rw-r--r--src/gui/painting/qtransform.h2
-rw-r--r--src/gui/painting/qvectorpath_p.h2
-rw-r--r--src/gui/text/qabstractfontengine_p.h2
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.cpp2
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.h2
-rw-r--r--src/gui/text/qabstracttextdocumentlayout_p.h2
-rw-r--r--src/gui/text/qcssparser.cpp2
-rw-r--r--src/gui/text/qcssparser_p.h2
-rw-r--r--src/gui/text/qcssscanner.cpp2
-rw-r--r--src/gui/text/qfont.cpp34
-rw-r--r--src/gui/text/qfont.h2
-rw-r--r--src/gui/text/qfont_p.h2
-rw-r--r--src/gui/text/qfont_qpa.cpp2
-rw-r--r--src/gui/text/qfontdatabase.cpp2
-rw-r--r--src/gui/text/qfontdatabase.h2
-rw-r--r--src/gui/text/qfontdatabase_qpa.cpp2
-rw-r--r--src/gui/text/qfontengine.cpp2
-rw-r--r--src/gui/text/qfontengine_ft.cpp2
-rw-r--r--src/gui/text/qfontengine_ft_p.h2
-rw-r--r--src/gui/text/qfontengine_p.h2
-rw-r--r--src/gui/text/qfontengine_qpa.cpp2
-rw-r--r--src/gui/text/qfontengine_qpa_p.h2
-rw-r--r--src/gui/text/qfontengine_qpf.cpp2
-rw-r--r--src/gui/text/qfontengine_qpf_p.h2
-rw-r--r--src/gui/text/qfontenginedirectwrite.cpp2
-rw-r--r--src/gui/text/qfontenginedirectwrite_p.h2
-rw-r--r--src/gui/text/qfontengineglyphcache_p.h2
-rw-r--r--src/gui/text/qfontinfo.h2
-rw-r--r--src/gui/text/qfontmetrics.cpp2
-rw-r--r--src/gui/text/qfontmetrics.h2
-rw-r--r--src/gui/text/qfontsubset.cpp2
-rw-r--r--src/gui/text/qfontsubset_p.h2
-rw-r--r--src/gui/text/qfragmentmap.cpp2
-rw-r--r--src/gui/text/qfragmentmap_p.h2
-rw-r--r--src/gui/text/qglyphrun.cpp2
-rw-r--r--src/gui/text/qglyphrun.h2
-rw-r--r--src/gui/text/qglyphrun_p.h2
-rw-r--r--src/gui/text/qharfbuzz_copy_p.h2
-rw-r--r--src/gui/text/qlinecontrol.cpp2
-rw-r--r--src/gui/text/qlinecontrol_p.h4
-rw-r--r--src/gui/text/qpfutil.cpp2
-rw-r--r--src/gui/text/qplatformfontdatabase_qpa.cpp9
-rw-r--r--src/gui/text/qplatformfontdatabase_qpa.h3
-rw-r--r--src/gui/text/qrawfont.cpp2
-rw-r--r--src/gui/text/qrawfont.h2
-rw-r--r--src/gui/text/qrawfont_ft.cpp2
-rw-r--r--src/gui/text/qrawfont_p.h2
-rw-r--r--src/gui/text/qrawfont_qpa.cpp2
-rw-r--r--src/gui/text/qstatictext.cpp2
-rw-r--r--src/gui/text/qstatictext.h2
-rw-r--r--src/gui/text/qstatictext_p.h2
-rw-r--r--src/gui/text/qsyntaxhighlighter.cpp2
-rw-r--r--src/gui/text/qsyntaxhighlighter.h2
-rw-r--r--src/gui/text/qtextcontrol.cpp2
-rw-r--r--src/gui/text/qtextcontrol_p.h2
-rw-r--r--src/gui/text/qtextcontrol_p_p.h2
-rw-r--r--src/gui/text/qtextcursor.cpp35
-rw-r--r--src/gui/text/qtextcursor.h2
-rw-r--r--src/gui/text/qtextcursor_p.h2
-rw-r--r--src/gui/text/qtextdocument.cpp10
-rw-r--r--src/gui/text/qtextdocument.h2
-rw-r--r--src/gui/text/qtextdocument_p.cpp2
-rw-r--r--src/gui/text/qtextdocument_p.h2
-rw-r--r--src/gui/text/qtextdocumentfragment.cpp12
-rw-r--r--src/gui/text/qtextdocumentfragment.h5
-rw-r--r--src/gui/text/qtextdocumentfragment_p.h2
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp2
-rw-r--r--src/gui/text/qtextdocumentlayout_p.h2
-rw-r--r--src/gui/text/qtextdocumentwriter.cpp2
-rw-r--r--src/gui/text/qtextdocumentwriter.h2
-rw-r--r--src/gui/text/qtextengine.cpp7
-rw-r--r--src/gui/text/qtextengine_p.h2
-rw-r--r--src/gui/text/qtextformat.cpp80
-rw-r--r--src/gui/text/qtextformat.h25
-rw-r--r--src/gui/text/qtextformat_p.h2
-rw-r--r--src/gui/text/qtexthtmlparser.cpp2
-rw-r--r--src/gui/text/qtexthtmlparser_p.h2
-rw-r--r--src/gui/text/qtextimagehandler.cpp11
-rw-r--r--src/gui/text/qtextimagehandler_p.h5
-rw-r--r--src/gui/text/qtextlayout.cpp20
-rw-r--r--src/gui/text/qtextlayout.h2
-rw-r--r--src/gui/text/qtextlist.cpp2
-rw-r--r--src/gui/text/qtextlist.h2
-rw-r--r--src/gui/text/qtextobject.cpp2
-rw-r--r--src/gui/text/qtextobject.h2
-rw-r--r--src/gui/text/qtextobject_p.h2
-rw-r--r--src/gui/text/qtextodfwriter.cpp5
-rw-r--r--src/gui/text/qtextodfwriter_p.h2
-rw-r--r--src/gui/text/qtextoption.cpp2
-rw-r--r--src/gui/text/qtextoption.h2
-rw-r--r--src/gui/text/qtexttable.cpp2
-rw-r--r--src/gui/text/qtexttable.h2
-rw-r--r--src/gui/text/qtexttable_p.h2
-rw-r--r--src/gui/text/qzip.cpp2
-rw-r--r--src/gui/text/qzipreader_p.h2
-rw-r--r--src/gui/text/qzipwriter_p.h2
-rw-r--r--src/gui/util/qdesktopservices.cpp2
-rw-r--r--src/gui/util/qdesktopservices.h2
-rw-r--r--src/gui/util/qdesktopservices_mac.cpp2
-rw-r--r--src/gui/util/qdesktopservices_qpa.cpp2
-rw-r--r--src/gui/util/qdesktopservices_win.cpp2
-rw-r--r--src/gui/util/qdesktopservices_x11.cpp2
-rw-r--r--src/gui/util/qhexstring_p.h2
-rw-r--r--src/gui/util/qvalidator.cpp2
-rw-r--r--src/gui/util/qvalidator.h4
-rw-r--r--src/modules/qt_v8.pri16
-rw-r--r--src/network/access/access.pri6
-rw-r--r--src/network/access/qabstractnetworkcache.cpp2
-rw-r--r--src/network/access/qabstractnetworkcache.h2
-rw-r--r--src/network/access/qabstractnetworkcache_p.h2
-rw-r--r--src/network/access/qftp.cpp55
-rw-r--r--src/network/access/qftp_p.h (renamed from src/network/access/qftp.h)15
-rw-r--r--src/network/access/qhttp.cpp3150
-rw-r--r--src/network/access/qhttp.h311
-rw-r--r--src/network/access/qhttpheader.cpp770
-rw-r--r--src/network/access/qhttpheader_p.h147
-rw-r--r--src/network/access/qhttpmultipart.cpp2
-rw-r--r--src/network/access/qhttpmultipart.h2
-rw-r--r--src/network/access/qhttpmultipart_p.h2
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp84
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h7
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp26
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel_p.h4
-rw-r--r--src/network/access/qhttpnetworkheader.cpp2
-rw-r--r--src/network/access/qhttpnetworkheader_p.h2
-rw-r--r--src/network/access/qhttpnetworkreply.cpp2
-rw-r--r--src/network/access/qhttpnetworkreply_p.h2
-rw-r--r--src/network/access/qhttpnetworkrequest.cpp2
-rw-r--r--src/network/access/qhttpnetworkrequest_p.h2
-rw-r--r--src/network/access/qhttpthreaddelegate.cpp6
-rw-r--r--src/network/access/qhttpthreaddelegate_p.h2
-rw-r--r--src/network/access/qnetworkaccessauthenticationmanager.cpp14
-rw-r--r--src/network/access/qnetworkaccessauthenticationmanager_p.h4
-rw-r--r--src/network/access/qnetworkaccessbackend.cpp2
-rw-r--r--src/network/access/qnetworkaccessbackend_p.h2
-rw-r--r--src/network/access/qnetworkaccesscache.cpp2
-rw-r--r--src/network/access/qnetworkaccesscache_p.h2
-rw-r--r--src/network/access/qnetworkaccesscachebackend.cpp2
-rw-r--r--src/network/access/qnetworkaccesscachebackend_p.h2
-rw-r--r--src/network/access/qnetworkaccessdebugpipebackend.cpp2
-rw-r--r--src/network/access/qnetworkaccessdebugpipebackend_p.h2
-rw-r--r--src/network/access/qnetworkaccessfilebackend.cpp2
-rw-r--r--src/network/access/qnetworkaccessfilebackend_p.h2
-rw-r--r--src/network/access/qnetworkaccessftpbackend.cpp2
-rw-r--r--src/network/access/qnetworkaccessftpbackend_p.h4
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp22
-rw-r--r--src/network/access/qnetworkaccessmanager.h2
-rw-r--r--src/network/access/qnetworkaccessmanager_p.h2
-rw-r--r--src/network/access/qnetworkcookie.cpp2
-rw-r--r--src/network/access/qnetworkcookie.h5
-rw-r--r--src/network/access/qnetworkcookie_p.h2
-rw-r--r--src/network/access/qnetworkcookiejar.cpp2
-rw-r--r--src/network/access/qnetworkcookiejar.h7
-rw-r--r--src/network/access/qnetworkcookiejar_p.h2
-rw-r--r--src/network/access/qnetworkdiskcache.cpp2
-rw-r--r--src/network/access/qnetworkdiskcache.h2
-rw-r--r--src/network/access/qnetworkdiskcache_p.h2
-rw-r--r--src/network/access/qnetworkreply.cpp71
-rw-r--r--src/network/access/qnetworkreply.h6
-rw-r--r--src/network/access/qnetworkreply_p.h2
-rw-r--r--src/network/access/qnetworkreplydataimpl.cpp16
-rw-r--r--src/network/access/qnetworkreplydataimpl_p.h3
-rw-r--r--src/network/access/qnetworkreplyfileimpl.cpp2
-rw-r--r--src/network/access/qnetworkreplyfileimpl_p.h2
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp15
-rw-r--r--src/network/access/qnetworkreplyhttpimpl_p.h21
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp11
-rw-r--r--src/network/access/qnetworkreplyimpl_p.h17
-rw-r--r--src/network/access/qnetworkrequest.cpp2
-rw-r--r--src/network/access/qnetworkrequest.h2
-rw-r--r--src/network/access/qnetworkrequest_p.h2
-rw-r--r--src/network/bearer/qbearerengine.cpp2
-rw-r--r--src/network/bearer/qbearerengine_p.h2
-rw-r--r--src/network/bearer/qbearerplugin.cpp2
-rw-r--r--src/network/bearer/qbearerplugin_p.h2
-rw-r--r--src/network/bearer/qnetworkconfigmanager.cpp2
-rw-r--r--src/network/bearer/qnetworkconfigmanager.h2
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.cpp2
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.h2
-rw-r--r--src/network/bearer/qnetworkconfiguration.cpp2
-rw-r--r--src/network/bearer/qnetworkconfiguration.h2
-rw-r--r--src/network/bearer/qnetworkconfiguration_p.h2
-rw-r--r--src/network/bearer/qnetworksession.cpp2
-rw-r--r--src/network/bearer/qnetworksession.h2
-rw-r--r--src/network/bearer/qnetworksession_p.h2
-rw-r--r--src/network/bearer/qsharednetworksession.cpp2
-rw-r--r--src/network/bearer/qsharednetworksession_p.h2
-rw-r--r--src/network/kernel/qauthenticator.cpp26
-rw-r--r--src/network/kernel/qauthenticator.h2
-rw-r--r--src/network/kernel/qauthenticator_p.h3
-rw-r--r--src/network/kernel/qhostaddress.cpp2
-rw-r--r--src/network/kernel/qhostaddress.h2
-rw-r--r--src/network/kernel/qhostaddress_p.h2
-rw-r--r--src/network/kernel/qhostinfo.cpp4
-rw-r--r--src/network/kernel/qhostinfo.h2
-rw-r--r--src/network/kernel/qhostinfo_p.h4
-rw-r--r--src/network/kernel/qhostinfo_unix.cpp6
-rw-r--r--src/network/kernel/qhostinfo_win.cpp2
-rw-r--r--src/network/kernel/qnetworkinterface.cpp2
-rw-r--r--src/network/kernel/qnetworkinterface.h2
-rw-r--r--src/network/kernel/qnetworkinterface_p.h2
-rw-r--r--src/network/kernel/qnetworkinterface_unix.cpp2
-rw-r--r--src/network/kernel/qnetworkinterface_win.cpp26
-rw-r--r--src/network/kernel/qnetworkinterface_win_p.h2
-rw-r--r--src/network/kernel/qnetworkproxy.cpp9
-rw-r--r--src/network/kernel/qnetworkproxy.h2
-rw-r--r--src/network/kernel/qnetworkproxy_generic.cpp2
-rw-r--r--src/network/kernel/qnetworkproxy_mac.cpp2
-rw-r--r--src/network/kernel/qnetworkproxy_win.cpp2
-rw-r--r--src/network/kernel/qurlinfo.cpp2
-rw-r--r--src/network/kernel/qurlinfo.h2
-rw-r--r--src/network/socket/qabstractsocket.cpp96
-rw-r--r--src/network/socket/qabstractsocket.h21
-rw-r--r--src/network/socket/qabstractsocket_p.h4
-rw-r--r--src/network/socket/qabstractsocketengine.cpp4
-rw-r--r--src/network/socket/qabstractsocketengine_p.h13
-rw-r--r--src/network/socket/qhttpsocketengine.cpp30
-rw-r--r--src/network/socket/qhttpsocketengine_p.h9
-rw-r--r--src/network/socket/qlocalserver.cpp2
-rw-r--r--src/network/socket/qlocalserver.h2
-rw-r--r--src/network/socket/qlocalserver_p.h2
-rw-r--r--src/network/socket/qlocalserver_tcp.cpp2
-rw-r--r--src/network/socket/qlocalserver_unix.cpp2
-rw-r--r--src/network/socket/qlocalserver_win.cpp2
-rw-r--r--src/network/socket/qlocalsocket.cpp8
-rw-r--r--src/network/socket/qlocalsocket.h12
-rw-r--r--src/network/socket/qlocalsocket_p.h21
-rw-r--r--src/network/socket/qlocalsocket_tcp.cpp9
-rw-r--r--src/network/socket/qlocalsocket_unix.cpp16
-rw-r--r--src/network/socket/qlocalsocket_win.cpp341
-rw-r--r--src/network/socket/qnativesocketengine.cpp8
-rw-r--r--src/network/socket/qnativesocketengine_p.h8
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp14
-rw-r--r--src/network/socket/qnativesocketengine_win.cpp12
-rw-r--r--src/network/socket/qnet_unix_p.h2
-rw-r--r--src/network/socket/qsocks5socketengine.cpp22
-rw-r--r--src/network/socket/qsocks5socketengine_p.h10
-rw-r--r--src/network/socket/qtcpserver.cpp8
-rw-r--r--src/network/socket/qtcpserver.h8
-rw-r--r--src/network/socket/qtcpsocket.cpp4
-rw-r--r--src/network/socket/qtcpsocket.h2
-rw-r--r--src/network/socket/qtcpsocket_p.h2
-rw-r--r--src/network/socket/qudpsocket.cpp2
-rw-r--r--src/network/socket/qudpsocket.h2
-rw-r--r--src/network/ssl/qssl.cpp2
-rw-r--r--src/network/ssl/qssl.h2
-rw-r--r--src/network/ssl/qsslcertificate.cpp4
-rw-r--r--src/network/ssl/qsslcertificate.h6
-rw-r--r--src/network/ssl/qsslcertificate_p.h2
-rw-r--r--src/network/ssl/qsslcertificateextension.h4
-rw-r--r--src/network/ssl/qsslcipher.cpp2
-rw-r--r--src/network/ssl/qsslcipher.h6
-rw-r--r--src/network/ssl/qsslcipher_p.h2
-rw-r--r--src/network/ssl/qsslconfiguration.cpp2
-rw-r--r--src/network/ssl/qsslconfiguration.h6
-rw-r--r--src/network/ssl/qsslconfiguration_p.h2
-rw-r--r--src/network/ssl/qsslerror.cpp2
-rw-r--r--src/network/ssl/qsslerror.h6
-rw-r--r--src/network/ssl/qsslkey.cpp2
-rw-r--r--src/network/ssl/qsslkey.h6
-rw-r--r--src/network/ssl/qsslkey_p.h2
-rw-r--r--src/network/ssl/qsslsocket.cpp14
-rw-r--r--src/network/ssl/qsslsocket.h18
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp42
-rw-r--r--src/network/ssl/qsslsocket_openssl_p.h4
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp6
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols_p.h10
-rw-r--r--src/network/ssl/qsslsocket_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp2
-rw-r--r--src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qglcustomshaderstage.cpp2
-rw-r--r--src/opengl/gl2paintengineex/qglcustomshaderstage_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager.cpp8
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadersource_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qglgradientcache.cpp2
-rw-r--r--src/opengl/gl2paintengineex/qglgradientcache_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qglshadercache_meego_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qglshadercache_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp20
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp2
-rw-r--r--src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qtriangulatingstroker.cpp2
-rw-r--r--src/opengl/gl2paintengineex/qtriangulatingstroker_p.h2
-rw-r--r--src/opengl/qgl.cpp4
-rw-r--r--src/opengl/qgl.h4
-rw-r--r--src/opengl/qgl_p.h2
-rw-r--r--src/opengl/qgl_qpa.cpp6
-rw-r--r--src/opengl/qglbuffer.cpp2
-rw-r--r--src/opengl/qglbuffer.h2
-rw-r--r--src/opengl/qglcolormap.cpp2
-rw-r--r--src/opengl/qglcolormap.h2
-rw-r--r--src/opengl/qglextensions.cpp8
-rw-r--r--src/opengl/qglextensions_p.h2
-rw-r--r--src/opengl/qglframebufferobject.cpp2
-rw-r--r--src/opengl/qglframebufferobject.h2
-rw-r--r--src/opengl/qglframebufferobject_p.h2
-rw-r--r--src/opengl/qglfunctions.cpp2
-rw-r--r--src/opengl/qglfunctions.h2
-rw-r--r--src/opengl/qglpaintdevice.cpp2
-rw-r--r--src/opengl/qglpaintdevice_p.h2
-rw-r--r--src/opengl/qglpixelbuffer.cpp2
-rw-r--r--src/opengl/qglpixelbuffer.h2
-rw-r--r--src/opengl/qglpixelbuffer_p.h2
-rw-r--r--src/opengl/qglpixelbuffer_stub.cpp2
-rw-r--r--src/opengl/qglshaderprogram.cpp2
-rw-r--r--src/opengl/qglshaderprogram.h2
-rw-r--r--src/opengl/qgraphicsshadereffect.cpp2
-rw-r--r--src/opengl/qgraphicsshadereffect_p.h2
-rw-r--r--src/platformsupport/cglconvenience/cglconvenience.mm2
-rw-r--r--src/platformsupport/cglconvenience/cglconvenience_p.h2
-rw-r--r--src/platformsupport/dnd/qsimpledrag.cpp2
-rw-r--r--src/platformsupport/dnd/qsimpledrag_p.h2
-rw-r--r--src/platformsupport/eglconvenience/qeglconvenience.cpp2
-rw-r--r--src/platformsupport/eglconvenience/qeglconvenience_p.h2
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext.cpp2
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext_p.h2
-rw-r--r--src/platformsupport/eglconvenience/qxlibeglintegration.cpp2
-rw-r--r--src/platformsupport/eglconvenience/qxlibeglintegration_p.h2
-rw-r--r--src/platformsupport/eventdispatchers/eventdispatchers.pri4
-rw-r--r--src/platformsupport/eventdispatchers/qeventdispatcher_glib.cpp2
-rw-r--r--src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h2
-rw-r--r--src/platformsupport/eventdispatchers/qgenericunixeventdispatcher.cpp6
-rw-r--r--src/platformsupport/eventdispatchers/qgenericunixeventdispatcher_p.h2
-rw-r--r--src/platformsupport/eventdispatchers/qunixeventdispatcher_qpa.cpp (renamed from src/platformsupport/eventdispatchers/qeventdispatcher_qpa.cpp)14
-rw-r--r--src/platformsupport/eventdispatchers/qunixeventdispatcher_qpa_p.h (renamed from src/platformsupport/eventdispatchers/qeventdispatcher_qpa_p.h)18
-rw-r--r--src/platformsupport/fb_base/fb_base.cpp2
-rw-r--r--src/platformsupport/fb_base/fb_base_p.h2
-rw-r--r--src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp2
-rw-r--r--src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h2
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp4
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h2
-rw-r--r--src/platformsupport/fontdatabases/genericunix/qgenericunixfontdatabase_p.h2
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm6
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h2
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm2
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h2
-rw-r--r--src/platformsupport/glxconvenience/glxconvenience.pri3
-rw-r--r--src/platformsupport/glxconvenience/qglxconvenience.cpp2
-rw-r--r--src/platformsupport/glxconvenience/qglxconvenience_p.h2
-rw-r--r--src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp2
-rw-r--r--src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa_p.h2
-rw-r--r--src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa.cpp2
-rw-r--r--src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa_p.h2
-rw-r--r--src/platformsupport/printersupport/genericunix/qgenericunixprintersupport.cpp2
-rw-r--r--src/platformsupport/printersupport/genericunix/qgenericunixprintersupport_p.h2
-rw-r--r--src/plugins/accessible/widgets/complexwidgets.cpp1574
-rw-r--r--src/plugins/accessible/widgets/complexwidgets.h138
-rw-r--r--src/plugins/accessible/widgets/itemviews.cpp197
-rw-r--r--src/plugins/accessible/widgets/itemviews.h33
-rw-r--r--src/plugins/accessible/widgets/main.cpp2
-rw-r--r--src/plugins/accessible/widgets/qaccessiblemenu.cpp120
-rw-r--r--src/plugins/accessible/widgets/qaccessiblemenu.h15
-rw-r--r--src/plugins/accessible/widgets/qaccessiblewidgets.cpp448
-rw-r--r--src/plugins/accessible/widgets/qaccessiblewidgets.h49
-rw-r--r--src/plugins/accessible/widgets/rangecontrols.cpp14
-rw-r--r--src/plugins/accessible/widgets/rangecontrols.h14
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.cpp87
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.h37
-rw-r--r--src/plugins/bearer/bearer.pro10
-rw-r--r--src/plugins/bearer/connman/main.cpp2
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp2
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.h2
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp2
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux_p.h2
-rw-r--r--src/plugins/bearer/connman/qofonoservice_linux.cpp2
-rw-r--r--src/plugins/bearer/connman/qofonoservice_linux_p.h2
-rw-r--r--src/plugins/bearer/corewlan/main.cpp2
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.h2
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm2
-rw-r--r--src/plugins/bearer/generic/main.cpp2
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp2
-rw-r--r--src/plugins/bearer/generic/qgenericengine.h2
-rw-r--r--src/plugins/bearer/icd/dbusdispatcher.cpp634
-rw-r--r--src/plugins/bearer/icd/dbusdispatcher.h111
-rw-r--r--src/plugins/bearer/icd/iapconf.cpp245
-rw-r--r--src/plugins/bearer/icd/iapconf.h74
-rw-r--r--src/plugins/bearer/icd/iapmonitor.cpp134
-rw-r--r--src/plugins/bearer/icd/icd.pro33
-rw-r--r--src/plugins/bearer/icd/maemo_icd.cpp855
-rw-r--r--src/plugins/bearer/icd/maemo_icd.h174
-rw-r--r--src/plugins/bearer/icd/proxyconf.cpp422
-rw-r--r--src/plugins/bearer/icd/proxyconf.h74
-rw-r--r--src/plugins/bearer/icd/qicdengine.cpp1126
-rw-r--r--src/plugins/bearer/icd/qicdengine.h177
-rw-r--r--src/plugins/bearer/icd/qnetworksession_impl.cpp1072
-rw-r--r--src/plugins/bearer/icd/qnetworksession_impl.h229
-rw-r--r--src/plugins/bearer/icd/wlan-utils.h110
-rw-r--r--src/plugins/bearer/nativewifi/main.cpp2
-rw-r--r--src/plugins/bearer/nativewifi/platformdefs.h2
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.cpp2
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.h2
-rw-r--r--src/plugins/bearer/networkmanager/main.cpp2
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp2
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.h2
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp2
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.h2
-rw-r--r--src/plugins/bearer/networkmanager/qnmdbushelper.cpp2
-rw-r--r--src/plugins/bearer/networkmanager/qnmdbushelper.h2
-rw-r--r--src/plugins/bearer/nla/main.cpp2
-rw-r--r--src/plugins/bearer/nla/qnlaengine.cpp2
-rw-r--r--src/plugins/bearer/nla/qnlaengine.h2
-rw-r--r--src/plugins/bearer/platformdefs_win.h2
-rw-r--r--src/plugins/bearer/qbearerengine_impl.h2
-rw-r--r--src/plugins/bearer/qnetworksession_impl.cpp2
-rw-r--r--src/plugins/bearer/qnetworksession_impl.h2
-rw-r--r--src/plugins/codecs/cn/cn.pro2
-rw-r--r--src/plugins/codecs/cn/main.cpp2
-rw-r--r--src/plugins/codecs/cn/qgb18030codec.cpp2
-rw-r--r--src/plugins/codecs/cn/qgb18030codec.h2
-rw-r--r--src/plugins/codecs/jp/jp.pro2
-rw-r--r--src/plugins/codecs/jp/main.cpp2
-rw-r--r--src/plugins/codecs/jp/qeucjpcodec.cpp2
-rw-r--r--src/plugins/codecs/jp/qeucjpcodec.h2
-rw-r--r--src/plugins/codecs/jp/qfontjpcodec.cpp2
-rw-r--r--src/plugins/codecs/jp/qfontjpcodec.h2
-rw-r--r--src/plugins/codecs/jp/qjiscodec.cpp2
-rw-r--r--src/plugins/codecs/jp/qjiscodec.h2
-rw-r--r--src/plugins/codecs/jp/qjpunicode.cpp2
-rw-r--r--src/plugins/codecs/jp/qjpunicode.h2
-rw-r--r--src/plugins/codecs/jp/qsjiscodec.cpp2
-rw-r--r--src/plugins/codecs/jp/qsjiscodec.h2
-rw-r--r--src/plugins/codecs/kr/cp949codetbl.h7
-rw-r--r--src/plugins/codecs/kr/kr.pro2
-rw-r--r--src/plugins/codecs/kr/main.cpp2
-rw-r--r--src/plugins/codecs/kr/qeuckrcodec.cpp2
-rw-r--r--src/plugins/codecs/kr/qeuckrcodec.h2
-rw-r--r--src/plugins/codecs/tw/main.cpp2
-rw-r--r--src/plugins/codecs/tw/qbig5codec.cpp2
-rw-r--r--src/plugins/codecs/tw/qbig5codec.h2
-rw-r--r--src/plugins/codecs/tw/tw.pro2
-rw-r--r--src/plugins/generic/linuxinput/main.cpp2
-rw-r--r--src/plugins/generic/linuxinput/qlinuxinput.cpp2
-rw-r--r--src/plugins/generic/linuxinput/qlinuxinput.h2
-rw-r--r--src/plugins/generic/touchscreen/README32
-rw-r--r--src/plugins/generic/touchscreen/main.cpp2
-rw-r--r--src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp55
-rw-r--r--src/plugins/generic/touchscreen/qtoucheventsenderqpa.h10
-rw-r--r--src/plugins/generic/touchscreen/qtouchscreen.cpp256
-rw-r--r--src/plugins/generic/touchscreen/qtouchscreen.h7
-rw-r--r--src/plugins/generic/tslib/main.cpp2
-rw-r--r--src/plugins/generic/tslib/qtslib.cpp2
-rw-r--r--src/plugins/generic/tslib/qtslib.h2
-rw-r--r--src/plugins/imageformats/gif/main.cpp2
-rw-r--r--src/plugins/imageformats/ico/main.cpp2
-rw-r--r--src/plugins/imageformats/ico/qicohandler.cpp2
-rw-r--r--src/plugins/imageformats/ico/qicohandler.h2
-rw-r--r--src/plugins/imageformats/jpeg/main.cpp2
-rw-r--r--src/plugins/imageformats/mng/main.cpp2
-rw-r--r--src/plugins/imageformats/tiff/main.cpp2
-rw-r--r--src/plugins/platforminputcontexts/ibus/main.cpp2
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp2
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h2
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp4
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h2
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusproxy.cpp2
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusproxy.h2
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibustypes.cpp2
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibustypes.h2
-rw-r--r--src/plugins/platforminputcontexts/meego/contextadaptor.cpp2
-rw-r--r--src/plugins/platforminputcontexts/meego/contextadaptor.h2
-rw-r--r--src/plugins/platforminputcontexts/meego/main.cpp2
-rw-r--r--src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.cpp2
-rw-r--r--src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.h2
-rw-r--r--src/plugins/platforminputcontexts/meego/serverproxy.cpp2
-rw-r--r--src/plugins/platforminputcontexts/meego/serverproxy.h2
-rw-r--r--src/plugins/platforms/cocoa/cocoa.pro3
-rw-r--r--src/plugins/platforms/cocoa/main.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibility.h10
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibility.mm110
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm53
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplication.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplication.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaautoreleasepool.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaautoreleasepool.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoacursor.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoacursor.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.h73
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm240
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.h7
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm159
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm7
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.h10
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm17
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuloader.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuloader.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.mm9
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h30
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm61
-rw-r--r--src/plugins/platforms/cocoa/qmenu_mac.h2
-rw-r--r--src/plugins/platforms/cocoa/qmenu_mac.mm2
-rw-r--r--src/plugins/platforms/cocoa/qmultitouch_mac.mm3
-rw-r--r--src/plugins/platforms/cocoa/qmultitouch_mac_p.h2
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h9
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm92
-rw-r--r--src/plugins/platforms/cocoa/qnsviewaccessibility.mm39
-rw-r--r--src/plugins/platforms/cocoa/qnswindowdelegate.h2
-rw-r--r--src/plugins/platforms/cocoa/qnswindowdelegate.mm2
-rw-r--r--src/plugins/platforms/directfb/main.cpp2
-rw-r--r--src/plugins/platforms/directfb/qdirectfb_egl.cpp2
-rw-r--r--src/plugins/platforms/directfb/qdirectfb_egl.h2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbbackingstore.cpp2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbbackingstore.h2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbblitter.cpp2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbblitter.h2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbconvenience.cpp2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbconvenience.h2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbcursor.cpp2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbcursor.h2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbglcontext.cpp2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbglcontext.h2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbinput.cpp2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbinput.h2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbintegration.cpp2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbintegration.h2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbscreen.cpp2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbscreen.h2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbwindow.cpp4
-rw-r--r--src/plugins/platforms/directfb/qdirectfbwindow.h2
-rw-r--r--src/plugins/platforms/eglfs/main.cpp2
-rw-r--r--src/plugins/platforms/eglfs/qeglfsbackingstore.cpp10
-rw-r--r--src/plugins/platforms/eglfs/qeglfsbackingstore.h2
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp12
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.h4
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.cpp2
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.h2
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.cpp2
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.h2
-rw-r--r--src/plugins/platforms/kms/main.cpp2
-rw-r--r--src/plugins/platforms/kms/qkmsbackingstore.cpp2
-rw-r--r--src/plugins/platforms/kms/qkmsbackingstore.h2
-rw-r--r--src/plugins/platforms/kms/qkmsbuffermanager.cpp2
-rw-r--r--src/plugins/platforms/kms/qkmsbuffermanager.h2
-rw-r--r--src/plugins/platforms/kms/qkmscontext.cpp2
-rw-r--r--src/plugins/platforms/kms/qkmscontext.h2
-rw-r--r--src/plugins/platforms/kms/qkmscursor.cpp2
-rw-r--r--src/plugins/platforms/kms/qkmscursor.h2
-rw-r--r--src/plugins/platforms/kms/qkmsdevice.cpp2
-rw-r--r--src/plugins/platforms/kms/qkmsdevice.h2
-rw-r--r--src/plugins/platforms/kms/qkmsintegration.cpp2
-rw-r--r--src/plugins/platforms/kms/qkmsintegration.h2
-rw-r--r--src/plugins/platforms/kms/qkmsscreen.cpp2
-rw-r--r--src/plugins/platforms/kms/qkmsscreen.h2
-rw-r--r--src/plugins/platforms/kms/qkmswindow.cpp2
-rw-r--r--src/plugins/platforms/kms/qkmswindow.h2
-rw-r--r--src/plugins/platforms/linuxfb/main.cpp2
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp2
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbintegration.h2
-rw-r--r--src/plugins/platforms/minimal/main.cpp2
-rw-r--r--src/plugins/platforms/minimal/qminimalbackingstore.cpp2
-rw-r--r--src/plugins/platforms/minimal/qminimalbackingstore.h2
-rw-r--r--src/plugins/platforms/minimal/qminimalintegration.cpp2
-rw-r--r--src/plugins/platforms/minimal/qminimalintegration.h2
-rw-r--r--src/plugins/platforms/openkode/main.cpp2
-rw-r--r--src/plugins/platforms/openkode/openkodekeytranslator.h2
-rw-r--r--src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp2
-rw-r--r--src/plugins/platforms/openkode/qopenkodeeventloopintegration.h2
-rw-r--r--src/plugins/platforms/openkode/qopenkodeintegration.cpp2
-rw-r--r--src/plugins/platforms/openkode/qopenkodeintegration.h2
-rw-r--r--src/plugins/platforms/openkode/qopenkodewindow.cpp2
-rw-r--r--src/plugins/platforms/openkode/qopenkodewindow.h2
-rw-r--r--src/plugins/platforms/openkode/shaders/frag.glslf2
-rw-r--r--src/plugins/platforms/openkode/shaders/vert.glslv2
-rw-r--r--src/plugins/platforms/openvglite/main.cpp2
-rw-r--r--src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp2
-rw-r--r--src/plugins/platforms/openvglite/qgraphicssystem_vglite.h2
-rw-r--r--src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp2
-rw-r--r--src/plugins/platforms/openvglite/qwindowsurface_vglite.h2
-rw-r--r--src/plugins/platforms/openwfd/main.cpp2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdbackingstore.cpp2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdbackingstore.h2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfddevice.cpp2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfddevice.h2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdevent.cpp2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdevent.h2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdglcontext.cpp2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdglcontext.h2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdintegration.cpp2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdintegration.h2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdnativeinterface.cpp2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdnativeinterface.h2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdoutputbuffer.h2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdport.cpp2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdport.h2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdportmode.cpp2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdportmode.h2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdscreen.cpp2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdscreen.h2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdwindow.cpp2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdwindow.h2
-rw-r--r--src/plugins/platforms/qvfb/main.cpp2
-rw-r--r--src/plugins/platforms/qvfb/qvfbintegration.cpp2
-rw-r--r--src/plugins/platforms/qvfb/qvfbintegration.h2
-rw-r--r--src/plugins/platforms/qvfb/qvfbwindowsurface.cpp2
-rw-r--r--src/plugins/platforms/qvfb/qvfbwindowsurface.h2
-rw-r--r--src/plugins/platforms/uikit/examples/qmltest/main.mm2
-rw-r--r--src/plugins/platforms/uikit/examples/qmltest/qml/main.qml2
-rw-r--r--src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp2
-rw-r--r--src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp2
-rw-r--r--src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h2
-rw-r--r--src/plugins/platforms/uikit/main.mm2
-rw-r--r--src/plugins/platforms/uikit/quikiteventloop.h2
-rw-r--r--src/plugins/platforms/uikit/quikiteventloop.mm2
-rw-r--r--src/plugins/platforms/uikit/quikitintegration.h2
-rw-r--r--src/plugins/platforms/uikit/quikitintegration.mm2
-rw-r--r--src/plugins/platforms/uikit/quikitscreen.h2
-rw-r--r--src/plugins/platforms/uikit/quikitscreen.mm2
-rw-r--r--src/plugins/platforms/uikit/quikitsoftwareinputhandler.h2
-rw-r--r--src/plugins/platforms/uikit/quikitwindow.h2
-rw-r--r--src/plugins/platforms/uikit/quikitwindow.mm2
-rw-r--r--src/plugins/platforms/uikit/quikitwindowsurface.h2
-rw-r--r--src/plugins/platforms/uikit/quikitwindowsurface.mm2
-rw-r--r--src/plugins/platforms/vnc/main.cpp2
-rw-r--r--src/plugins/platforms/vnc/qvnccursor.cpp2
-rw-r--r--src/plugins/platforms/vnc/qvnccursor.h2
-rw-r--r--src/plugins/platforms/vnc/qvncintegration.cpp2
-rw-r--r--src/plugins/platforms/vnc/qvncintegration.h2
-rw-r--r--src/plugins/platforms/vnc/qvncserver.cpp2
-rw-r--r--src/plugins/platforms/vnc/qvncserver.h2
-rw-r--r--src/plugins/platforms/windows/array.h2
-rw-r--r--src/plugins/platforms/windows/main.cpp2
-rw-r--r--src/plugins/platforms/windows/qtwindows_additional.h2
-rw-r--r--src/plugins/platforms/windows/qtwindowsglobal.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsaccessibility.cpp423
-rw-r--r--src/plugins/platforms/windows/qwindowsaccessibility.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsbackingstore.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsbackingstore.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsclipboard.cpp7
-rw-r--r--src/plugins/platforms/windows/qwindowsclipboard.h2
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp15
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.h4
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp142
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.h9
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.cpp190
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.h9
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase_ft.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsguieventdispatcher.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsinputcontext.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsinputcontext.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp13
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsinternalmimedata.h2
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp10
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsnativeimage.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsnativeimage.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsole.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsole.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.h2
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp35
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.h3
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h2
-rw-r--r--src/plugins/platforms/xcb/main.cpp2
-rw-r--r--src/plugins/platforms/xcb/qdri2context.cpp2
-rw-r--r--src/plugins/platforms/xcb/qdri2context.h2
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.cpp2
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp58
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.cpp22
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp50
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h19
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_maemo.cpp5
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbeglsurface.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbimage.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbimage.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp85
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.h3
-rw-r--r--src/plugins/platforms/xcb/qxcbmime.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbmime.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbobject.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbwmsupport.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbwmsupport.h2
-rw-r--r--src/plugins/platforms/xlib/main.cpp2
-rw-r--r--src/plugins/platforms/xlib/qglxintegration.cpp2
-rw-r--r--src/plugins/platforms/xlib/qglxintegration.h2
-rw-r--r--src/plugins/platforms/xlib/qxlibbackingstore.cpp2
-rw-r--r--src/plugins/platforms/xlib/qxlibbackingstore.h2
-rw-r--r--src/plugins/platforms/xlib/qxlibclipboard.cpp2
-rw-r--r--src/plugins/platforms/xlib/qxlibclipboard.h2
-rw-r--r--src/plugins/platforms/xlib/qxlibcursor.cpp2
-rw-r--r--src/plugins/platforms/xlib/qxlibcursor.h2
-rw-r--r--src/plugins/platforms/xlib/qxlibdisplay.cpp2
-rw-r--r--src/plugins/platforms/xlib/qxlibdisplay.h2
-rw-r--r--src/plugins/platforms/xlib/qxlibintegration.cpp2
-rw-r--r--src/plugins/platforms/xlib/qxlibintegration.h2
-rw-r--r--src/plugins/platforms/xlib/qxlibkeyboard.cpp2
-rw-r--r--src/plugins/platforms/xlib/qxlibkeyboard.h2
-rw-r--r--src/plugins/platforms/xlib/qxlibmime.cpp2
-rw-r--r--src/plugins/platforms/xlib/qxlibmime.h2
-rw-r--r--src/plugins/platforms/xlib/qxlibnativeinterface.cpp2
-rw-r--r--src/plugins/platforms/xlib/qxlibnativeinterface.h2
-rw-r--r--src/plugins/platforms/xlib/qxlibscreen.cpp2
-rw-r--r--src/plugins/platforms/xlib/qxlibscreen.h2
-rw-r--r--src/plugins/platforms/xlib/qxlibstatic.cpp2
-rw-r--r--src/plugins/platforms/xlib/qxlibstatic.h2
-rw-r--r--src/plugins/platforms/xlib/qxlibwindow.cpp7
-rw-r--r--src/plugins/platforms/xlib/qxlibwindow.h4
-rw-r--r--src/plugins/plugins.pro4
-rw-r--r--src/plugins/printsupport/windows/main.cpp2
-rw-r--r--src/plugins/printsupport/windows/qwindowsprinterinfo.cpp2
-rw-r--r--src/plugins/printsupport/windows/qwindowsprintersupport.cpp2
-rw-r--r--src/plugins/printsupport/windows/qwindowsprintersupport.h2
-rw-r--r--src/plugins/sqldrivers/db2/main.cpp2
-rw-r--r--src/plugins/sqldrivers/ibase/main.cpp2
-rw-r--r--src/plugins/sqldrivers/mysql/main.cpp2
-rw-r--r--src/plugins/sqldrivers/oci/main.cpp2
-rw-r--r--src/plugins/sqldrivers/odbc/main.cpp2
-rw-r--r--src/plugins/sqldrivers/psql/main.cpp2
-rw-r--r--src/plugins/sqldrivers/sqlite/smain.cpp2
-rw-r--r--src/plugins/sqldrivers/sqlite2/smain.cpp2
-rw-r--r--src/plugins/sqldrivers/tds/main.cpp2
-rw-r--r--src/printsupport/dialogs/qabstractpagesetupdialog.cpp2
-rw-r--r--src/printsupport/dialogs/qabstractpagesetupdialog.h2
-rw-r--r--src/printsupport/dialogs/qabstractpagesetupdialog_p.h2
-rw-r--r--src/printsupport/dialogs/qabstractprintdialog.cpp2
-rw-r--r--src/printsupport/dialogs/qabstractprintdialog.h2
-rw-r--r--src/printsupport/dialogs/qabstractprintdialog_p.h2
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog.cpp2
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog.h2
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog_mac.mm2
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog_unix.cpp2
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog_unix_p.h2
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog_win.cpp2
-rw-r--r--src/printsupport/dialogs/qprintdialog.h2
-rw-r--r--src/printsupport/dialogs/qprintdialog.qdoc2
-rw-r--r--src/printsupport/dialogs/qprintdialog_mac.mm2
-rw-r--r--src/printsupport/dialogs/qprintdialog_unix.cpp2
-rw-r--r--src/printsupport/dialogs/qprintdialog_win.cpp2
-rw-r--r--src/printsupport/dialogs/qprintpreviewdialog.cpp2
-rw-r--r--src/printsupport/dialogs/qprintpreviewdialog.h2
-rw-r--r--src/printsupport/kernel/qcups.cpp2
-rw-r--r--src/printsupport/kernel/qcups_p.h2
-rw-r--r--src/printsupport/kernel/qpaintengine_alpha.cpp21
-rw-r--r--src/printsupport/kernel/qpaintengine_alpha_p.h3
-rw-r--r--src/printsupport/kernel/qpaintengine_preview.cpp2
-rw-r--r--src/printsupport/kernel/qpaintengine_preview_p.h2
-rw-r--r--src/printsupport/kernel/qplatformprintersupport_qpa.cpp2
-rw-r--r--src/printsupport/kernel/qplatformprintersupport_qpa.h2
-rw-r--r--src/printsupport/kernel/qplatformprintplugin.cpp2
-rw-r--r--src/printsupport/kernel/qplatformprintplugin_qpa.h2
-rw-r--r--src/printsupport/kernel/qprintengine.h2
-rw-r--r--src/printsupport/kernel/qprintengine_pdf.cpp4
-rw-r--r--src/printsupport/kernel/qprintengine_pdf_p.h2
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp2
-rw-r--r--src/printsupport/kernel/qprintengine_win_p.h2
-rw-r--r--src/printsupport/kernel/qprinter.cpp2
-rw-r--r--src/printsupport/kernel/qprinter.h2
-rw-r--r--src/printsupport/kernel/qprinter_p.h2
-rw-r--r--src/printsupport/kernel/qprinterinfo.cpp2
-rw-r--r--src/printsupport/kernel/qprinterinfo.h2
-rw-r--r--src/printsupport/kernel/qprinterinfo_p.h2
-rw-r--r--src/printsupport/kernel/qprinterinfo_unix.cpp2
-rw-r--r--src/printsupport/kernel/qprinterinfo_unix_p.h2
-rw-r--r--src/printsupport/widgets/qprintpreviewwidget.cpp2
-rw-r--r--src/printsupport/widgets/qprintpreviewwidget.h2
-rw-r--r--src/sql/drivers/db2/qsql_db2.cpp2
-rw-r--r--src/sql/drivers/db2/qsql_db2.h2
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.cpp2
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.h2
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp2
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.h2
-rw-r--r--src/sql/drivers/oci/qsql_oci.cpp2
-rw-r--r--src/sql/drivers/oci/qsql_oci.h2
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp6
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.h2
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp2
-rw-r--r--src/sql/drivers/psql/qsql_psql.h2
-rw-r--r--src/sql/drivers/sqlite/qsql_sqlite.cpp6
-rw-r--r--src/sql/drivers/sqlite/qsql_sqlite.h2
-rw-r--r--src/sql/drivers/sqlite2/qsql_sqlite2.cpp2
-rw-r--r--src/sql/drivers/sqlite2/qsql_sqlite2.h2
-rw-r--r--src/sql/drivers/tds/qsql_tds.cpp2
-rw-r--r--src/sql/drivers/tds/qsql_tds.h2
-rw-r--r--src/sql/kernel/qsql.h2
-rw-r--r--src/sql/kernel/qsql.qdoc2
-rw-r--r--src/sql/kernel/qsqlcachedresult.cpp2
-rw-r--r--src/sql/kernel/qsqlcachedresult_p.h2
-rw-r--r--src/sql/kernel/qsqldatabase.cpp2
-rw-r--r--src/sql/kernel/qsqldatabase.h2
-rw-r--r--src/sql/kernel/qsqldriver.cpp2
-rw-r--r--src/sql/kernel/qsqldriver.h2
-rw-r--r--src/sql/kernel/qsqldriverplugin.cpp2
-rw-r--r--src/sql/kernel/qsqldriverplugin.h2
-rw-r--r--src/sql/kernel/qsqlerror.cpp2
-rw-r--r--src/sql/kernel/qsqlerror.h2
-rw-r--r--src/sql/kernel/qsqlfield.cpp2
-rw-r--r--src/sql/kernel/qsqlfield.h2
-rw-r--r--src/sql/kernel/qsqlindex.cpp2
-rw-r--r--src/sql/kernel/qsqlindex.h2
-rw-r--r--src/sql/kernel/qsqlnulldriver_p.h2
-rw-r--r--src/sql/kernel/qsqlquery.cpp2
-rw-r--r--src/sql/kernel/qsqlquery.h2
-rw-r--r--src/sql/kernel/qsqlrecord.cpp2
-rw-r--r--src/sql/kernel/qsqlrecord.h2
-rw-r--r--src/sql/kernel/qsqlresult.cpp9
-rw-r--r--src/sql/kernel/qsqlresult.h2
-rw-r--r--src/sql/models/qsqlquerymodel.cpp2
-rw-r--r--src/sql/models/qsqlquerymodel.h2
-rw-r--r--src/sql/models/qsqlquerymodel_p.h2
-rw-r--r--src/sql/models/qsqlrelationaldelegate.cpp2
-rw-r--r--src/sql/models/qsqlrelationaldelegate.h2
-rw-r--r--src/sql/models/qsqlrelationaltablemodel.cpp6
-rw-r--r--src/sql/models/qsqlrelationaltablemodel.h2
-rw-r--r--src/sql/models/qsqltablemodel.cpp2
-rw-r--r--src/sql/models/qsqltablemodel.h2
-rw-r--r--src/sql/models/qsqltablemodel_p.h2
-rw-r--r--src/src.pro4
-rw-r--r--src/testlib/qabstracttestlogger.cpp23
-rw-r--r--src/testlib/qabstracttestlogger_p.h3
-rw-r--r--src/testlib/qasciikey.cpp2
-rw-r--r--src/testlib/qbenchmark.cpp10
-rw-r--r--src/testlib/qbenchmark.h2
-rw-r--r--src/testlib/qbenchmark_p.h2
-rw-r--r--src/testlib/qbenchmarkevent.cpp2
-rw-r--r--src/testlib/qbenchmarkevent_p.h2
-rw-r--r--src/testlib/qbenchmarkmeasurement.cpp2
-rw-r--r--src/testlib/qbenchmarkmeasurement_p.h4
-rw-r--r--src/testlib/qbenchmarkmetric.cpp2
-rw-r--r--src/testlib/qbenchmarkmetric.h2
-rw-r--r--src/testlib/qbenchmarkmetric_p.h2
-rw-r--r--src/testlib/qbenchmarkvalgrind.cpp2
-rw-r--r--src/testlib/qbenchmarkvalgrind_p.h2
-rw-r--r--src/testlib/qplaintestlogger.cpp58
-rw-r--r--src/testlib/qplaintestlogger_p.h2
-rw-r--r--src/testlib/qsignaldumper.cpp2
-rw-r--r--src/testlib/qsignaldumper_p.h2
-rw-r--r--src/testlib/qsignalspy.h4
-rw-r--r--src/testlib/qsignalspy.qdoc2
-rw-r--r--src/testlib/qtest.h27
-rw-r--r--src/testlib/qtest_global.h6
-rw-r--r--src/testlib/qtest_gui.h84
-rw-r--r--src/testlib/qtestaccessible.h2
-rw-r--r--src/testlib/qtestassert.h2
-rw-r--r--src/testlib/qtestcase.cpp214
-rw-r--r--src/testlib/qtestcase.h21
-rw-r--r--src/testlib/qtestcoreelement_p.h2
-rw-r--r--src/testlib/qtestcorelist_p.h2
-rw-r--r--src/testlib/qtestdata.cpp2
-rw-r--r--src/testlib/qtestdata.h2
-rw-r--r--src/testlib/qtestelement.cpp2
-rw-r--r--src/testlib/qtestelement_p.h2
-rw-r--r--src/testlib/qtestelementattribute.cpp2
-rw-r--r--src/testlib/qtestelementattribute_p.h2
-rw-r--r--src/testlib/qtestevent.h2
-rw-r--r--src/testlib/qtestevent.qdoc2
-rw-r--r--src/testlib/qtesteventloop.h2
-rw-r--r--src/testlib/qtestkeyboard.h11
-rw-r--r--src/testlib/qtestlog.cpp6
-rw-r--r--src/testlib/qtestlog_p.h5
-rw-r--r--src/testlib/qtestmouse.h9
-rw-r--r--src/testlib/qtestresult.cpp19
-rw-r--r--src/testlib/qtestresult_p.h3
-rw-r--r--src/testlib/qtestspontaneevent.h2
-rw-r--r--src/testlib/qtestsystem.h2
-rw-r--r--src/testlib/qtesttable.cpp14
-rw-r--r--src/testlib/qtesttable_p.h2
-rw-r--r--src/testlib/qtesttouch.h62
-rw-r--r--src/testlib/qtestxunitstreamer.cpp2
-rw-r--r--src/testlib/qtestxunitstreamer_p.h2
-rw-r--r--src/testlib/qxmltestlogger.cpp4
-rw-r--r--src/testlib/qxmltestlogger_p.h2
-rw-r--r--src/testlib/qxunittestlogger.cpp16
-rw-r--r--src/testlib/qxunittestlogger_p.h2
-rw-r--r--src/tools/bootstrap/bootstrap.pri1
-rw-r--r--src/tools/bootstrap/bootstrap.pro1
-rw-r--r--src/tools/mkv8snapshot/mkv8snapshot.pro38
-rw-r--r--src/tools/moc/generator.cpp15
-rw-r--r--src/tools/moc/generator.h2
-rw-r--r--src/tools/moc/keywords.cpp87
-rw-r--r--src/tools/moc/main.cpp2
-rw-r--r--src/tools/moc/moc.cpp4
-rw-r--r--src/tools/moc/moc.h2
-rw-r--r--src/tools/moc/mwerks_mac.cpp2
-rw-r--r--src/tools/moc/mwerks_mac.h2
-rw-r--r--src/tools/moc/outputrevision.h2
-rw-r--r--src/tools/moc/parser.cpp2
-rw-r--r--src/tools/moc/parser.h2
-rw-r--r--src/tools/moc/ppkeywords.cpp2
-rw-r--r--src/tools/moc/preprocessor.cpp2
-rw-r--r--src/tools/moc/preprocessor.h2
-rw-r--r--src/tools/moc/symbols.h2
-rw-r--r--src/tools/moc/token.cpp3
-rw-r--r--src/tools/moc/token.h3
-rwxr-xr-xsrc/tools/moc/util/generate.sh2
-rw-r--r--src/tools/moc/util/generate_keywords.cpp3
-rw-r--r--src/tools/moc/util/licenseheader.txt2
-rw-r--r--src/tools/moc/utils.h2
-rw-r--r--src/tools/rcc/main.cpp2
-rw-r--r--src/tools/rcc/rcc.cpp2
-rw-r--r--src/tools/rcc/rcc.h2
-rw-r--r--src/tools/tools.pro3
-rw-r--r--src/tools/uic/cpp/cppextractimages.cpp2
-rw-r--r--src/tools/uic/cpp/cppextractimages.h2
-rw-r--r--src/tools/uic/cpp/cppwritedeclaration.cpp2
-rw-r--r--src/tools/uic/cpp/cppwritedeclaration.h2
-rw-r--r--src/tools/uic/cpp/cppwriteicondata.cpp2
-rw-r--r--src/tools/uic/cpp/cppwriteicondata.h2
-rw-r--r--src/tools/uic/cpp/cppwriteicondeclaration.cpp2
-rw-r--r--src/tools/uic/cpp/cppwriteicondeclaration.h2
-rw-r--r--src/tools/uic/cpp/cppwriteiconinitialization.cpp2
-rw-r--r--src/tools/uic/cpp/cppwriteiconinitialization.h2
-rw-r--r--src/tools/uic/cpp/cppwriteincludes.cpp2
-rw-r--r--src/tools/uic/cpp/cppwriteincludes.h2
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp2
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.h2
-rw-r--r--src/tools/uic/customwidgetsinfo.cpp2
-rw-r--r--src/tools/uic/customwidgetsinfo.h2
-rw-r--r--src/tools/uic/databaseinfo.cpp2
-rw-r--r--src/tools/uic/databaseinfo.h2
-rw-r--r--src/tools/uic/driver.cpp2
-rw-r--r--src/tools/uic/driver.h2
-rw-r--r--src/tools/uic/globaldefs.h2
-rw-r--r--src/tools/uic/main.cpp2
-rw-r--r--src/tools/uic/option.h2
-rw-r--r--src/tools/uic/qclass_lib_map.h194
-rw-r--r--src/tools/uic/treewalker.cpp2
-rw-r--r--src/tools/uic/treewalker.h2
-rw-r--r--src/tools/uic/ui4.cpp2
-rw-r--r--src/tools/uic/ui4.h2
-rw-r--r--src/tools/uic/uic.cpp2
-rw-r--r--src/tools/uic/uic.h2
-rw-r--r--src/tools/uic/utils.h2
-rw-r--r--src/tools/uic/validator.cpp2
-rw-r--r--src/tools/uic/validator.h2
-rw-r--r--src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch336
-rw-r--r--src/v8/0002-Add-a-fallback-mode-for-named-property-interceptors.patch361
-rw-r--r--src/v8/0003-Generalize-external-object-resources.patch595
-rw-r--r--src/v8/0004-Introduce-a-QML-compilation-mode.patch2355
-rw-r--r--src/v8/0005-Allow-access-to-the-calling-script-data.patch48
-rw-r--r--src/v8/0006-Add-custom-object-compare-callback.patch548
-rw-r--r--src/v8/0007-Allow-a-script-to-be-flagged-as-native.patch46
-rw-r--r--src/v8/0008-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch64
-rw-r--r--src/v8/0009-Fix-deprecated-Python-code.patch51
-rw-r--r--src/v8/0010-Remove-execute-flag-from-v8-debug.h.patch15
-rw-r--r--src/v8/0011-Fix-warnings.patch46
-rw-r--r--src/v8/0012-Add-flag-to-avoid-breakpoint-relocation.patch147
-rw-r--r--src/v8/README1
-rw-r--r--src/v8/v8.pri304
-rw-r--r--src/v8/v8.pro41
-rw-r--r--src/v8/v8base.pri19
-rw-r--r--src/widgets/Qt5WidgetsConfigExtras.cmake.in2
-rw-r--r--src/widgets/Qt5WidgetsMacros.cmake40
-rw-r--r--src/widgets/accessible/qaccessiblewidget.cpp205
-rw-r--r--src/widgets/accessible/qaccessiblewidget.h3
-rw-r--r--src/widgets/animation/qguivariantanimation.cpp2
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp108
-rw-r--r--src/widgets/dialogs/qcolordialog.h2
-rw-r--r--src/widgets/dialogs/qcolordialog_mac.mm2
-rw-r--r--src/widgets/dialogs/qcolordialog_p.h10
-rw-r--r--src/widgets/dialogs/qdialog.cpp27
-rw-r--r--src/widgets/dialogs/qdialog.h4
-rw-r--r--src/widgets/dialogs/qdialog_p.h5
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp2
-rw-r--r--src/widgets/dialogs/qerrormessage.h2
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp258
-rw-r--r--src/widgets/dialogs/qfiledialog.h2
-rw-r--r--src/widgets/dialogs/qfiledialog.ui2
-rw-r--r--src/widgets/dialogs/qfiledialog_embedded.ui2
-rw-r--r--src/widgets/dialogs/qfiledialog_mac.mm2
-rw-r--r--src/widgets/dialogs/qfiledialog_p.h42
-rw-r--r--src/widgets/dialogs/qfileinfogatherer.cpp7
-rw-r--r--src/widgets/dialogs/qfileinfogatherer_p.h2
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp2
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.h2
-rw-r--r--src/widgets/dialogs/qfilesystemmodel_p.h2
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp22
-rw-r--r--src/widgets/dialogs/qfontdialog.h2
-rw-r--r--src/widgets/dialogs/qfontdialog_mac.mm2
-rw-r--r--src/widgets/dialogs/qfontdialog_p.h8
-rw-r--r--src/widgets/dialogs/qfscompleter_p.h2
-rw-r--r--src/widgets/dialogs/qinputdialog.cpp2
-rw-r--r--src/widgets/dialogs/qinputdialog.h2
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp8
-rw-r--r--src/widgets/dialogs/qmessagebox.h2
-rw-r--r--src/widgets/dialogs/qnspanelproxy_mac.mm2
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp2
-rw-r--r--src/widgets/dialogs/qprogressdialog.h2
-rw-r--r--src/widgets/dialogs/qsidebar.cpp4
-rw-r--r--src/widgets/dialogs/qsidebar_p.h4
-rw-r--r--src/widgets/dialogs/qwizard.cpp2
-rw-r--r--src/widgets/dialogs/qwizard.h2
-rw-r--r--src/widgets/dialogs/qwizard_win.cpp2
-rw-r--r--src/widgets/dialogs/qwizard_win_p.h2
-rw-r--r--src/widgets/effects/qgraphicseffect.cpp2
-rw-r--r--src/widgets/effects/qgraphicseffect.h2
-rw-r--r--src/widgets/effects/qgraphicseffect_p.h2
-rw-r--r--src/widgets/effects/qpixmapfilter.cpp2
-rw-r--r--src/widgets/effects/qpixmapfilter_p.h2
-rw-r--r--src/widgets/graphicsview/qgraph_p.h8
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayout.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayout.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsitem_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsitemanimation.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsitemanimation.h2
-rw-r--r--src/widgets/graphicsview/qgraphicslayout.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicslayout.h2
-rw-r--r--src/widgets/graphicsview/qgraphicslayout_p.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicslayout_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutitem.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutitem.h2
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutitem_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicslinearlayout.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicslinearlayout.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp14
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsscene_bsp.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsscene_bsp_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsscene_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h4
-rw-r--r--src/widgets/graphicsview/qgraphicssceneevent.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicssceneevent.h2
-rw-r--r--src/widgets/graphicsview/qgraphicssceneindex.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicssceneindex_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsscenelinearindex.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsscenelinearindex_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicstransform.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicstransform.h2
-rw-r--r--src/widgets/graphicsview/qgraphicstransform_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsview.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsview_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.h2
-rw-r--r--src/widgets/graphicsview/qgraphicswidget_p.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicswidget_p.h2
-rw-r--r--src/widgets/graphicsview/qgridlayoutengine.cpp2
-rw-r--r--src/widgets/graphicsview/qgridlayoutengine_p.h2
-rw-r--r--src/widgets/graphicsview/qsimplex_p.cpp2
-rw-r--r--src/widgets/graphicsview/qsimplex_p.h2
-rw-r--r--src/widgets/itemviews/itemviews.pri12
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.cpp3
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.h11
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp35
-rw-r--r--src/widgets/itemviews/qabstractitemview.h6
-rw-r--r--src/widgets/itemviews/qabstractitemview_p.h4
-rw-r--r--src/widgets/itemviews/qbsptree.cpp2
-rw-r--r--src/widgets/itemviews/qbsptree_p.h2
-rw-r--r--src/widgets/itemviews/qcolumnview.cpp2
-rw-r--r--src/widgets/itemviews/qcolumnview.h2
-rw-r--r--src/widgets/itemviews/qcolumnview_p.h2
-rw-r--r--src/widgets/itemviews/qcolumnviewgrip.cpp2
-rw-r--r--src/widgets/itemviews/qcolumnviewgrip_p.h2
-rw-r--r--src/widgets/itemviews/qdatawidgetmapper.cpp14
-rw-r--r--src/widgets/itemviews/qdatawidgetmapper.h4
-rw-r--r--src/widgets/itemviews/qdirmodel.cpp2
-rw-r--r--src/widgets/itemviews/qdirmodel.h2
-rw-r--r--src/widgets/itemviews/qfileiconprovider.cpp2
-rw-r--r--src/widgets/itemviews/qfileiconprovider.h2
-rw-r--r--src/widgets/itemviews/qheaderview.cpp36
-rw-r--r--src/widgets/itemviews/qheaderview.h4
-rw-r--r--src/widgets/itemviews/qheaderview_p.h2
-rw-r--r--src/widgets/itemviews/qitemdelegate.cpp24
-rw-r--r--src/widgets/itemviews/qitemdelegate.h4
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp2
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.h2
-rw-r--r--src/widgets/itemviews/qitemeditorfactory_p.h2
-rw-r--r--src/widgets/itemviews/qlistview.cpp6
-rw-r--r--src/widgets/itemviews/qlistview.h4
-rw-r--r--src/widgets/itemviews/qlistview_p.h2
-rw-r--r--src/widgets/itemviews/qlistwidget.cpp2
-rw-r--r--src/widgets/itemviews/qlistwidget.h4
-rw-r--r--src/widgets/itemviews/qlistwidget_p.h2
-rw-r--r--src/widgets/itemviews/qproxymodel.cpp2
-rw-r--r--src/widgets/itemviews/qproxymodel.h2
-rw-r--r--src/widgets/itemviews/qproxymodel_p.h2
-rw-r--r--src/widgets/itemviews/qstandarditemmodel.cpp2
-rw-r--r--src/widgets/itemviews/qstandarditemmodel.h2
-rw-r--r--src/widgets/itemviews/qstandarditemmodel_p.h2
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.cpp2
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.h2
-rw-r--r--src/widgets/itemviews/qtableview.cpp2
-rw-r--r--src/widgets/itemviews/qtableview.h2
-rw-r--r--src/widgets/itemviews/qtableview_p.h2
-rw-r--r--src/widgets/itemviews/qtablewidget.cpp2
-rw-r--r--src/widgets/itemviews/qtablewidget.h2
-rw-r--r--src/widgets/itemviews/qtablewidget_p.h2
-rw-r--r--src/widgets/itemviews/qtreeview.cpp127
-rw-r--r--src/widgets/itemviews/qtreeview.h4
-rw-r--r--src/widgets/itemviews/qtreeview_p.h7
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp2
-rw-r--r--src/widgets/itemviews/qtreewidget.h2
-rw-r--r--src/widgets/itemviews/qtreewidget_p.h2
-rw-r--r--src/widgets/itemviews/qtreewidgetitemiterator.cpp2
-rw-r--r--src/widgets/itemviews/qtreewidgetitemiterator.h2
-rw-r--r--src/widgets/itemviews/qtreewidgetitemiterator_p.h2
-rw-r--r--src/widgets/itemviews/qwidgetitemdata_p.h2
-rw-r--r--src/widgets/kernel/qaction.cpp102
-rw-r--r--src/widgets/kernel/qaction.h2
-rw-r--r--src/widgets/kernel/qaction_p.h2
-rw-r--r--src/widgets/kernel/qactiongroup.cpp2
-rw-r--r--src/widgets/kernel/qactiongroup.h2
-rw-r--r--src/widgets/kernel/qapplication.cpp208
-rw-r--r--src/widgets/kernel/qapplication.h5
-rw-r--r--src/widgets/kernel/qapplication_p.h173
-rw-r--r--src/widgets/kernel/qapplication_qpa.cpp6
-rw-r--r--src/widgets/kernel/qboxlayout.cpp2
-rw-r--r--src/widgets/kernel/qboxlayout.h2
-rw-r--r--src/widgets/kernel/qdesktopwidget.cpp2
-rw-r--r--src/widgets/kernel/qdesktopwidget.h2
-rw-r--r--src/widgets/kernel/qdesktopwidget.qdoc2
-rw-r--r--src/widgets/kernel/qdesktopwidget_qpa.cpp2
-rw-r--r--src/widgets/kernel/qdesktopwidget_qpa_p.h2
-rw-r--r--src/widgets/kernel/qformlayout.cpp4
-rw-r--r--src/widgets/kernel/qformlayout.h2
-rw-r--r--src/widgets/kernel/qgesture.cpp2
-rw-r--r--src/widgets/kernel/qgesture.h2
-rw-r--r--src/widgets/kernel/qgesture_p.h2
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp2
-rw-r--r--src/widgets/kernel/qgesturemanager_p.h2
-rw-r--r--src/widgets/kernel/qgesturerecognizer.cpp2
-rw-r--r--src/widgets/kernel/qgesturerecognizer.h2
-rw-r--r--src/widgets/kernel/qgridlayout.cpp2
-rw-r--r--src/widgets/kernel/qgridlayout.h2
-rw-r--r--src/widgets/kernel/qguiplatformplugin.cpp4
-rw-r--r--src/widgets/kernel/qguiplatformplugin_p.h2
-rw-r--r--src/widgets/kernel/qicon.cpp10
-rw-r--r--src/widgets/kernel/qicon.h6
-rw-r--r--src/widgets/kernel/qicon_p.h2
-rw-r--r--src/widgets/kernel/qiconengine.cpp2
-rw-r--r--src/widgets/kernel/qiconengine.h2
-rw-r--r--src/widgets/kernel/qiconengineplugin.cpp2
-rw-r--r--src/widgets/kernel/qiconengineplugin.h2
-rw-r--r--src/widgets/kernel/qiconloader.cpp2
-rw-r--r--src/widgets/kernel/qiconloader_p.h2
-rw-r--r--src/widgets/kernel/qinputcontext.cpp2
-rw-r--r--src/widgets/kernel/qinputcontext.h2
-rw-r--r--src/widgets/kernel/qlayout.cpp2
-rw-r--r--src/widgets/kernel/qlayout.h2
-rw-r--r--src/widgets/kernel/qlayout_p.h2
-rw-r--r--src/widgets/kernel/qlayoutengine.cpp2
-rw-r--r--src/widgets/kernel/qlayoutengine_p.h2
-rw-r--r--src/widgets/kernel/qlayoutitem.cpp12
-rw-r--r--src/widgets/kernel/qlayoutitem.h2
-rw-r--r--src/widgets/kernel/qplatformdialoghelper_qpa.cpp468
-rw-r--r--src/widgets/kernel/qplatformdialoghelper_qpa.h189
-rw-r--r--src/widgets/kernel/qplatformmenu_qpa.cpp2
-rw-r--r--src/widgets/kernel/qplatformmenu_qpa.h2
-rw-r--r--src/widgets/kernel/qshortcut.cpp6
-rw-r--r--src/widgets/kernel/qshortcut.h4
-rw-r--r--src/widgets/kernel/qsizepolicy.h6
-rw-r--r--src/widgets/kernel/qsizepolicy.qdoc2
-rw-r--r--src/widgets/kernel/qsoftkeymanager.cpp2
-rw-r--r--src/widgets/kernel/qsoftkeymanager_common_p.h2
-rw-r--r--src/widgets/kernel/qsoftkeymanager_p.h2
-rw-r--r--src/widgets/kernel/qstackedlayout.cpp2
-rw-r--r--src/widgets/kernel/qstackedlayout.h2
-rw-r--r--src/widgets/kernel/qstandardgestures.cpp2
-rw-r--r--src/widgets/kernel/qstandardgestures_p.h2
-rw-r--r--src/widgets/kernel/qt_widgets_pch.h2
-rw-r--r--src/widgets/kernel/qtooltip.cpp2
-rw-r--r--src/widgets/kernel/qtooltip.h2
-rw-r--r--src/widgets/kernel/qwhatsthis.cpp21
-rw-r--r--src/widgets/kernel/qwhatsthis.h2
-rw-r--r--src/widgets/kernel/qwidget.cpp512
-rw-r--r--src/widgets/kernel/qwidget.h12
-rw-r--r--src/widgets/kernel/qwidget_p.h2
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp2
-rw-r--r--src/widgets/kernel/qwidgetaction.cpp2
-rw-r--r--src/widgets/kernel/qwidgetaction.h2
-rw-r--r--src/widgets/kernel/qwidgetaction_p.h2
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp2
-rw-r--r--src/widgets/kernel/qwidgetbackingstore_p.h2
-rw-r--r--src/widgets/kernel/qwidgetsvariant.cpp52
-rw-r--r--src/widgets/kernel/qwidgetwindow_qpa.cpp2
-rw-r--r--src/widgets/kernel/qwidgetwindow_qpa_p.h2
-rw-r--r--src/widgets/platforms/mac/qapplication_mac.mm2
-rw-r--r--src/widgets/platforms/mac/qclipboard_mac.cpp2
-rw-r--r--src/widgets/platforms/mac/qcocoaintrospection_mac.mm2
-rw-r--r--src/widgets/platforms/mac/qcocoaintrospection_p.h2
-rw-r--r--src/widgets/platforms/mac/qcocoapanel_mac.mm2
-rw-r--r--src/widgets/platforms/mac/qcocoapanel_mac_p.h2
-rw-r--r--src/widgets/platforms/mac/qcocoasharedwindowmethods_mac_p.h2
-rw-r--r--src/widgets/platforms/mac/qcocoaview_mac.mm2
-rw-r--r--src/widgets/platforms/mac/qcocoaview_mac_p.h2
-rw-r--r--src/widgets/platforms/mac/qcocoawindow_mac.mm2
-rw-r--r--src/widgets/platforms/mac/qcocoawindow_mac_p.h2
-rw-r--r--src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac.mm2
-rw-r--r--src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac_p.h2
-rw-r--r--src/widgets/platforms/mac/qcocoawindowdelegate_mac.mm2
-rw-r--r--src/widgets/platforms/mac/qcocoawindowdelegate_mac_p.h2
-rw-r--r--src/widgets/platforms/mac/qcolormap_mac.cpp2
-rw-r--r--src/widgets/platforms/mac/qdesktopwidget_mac.mm2
-rw-r--r--src/widgets/platforms/mac/qdesktopwidget_mac_p.h2
-rw-r--r--src/widgets/platforms/mac/qdnd_mac.mm2
-rw-r--r--src/widgets/platforms/mac/qeventdispatcher_mac.mm2
-rw-r--r--src/widgets/platforms/mac/qeventdispatcher_mac_p.h2
-rw-r--r--src/widgets/platforms/mac/qkeymapper_mac.cpp2
-rw-r--r--src/widgets/platforms/mac/qmacdefines_mac.h2
-rw-r--r--src/widgets/platforms/mac/qmacgesturerecognizer_mac.mm2
-rw-r--r--src/widgets/platforms/mac/qmacgesturerecognizer_mac_p.h2
-rw-r--r--src/widgets/platforms/mac/qmacinputcontext_mac.cpp2
-rw-r--r--src/widgets/platforms/mac/qmacinputcontext_p.h2
-rw-r--r--src/widgets/platforms/mac/qmime_mac.cpp2
-rw-r--r--src/widgets/platforms/mac/qnsframeview_mac_p.h2
-rw-r--r--src/widgets/platforms/mac/qnsthemeframe_mac_p.h2
-rw-r--r--src/widgets/platforms/mac/qnstitledframe_mac_p.h2
-rw-r--r--src/widgets/platforms/mac/qpaintdevice_mac.cpp51
-rw-r--r--src/widgets/platforms/mac/qpaintengine_mac.cpp103
-rw-r--r--src/widgets/platforms/mac/qpaintengine_mac_p.h2
-rw-r--r--src/widgets/platforms/mac/qpixmap_mac.cpp2
-rw-r--r--src/widgets/platforms/mac/qpixmap_mac_p.h2
-rw-r--r--src/widgets/platforms/mac/qprintengine_mac.mm2
-rw-r--r--src/widgets/platforms/mac/qprintengine_mac_p.h2
-rw-r--r--src/widgets/platforms/mac/qprinterinfo_mac.cpp2
-rw-r--r--src/widgets/platforms/mac/qregion_mac.cpp73
-rw-r--r--src/widgets/platforms/mac/qt_cocoa_helpers_mac.mm8
-rw-r--r--src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h4
-rw-r--r--src/widgets/platforms/mac/qt_mac.cpp20
-rw-r--r--src/widgets/platforms/mac/qt_mac_p.h2
-rw-r--r--src/widgets/platforms/mac/qwidget_mac.mm2
-rw-r--r--src/widgets/statemachine/qbasickeyeventtransition.cpp2
-rw-r--r--src/widgets/statemachine/qbasickeyeventtransition_p.h2
-rw-r--r--src/widgets/statemachine/qbasicmouseeventtransition.cpp2
-rw-r--r--src/widgets/statemachine/qbasicmouseeventtransition_p.h2
-rw-r--r--src/widgets/statemachine/qguistatemachine.cpp9
-rw-r--r--src/widgets/statemachine/qkeyeventtransition.cpp2
-rw-r--r--src/widgets/statemachine/qkeyeventtransition.h2
-rw-r--r--src/widgets/statemachine/qmouseeventtransition.cpp2
-rw-r--r--src/widgets/statemachine/qmouseeventtransition.h2
-rw-r--r--src/widgets/styles/qcdestyle.cpp2
-rw-r--r--src/widgets/styles/qcdestyle.h2
-rw-r--r--src/widgets/styles/qcleanlooksstyle.cpp2
-rw-r--r--src/widgets/styles/qcleanlooksstyle.h2
-rw-r--r--src/widgets/styles/qcleanlooksstyle_p.h2
-rw-r--r--src/widgets/styles/qcommonstyle.cpp8
-rw-r--r--src/widgets/styles/qcommonstyle.h2
-rw-r--r--src/widgets/styles/qcommonstyle_p.h2
-rw-r--r--src/widgets/styles/qcommonstylepixmaps_p.h2
-rw-r--r--src/widgets/styles/qdrawutil.cpp2
-rw-r--r--src/widgets/styles/qdrawutil.h2
-rw-r--r--src/widgets/styles/qgtkpainter.cpp2
-rw-r--r--src/widgets/styles/qgtkpainter_p.h2
-rw-r--r--src/widgets/styles/qgtkstyle.cpp2
-rw-r--r--src/widgets/styles/qgtkstyle.h2
-rw-r--r--src/widgets/styles/qgtkstyle_p.cpp2
-rw-r--r--src/widgets/styles/qgtkstyle_p.h2
-rw-r--r--src/widgets/styles/qmacstyle.qdoc2
-rw-r--r--src/widgets/styles/qmacstyle_mac.h4
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm434
-rw-r--r--src/widgets/styles/qmacstyle_mac_p.h28
-rw-r--r--src/widgets/styles/qmacstylepixmaps_mac_p.h2
-rw-r--r--src/widgets/styles/qmotifstyle.cpp2
-rw-r--r--src/widgets/styles/qmotifstyle.h2
-rw-r--r--src/widgets/styles/qmotifstyle_p.h2
-rw-r--r--src/widgets/styles/qplastiquestyle.cpp2
-rw-r--r--src/widgets/styles/qplastiquestyle.h2
-rw-r--r--src/widgets/styles/qproxystyle.cpp2
-rw-r--r--src/widgets/styles/qproxystyle.h2
-rw-r--r--src/widgets/styles/qproxystyle_p.h2
-rw-r--r--src/widgets/styles/qstyle.cpp2
-rw-r--r--src/widgets/styles/qstyle.h2
-rw-r--r--src/widgets/styles/qstyle_p.h2
-rw-r--r--src/widgets/styles/qstylefactory.cpp4
-rw-r--r--src/widgets/styles/qstylefactory.h2
-rw-r--r--src/widgets/styles/qstylehelper.cpp25
-rw-r--r--src/widgets/styles/qstylehelper_p.h2
-rw-r--r--src/widgets/styles/qstyleoption.cpp2
-rw-r--r--src/widgets/styles/qstyleoption.h2
-rw-r--r--src/widgets/styles/qstylepainter.cpp2
-rw-r--r--src/widgets/styles/qstylepainter.h2
-rw-r--r--src/widgets/styles/qstyleplugin.cpp2
-rw-r--r--src/widgets/styles/qstyleplugin.h2
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp2
-rw-r--r--src/widgets/styles/qstylesheetstyle_default.cpp2
-rw-r--r--src/widgets/styles/qstylesheetstyle_p.h2
-rw-r--r--src/widgets/styles/qwindowscestyle.cpp2
-rw-r--r--src/widgets/styles/qwindowscestyle.h2
-rw-r--r--src/widgets/styles/qwindowscestyle_p.h2
-rw-r--r--src/widgets/styles/qwindowsmobilestyle.cpp2
-rw-r--r--src/widgets/styles/qwindowsmobilestyle.h2
-rw-r--r--src/widgets/styles/qwindowsmobilestyle_p.h2
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp22
-rw-r--r--src/widgets/styles/qwindowsstyle.h2
-rw-r--r--src/widgets/styles/qwindowsstyle_p.h2
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp2
-rw-r--r--src/widgets/styles/qwindowsvistastyle.h2
-rw-r--r--src/widgets/styles/qwindowsvistastyle_p.h2
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp2
-rw-r--r--src/widgets/styles/qwindowsxpstyle.h2
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p.h2
-rw-r--r--src/widgets/styles/styles.pri3
-rw-r--r--src/widgets/util/qcolormap.h2
-rw-r--r--src/widgets/util/qcolormap.qdoc2
-rw-r--r--src/widgets/util/qcolormap_qpa.cpp2
-rw-r--r--src/widgets/util/qcompleter.cpp4
-rw-r--r--src/widgets/util/qcompleter.h2
-rw-r--r--src/widgets/util/qcompleter_p.h4
-rw-r--r--src/widgets/util/qflickgesture.cpp2
-rw-r--r--src/widgets/util/qflickgesture_p.h2
-rw-r--r--src/widgets/util/qscroller.cpp8
-rw-r--r--src/widgets/util/qscroller.h2
-rw-r--r--src/widgets/util/qscroller_mac.mm2
-rw-r--r--src/widgets/util/qscroller_p.h2
-rw-r--r--src/widgets/util/qscrollerproperties.cpp2
-rw-r--r--src/widgets/util/qscrollerproperties.h2
-rw-r--r--src/widgets/util/qscrollerproperties_p.h2
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp2
-rw-r--r--src/widgets/util/qsystemtrayicon.h2
-rw-r--r--src/widgets/util/qsystemtrayicon_mac.mm2
-rw-r--r--src/widgets/util/qsystemtrayicon_p.h2
-rw-r--r--src/widgets/util/qsystemtrayicon_qpa.cpp2
-rw-r--r--src/widgets/util/qsystemtrayicon_win.cpp2
-rw-r--r--src/widgets/util/qsystemtrayicon_wince.cpp2
-rw-r--r--src/widgets/util/qsystemtrayicon_x11.cpp2
-rw-r--r--src/widgets/util/qundogroup.cpp2
-rw-r--r--src/widgets/util/qundogroup.h2
-rw-r--r--src/widgets/util/qundostack.cpp2
-rw-r--r--src/widgets/util/qundostack.h2
-rw-r--r--src/widgets/util/qundostack_p.h2
-rw-r--r--src/widgets/util/qundoview.cpp2
-rw-r--r--src/widgets/util/qundoview.h2
-rw-r--r--src/widgets/widgets/qabstractbutton.cpp2
-rw-r--r--src/widgets/widgets/qabstractbutton.h2
-rw-r--r--src/widgets/widgets/qabstractbutton_p.h2
-rw-r--r--src/widgets/widgets/qabstractscrollarea.cpp4
-rw-r--r--src/widgets/widgets/qabstractscrollarea.h5
-rw-r--r--src/widgets/widgets/qabstractscrollarea_p.h2
-rw-r--r--src/widgets/widgets/qabstractslider.cpp58
-rw-r--r--src/widgets/widgets/qabstractslider.h2
-rw-r--r--src/widgets/widgets/qabstractslider_p.h2
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp14
-rw-r--r--src/widgets/widgets/qabstractspinbox.h2
-rw-r--r--src/widgets/widgets/qabstractspinbox_p.h2
-rw-r--r--src/widgets/widgets/qbuttongroup.cpp12
-rw-r--r--src/widgets/widgets/qbuttongroup.h2
-rw-r--r--src/widgets/widgets/qcalendartextnavigator_p.h2
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp2
-rw-r--r--src/widgets/widgets/qcalendarwidget.h2
-rw-r--r--src/widgets/widgets/qcheckbox.cpp2
-rw-r--r--src/widgets/widgets/qcheckbox.h2
-rw-r--r--src/widgets/widgets/qcocoatoolbardelegate_mac.mm2
-rw-r--r--src/widgets/widgets/qcocoatoolbardelegate_mac_p.h2
-rw-r--r--src/widgets/widgets/qcombobox.cpp2
-rw-r--r--src/widgets/widgets/qcombobox.h2
-rw-r--r--src/widgets/widgets/qcombobox_p.h2
-rw-r--r--src/widgets/widgets/qcommandlinkbutton.cpp2
-rw-r--r--src/widgets/widgets/qcommandlinkbutton.h2
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp2
-rw-r--r--src/widgets/widgets/qdatetimeedit.h2
-rw-r--r--src/widgets/widgets/qdatetimeedit_p.h2
-rw-r--r--src/widgets/widgets/qdial.cpp20
-rw-r--r--src/widgets/widgets/qdial.h2
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp2
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.h2
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp2
-rw-r--r--src/widgets/widgets/qdockarealayout_p.h2
-rw-r--r--src/widgets/widgets/qdockwidget.cpp2
-rw-r--r--src/widgets/widgets/qdockwidget.h2
-rw-r--r--src/widgets/widgets/qdockwidget_p.h2
-rw-r--r--src/widgets/widgets/qeffects.cpp2
-rw-r--r--src/widgets/widgets/qeffects_p.h2
-rw-r--r--src/widgets/widgets/qfocusframe.cpp4
-rw-r--r--src/widgets/widgets/qfocusframe.h2
-rw-r--r--src/widgets/widgets/qfontcombobox.cpp2
-rw-r--r--src/widgets/widgets/qfontcombobox.h2
-rw-r--r--src/widgets/widgets/qframe.cpp2
-rw-r--r--src/widgets/widgets/qframe.h2
-rw-r--r--src/widgets/widgets/qframe_p.h2
-rw-r--r--src/widgets/widgets/qgroupbox.cpp2
-rw-r--r--src/widgets/widgets/qgroupbox.h2
-rw-r--r--src/widgets/widgets/qlabel.cpp2
-rw-r--r--src/widgets/widgets/qlabel.h2
-rw-r--r--src/widgets/widgets/qlabel_p.h2
-rw-r--r--src/widgets/widgets/qlcdnumber.cpp2
-rw-r--r--src/widgets/widgets/qlcdnumber.h2
-rw-r--r--src/widgets/widgets/qlineedit.cpp19
-rw-r--r--src/widgets/widgets/qlineedit.h2
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp15
-rw-r--r--src/widgets/widgets/qlineedit_p.h2
-rw-r--r--src/widgets/widgets/qmaccocoaviewcontainer_mac.h2
-rw-r--r--src/widgets/widgets/qmaccocoaviewcontainer_mac.mm2
-rw-r--r--src/widgets/widgets/qmacnativewidget_mac.h2
-rw-r--r--src/widgets/widgets/qmacnativewidget_mac.mm2
-rw-r--r--src/widgets/widgets/qmainwindow.cpp2
-rw-r--r--src/widgets/widgets/qmainwindow.h2
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp2
-rw-r--r--src/widgets/widgets/qmainwindowlayout_mac.mm2
-rw-r--r--src/widgets/widgets/qmainwindowlayout_p.h2
-rw-r--r--src/widgets/widgets/qmdiarea.cpp2
-rw-r--r--src/widgets/widgets/qmdiarea.h2
-rw-r--r--src/widgets/widgets/qmdiarea_p.h2
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp2
-rw-r--r--src/widgets/widgets/qmdisubwindow.h2
-rw-r--r--src/widgets/widgets/qmdisubwindow_p.h2
-rw-r--r--src/widgets/widgets/qmenu.cpp4
-rw-r--r--src/widgets/widgets/qmenu.h2
-rw-r--r--src/widgets/widgets/qmenu_p.h2
-rw-r--r--src/widgets/widgets/qmenu_wince.cpp2
-rw-r--r--src/widgets/widgets/qmenu_wince_resource_p.h2
-rw-r--r--src/widgets/widgets/qmenubar.cpp2
-rw-r--r--src/widgets/widgets/qmenubar.h2
-rw-r--r--src/widgets/widgets/qmenubar_p.h2
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp2
-rw-r--r--src/widgets/widgets/qplaintextedit.h2
-rw-r--r--src/widgets/widgets/qplaintextedit_p.h2
-rw-r--r--src/widgets/widgets/qprogressbar.cpp7
-rw-r--r--src/widgets/widgets/qprogressbar.h2
-rw-r--r--src/widgets/widgets/qpushbutton.cpp2
-rw-r--r--src/widgets/widgets/qpushbutton.h2
-rw-r--r--src/widgets/widgets/qpushbutton_p.h2
-rw-r--r--src/widgets/widgets/qradiobutton.cpp2
-rw-r--r--src/widgets/widgets/qradiobutton.h2
-rw-r--r--src/widgets/widgets/qrubberband.cpp2
-rw-r--r--src/widgets/widgets/qrubberband.h2
-rw-r--r--src/widgets/widgets/qscrollarea.cpp2
-rw-r--r--src/widgets/widgets/qscrollarea.h2
-rw-r--r--src/widgets/widgets/qscrollarea_p.h2
-rw-r--r--src/widgets/widgets/qscrollbar.cpp2
-rw-r--r--src/widgets/widgets/qscrollbar.h2
-rw-r--r--src/widgets/widgets/qsizegrip.cpp2
-rw-r--r--src/widgets/widgets/qsizegrip.h2
-rw-r--r--src/widgets/widgets/qslider.cpp2
-rw-r--r--src/widgets/widgets/qslider.h2
-rw-r--r--src/widgets/widgets/qspinbox.cpp32
-rw-r--r--src/widgets/widgets/qspinbox.h2
-rw-r--r--src/widgets/widgets/qsplashscreen.cpp2
-rw-r--r--src/widgets/widgets/qsplashscreen.h2
-rw-r--r--src/widgets/widgets/qsplitter.cpp4
-rw-r--r--src/widgets/widgets/qsplitter.h4
-rw-r--r--src/widgets/widgets/qsplitter_p.h2
-rw-r--r--src/widgets/widgets/qstackedwidget.cpp2
-rw-r--r--src/widgets/widgets/qstackedwidget.h2
-rw-r--r--src/widgets/widgets/qstatusbar.cpp2
-rw-r--r--src/widgets/widgets/qstatusbar.h2
-rw-r--r--src/widgets/widgets/qtabbar.cpp2
-rw-r--r--src/widgets/widgets/qtabbar.h2
-rw-r--r--src/widgets/widgets/qtabbar_p.h2
-rw-r--r--src/widgets/widgets/qtabwidget.cpp158
-rw-r--r--src/widgets/widgets/qtabwidget.h2
-rw-r--r--src/widgets/widgets/qtextbrowser.cpp2
-rw-r--r--src/widgets/widgets/qtextbrowser.h2
-rw-r--r--src/widgets/widgets/qtextedit.cpp3
-rw-r--r--src/widgets/widgets/qtextedit.h2
-rw-r--r--src/widgets/widgets/qtextedit_p.h2
-rw-r--r--src/widgets/widgets/qtoolbar.cpp4
-rw-r--r--src/widgets/widgets/qtoolbar.h2
-rw-r--r--src/widgets/widgets/qtoolbar_p.h2
-rw-r--r--src/widgets/widgets/qtoolbararealayout.cpp2
-rw-r--r--src/widgets/widgets/qtoolbararealayout_p.h2
-rw-r--r--src/widgets/widgets/qtoolbarextension.cpp2
-rw-r--r--src/widgets/widgets/qtoolbarextension_p.h2
-rw-r--r--src/widgets/widgets/qtoolbarlayout.cpp2
-rw-r--r--src/widgets/widgets/qtoolbarlayout_p.h2
-rw-r--r--src/widgets/widgets/qtoolbarseparator.cpp2
-rw-r--r--src/widgets/widgets/qtoolbarseparator_p.h2
-rw-r--r--src/widgets/widgets/qtoolbox.cpp2
-rw-r--r--src/widgets/widgets/qtoolbox.h2
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp2
-rw-r--r--src/widgets/widgets/qtoolbutton.h2
-rw-r--r--src/widgets/widgets/qwidgetanimator.cpp2
-rw-r--r--src/widgets/widgets/qwidgetanimator_p.h2
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp58
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol_p.h28
-rw-r--r--src/widgets/widgets/qwidgetresizehandler.cpp2
-rw-r--r--src/widgets/widgets/qwidgetresizehandler_p.h2
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp88
-rw-r--r--src/widgets/widgets/qwidgettextcontrol_p.h2
-rw-r--r--src/widgets/widgets/qwidgettextcontrol_p_p.h2
-rw-r--r--src/widgets/widgets/qworkspace.cpp2
-rw-r--r--src/widgets/widgets/qworkspace.h2
-rw-r--r--src/winmain/qtmain_win.cpp2
-rw-r--r--src/xml/dom/qdom.cpp7
-rw-r--r--src/xml/dom/qdom.h2
-rw-r--r--src/xml/sax/qxml.cpp2
-rw-r--r--src/xml/sax/qxml.h2
2471 files changed, 14467 insertions, 37605 deletions
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-greek.c b/src/3rdparty/harfbuzz/src/harfbuzz-greek.c
index 8099838323..f3c0ff62ef 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-greek.c
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-greek.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
diff --git a/src/3rdparty/libpng/pnglibconf.h b/src/3rdparty/libpng/pnglibconf.h
index b1d2169105..c46dde3a0f 100644
--- a/src/3rdparty/libpng/pnglibconf.h
+++ b/src/3rdparty/libpng/pnglibconf.h
@@ -100,7 +100,9 @@
#define PNG_WRITE_SHIFT_SUPPORTED
#define PNG_PROGRESSIVE_READ_SUPPORTED
#define PNG_READ_SHIFT_SUPPORTED
-#define PNG_CONVERT_tIME_SUPPORTED
+#ifndef _WIN32_WCE
+ #define PNG_CONVERT_tIME_SUPPORTED
+#endif
#define PNG_READ_USER_TRANSFORM_SUPPORTED
#define PNG_READ_INT_FUNCTIONS_SUPPORTED
#define PNG_READ_USER_CHUNKS_SUPPORTED
diff --git a/src/3rdparty/s60/eiksoftkeyimage.h b/src/3rdparty/s60/eiksoftkeyimage.h
index d2b1cf7ce0..01a41a5b47 100644
--- a/src/3rdparty/s60/eiksoftkeyimage.h
+++ b/src/3rdparty/s60/eiksoftkeyimage.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
index fc64b027bb..b901da5dcf 100644
--- a/src/3rdparty/sqlite/sqlite3.c
+++ b/src/3rdparty/sqlite/sqlite3.c
@@ -13540,6 +13540,16 @@ static void clearYMD_HMS_TZ(DateTime *p){
#ifndef SQLITE_OMIT_LOCALTIME
/*
+** Windows CE does not declare the localtime
+** function as it is not defined anywhere.
+** Anyway we need the forward-declaration to be
+** able to define it later on.
+*/
+#if defined(_WIN32_WCE) && (_WIN32_WCE >= 0x600)
+static struct tm *__cdecl localtime(const time_t *t);
+#endif
+
+/*
** The following routine implements the rough equivalent of localtime_r()
** using whatever operating-system specific localtime facility that
** is available. This routine returns 0 on success and
@@ -13574,19 +13584,6 @@ static int osLocaltime(time_t *t, struct tm *pTm){
#endif /* HAVE_LOCALTIME_R || HAVE_LOCALTIME_S */
return rc;
}
-#endif /* SQLITE_OMIT_LOCALTIME */
-
-
-#ifndef SQLITE_OMIT_LOCALTIME
-/*
-** Windows CE does not declare the localtime
-** function as it is not defined anywhere.
-** Anyway we need the forward-declaration to be
-** able to define it later on.
-*/
-#if defined(_WIN32_WCE) && (_WIN32_WCE >= 0x600)
-static struct tm *__cdecl localtime(const time_t *t);
-#endif
/*
** Compute the difference (in milliseconds) between localtime and UTC
diff --git a/src/3rdparty/v8 b/src/3rdparty/v8
deleted file mode 160000
-Subproject d28b6a024826aaa48a8b3e69c096d01c91aff2c
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
index 154069411a..e97493f65d 100644
--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
+++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
@@ -2,10 +2,6 @@
get_filename_component(_qt5_corelib_install_prefix ${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR} ABSOLUTE)
# Required by default:
-set(QT_QMAKE_EXECUTABLE \"${_qt5_corelib_install_prefix}/$$CMAKE_BIN_DIR/qmake\")
-set(QT_MOC_EXECUTABLE \"${_qt5_corelib_install_prefix}/$$CMAKE_BIN_DIR/moc\")
-set(QT_RCC_EXECUTABLE \"${_qt5_corelib_install_prefix}/$$CMAKE_BIN_DIR/rcc\")
-
-set(Qt5Core_PLUGIN_TYPES codecs)
-
-set(Qt5_CODECS_PLUGINS qcncodecs qjpcodecs qkrcodecs qtwcodecs )
+set(QT_QMAKE_EXECUTABLE \"${_qt5_corelib_install_prefix}/$$CMAKE_BIN_DIR/qmake$$CMAKE_BIN_SUFFIX\")
+set(QT_MOC_EXECUTABLE \"${_qt5_corelib_install_prefix}/$$CMAKE_BIN_DIR/moc$$CMAKE_BIN_SUFFIX\")
+set(QT_RCC_EXECUTABLE \"${_qt5_corelib_install_prefix}/$$CMAKE_BIN_DIR/rcc$$CMAKE_BIN_SUFFIX\")
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake
index b7f785b716..abfe49ec84 100644
--- a/src/corelib/Qt5CoreMacros.cmake
+++ b/src/corelib/Qt5CoreMacros.cmake
@@ -39,167 +39,166 @@
include(CMakeParseArguments)
# macro used to create the names of output files preserving relative dirs
-MACRO (QT5_MAKE_OUTPUT_FILE infile prefix ext outfile )
- STRING(LENGTH ${CMAKE_CURRENT_BINARY_DIR} _binlength)
- STRING(LENGTH ${infile} _infileLength)
- SET(_checkinfile ${CMAKE_CURRENT_SOURCE_DIR})
- IF(_infileLength GREATER _binlength)
- STRING(SUBSTRING "${infile}" 0 ${_binlength} _checkinfile)
- IF(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
- FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_BINARY_DIR} ${infile})
- ELSE(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
- FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile})
- ENDIF(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
- ELSE(_infileLength GREATER _binlength)
- FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile})
- ENDIF(_infileLength GREATER _binlength)
- IF(WIN32 AND rel MATCHES "^[a-zA-Z]:") # absolute path
- STRING(REGEX REPLACE "^([a-zA-Z]):(.*)$" "\\1_\\2" rel "${rel}")
- ENDIF(WIN32 AND rel MATCHES "^[a-zA-Z]:")
- SET(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}")
- STRING(REPLACE ".." "__" _outfile ${_outfile})
- GET_FILENAME_COMPONENT(outpath ${_outfile} PATH)
- GET_FILENAME_COMPONENT(_outfile ${_outfile} NAME_WE)
- FILE(MAKE_DIRECTORY ${outpath})
- SET(${outfile} ${outpath}/${prefix}${_outfile}.${ext})
-ENDMACRO (QT5_MAKE_OUTPUT_FILE )
-
-
-MACRO (QT5_GET_MOC_FLAGS _moc_flags)
- SET(${_moc_flags})
- GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES)
-
- FOREACH(_current ${_inc_DIRS})
- IF("${_current}" MATCHES "\\.framework/?$")
- STRING(REGEX REPLACE "/[^/]+\\.framework" "" framework_path "${_current}")
- SET(${_moc_flags} ${${_moc_flags}} "-F${framework_path}")
- ELSE("${_current}" MATCHES "\\.framework/?$")
- SET(${_moc_flags} ${${_moc_flags}} "-I${_current}")
- ENDIF("${_current}" MATCHES "\\.framework/?$")
- ENDFOREACH(_current ${_inc_DIRS})
-
- GET_DIRECTORY_PROPERTY(_defines COMPILE_DEFINITIONS)
- FOREACH(_current ${_defines})
- SET(${_moc_flags} ${${_moc_flags}} "-D${_current}")
- ENDFOREACH(_current ${_defines})
-
- IF(Q_WS_WIN)
- SET(${_moc_flags} ${${_moc_flags}} -DWIN32)
- ENDIF(Q_WS_WIN)
-
-ENDMACRO(QT5_GET_MOC_FLAGS)
+macro(QT5_MAKE_OUTPUT_FILE infile prefix ext outfile )
+ string(LENGTH ${CMAKE_CURRENT_BINARY_DIR} _binlength)
+ string(LENGTH ${infile} _infileLength)
+ set(_checkinfile ${CMAKE_CURRENT_SOURCE_DIR})
+ if(_infileLength GREATER _binlength)
+ string(SUBSTRING "${infile}" 0 ${_binlength} _checkinfile)
+ if(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+ file(RELATIVE_PATH rel ${CMAKE_CURRENT_BINARY_DIR} ${infile})
+ else()
+ file(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile})
+ endif()
+ else()
+ file(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile})
+ endif()
+ if(WIN32 AND rel MATCHES "^[a-zA-Z]:") # absolute path
+ string(REGEX REPLACE "^([a-zA-Z]):(.*)$" "\\1_\\2" rel "${rel}")
+ endif()
+ set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}")
+ string(REPLACE ".." "__" _outfile ${_outfile})
+ get_filename_component(outpath ${_outfile} PATH)
+ get_filename_component(_outfile ${_outfile} NAME_WE)
+ file(MAKE_DIRECTORY ${outpath})
+ set(${outfile} ${outpath}/${prefix}${_outfile}.${ext})
+endmacro()
+
+
+macro(QT5_GET_MOC_FLAGS _moc_flags)
+ set(${_moc_flags})
+ get_directory_property(_inc_DIRS INCLUDE_DIRECTORIES)
+
+ foreach(_current ${_inc_DIRS})
+ if("${_current}" MATCHES "\\.framework/?$")
+ string(REGEX REPLACE "/[^/]+\\.framework" "" framework_path "${_current}")
+ set(${_moc_flags} ${${_moc_flags}} "-F${framework_path}")
+ else()
+ set(${_moc_flags} ${${_moc_flags}} "-I${_current}")
+ endif()
+ endforeach()
+
+ get_directory_property(_defines COMPILE_DEFINITIONS)
+ foreach(_current ${_defines})
+ set(${_moc_flags} ${${_moc_flags}} "-D${_current}")
+ endforeach()
+
+ if(Q_WS_WIN)
+ set(${_moc_flags} ${${_moc_flags}} -DWIN32)
+ endif()
+endmacro()
# helper macro to set up a moc rule
-MACRO (QT5_CREATE_MOC_COMMAND infile outfile moc_flags moc_options)
- # For Windows, create a parameters file to work around command line length limit
- IF (WIN32)
- # Pass the parameters in a file. Set the working directory to
- # be that containing the parameters file and reference it by
- # just the file name. This is necessary because the moc tool on
- # MinGW builds does not seem to handle spaces in the path to the
- # file given with the @ syntax.
- GET_FILENAME_COMPONENT(_moc_outfile_name "${outfile}" NAME)
- GET_FILENAME_COMPONENT(_moc_outfile_dir "${outfile}" PATH)
- IF(_moc_outfile_dir)
- SET(_moc_working_dir WORKING_DIRECTORY ${_moc_outfile_dir})
- ENDIF(_moc_outfile_dir)
- SET (_moc_parameters_file ${outfile}_parameters)
- SET (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}")
- STRING (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}")
- FILE (WRITE ${_moc_parameters_file} "${_moc_parameters}")
- ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
- COMMAND ${QT_MOC_EXECUTABLE} @${_moc_outfile_name}_parameters
- DEPENDS ${infile}
- ${_moc_working_dir}
- VERBATIM)
- ELSE (WIN32)
- ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
- COMMAND ${QT_MOC_EXECUTABLE}
- ARGS ${moc_flags} ${moc_options} -o ${outfile} ${infile}
- DEPENDS ${infile} VERBATIM)
- ENDIF (WIN32)
-ENDMACRO (QT5_CREATE_MOC_COMMAND)
-
-
-MACRO (QT5_GENERATE_MOC infile outfile )
-# get include dirs and flags
- QT5_GET_MOC_FLAGS(moc_flags)
- GET_FILENAME_COMPONENT(abs_infile ${infile} ABSOLUTE)
- SET(_outfile "${outfile}")
- IF(NOT IS_ABSOLUTE "${outfile}")
- SET(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}")
- ENDIF(NOT IS_ABSOLUTE "${outfile}")
- QT5_CREATE_MOC_COMMAND(${abs_infile} ${_outfile} "${moc_flags}" "")
- SET_SOURCE_FILES_PROPERTIES(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file
-ENDMACRO (QT5_GENERATE_MOC)
-
-
-# QT5_WRAP_CPP(outfiles inputfile ... )
-
-MACRO (QT5_WRAP_CPP outfiles )
- # get include dirs
- QT5_GET_MOC_FLAGS(moc_flags)
-
- set(options)
- set(oneValueArgs)
- set(multiValueArgs OPTIONS)
-
- cmake_parse_arguments(_WRAP_CPP "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-
- set(moc_files ${_WRAP_CPP_UNPARSED_ARGUMENTS})
- set(moc_options ${_WRAP_CPP_OPTIONS})
- FOREACH (it ${moc_files})
- GET_FILENAME_COMPONENT(it ${it} ABSOLUTE)
- QT5_MAKE_OUTPUT_FILE(${it} moc_ cxx outfile)
- QT5_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_flags}" "${moc_options}")
- SET(${outfiles} ${${outfiles}} ${outfile})
- ENDFOREACH(it)
-
-ENDMACRO (QT5_WRAP_CPP)
-
-
-# QT5_ADD_RESOURCES(outfiles inputfile ... )
-
-MACRO (QT5_ADD_RESOURCES outfiles )
-
- set(options)
- set(oneValueArgs)
- set(multiValueArgs OPTIONS)
-
- cmake_parse_arguments(_RCC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-
- set(rcc_files ${_RCC_UNPARSED_ARGUMENTS})
- set(rcc_options ${_RCC_OPTIONS})
-
- FOREACH (it ${rcc_files})
- GET_FILENAME_COMPONENT(outfilename ${it} NAME_WE)
- GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
- GET_FILENAME_COMPONENT(rc_path ${infile} PATH)
- SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx)
- # parse file for dependencies
- # all files are absolute paths or relative to the location of the qrc file
- FILE(READ "${infile}" _RC_FILE_CONTENTS)
- STRING(REGEX MATCHALL "<file[^<]+" _RC_FILES "${_RC_FILE_CONTENTS}")
- SET(_RC_DEPENDS)
- FOREACH(_RC_FILE ${_RC_FILES})
- STRING(REGEX REPLACE "^<file[^>]*>" "" _RC_FILE "${_RC_FILE}")
- IF(NOT IS_ABSOLUTE "${_RC_FILE}")
- SET(_RC_FILE "${rc_path}/${_RC_FILE}")
- ENDIF(NOT IS_ABSOLUTE "${_RC_FILE}")
- SET(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}")
- ENDFOREACH(_RC_FILE)
- # Since this cmake macro is doing the dependency scanning for these files,
- # let's make a configured file and add it as a dependency so cmake is run
- # again when dependencies need to be recomputed.
- QT5_MAKE_OUTPUT_FILE("${infile}" "" "qrc.depends" out_depends)
- CONFIGURE_FILE("${infile}" "${out_depends}" COPY_ONLY)
- ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
- COMMAND ${QT_RCC_EXECUTABLE}
- ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile}
- MAIN_DEPENDENCY ${infile}
- DEPENDS ${_RC_DEPENDS} "${out_depends}" VERBATIM)
- SET(${outfiles} ${${outfiles}} ${outfile})
- ENDFOREACH (it)
-
-ENDMACRO (QT5_ADD_RESOURCES)
+macro(QT5_CREATE_MOC_COMMAND infile outfile moc_flags moc_options)
+ # For Windows, create a parameters file to work around command line length limit
+ if(WIN32)
+ # Pass the parameters in a file. Set the working directory to
+ # be that containing the parameters file and reference it by
+ # just the file name. This is necessary because the moc tool on
+ # MinGW builds does not seem to handle spaces in the path to the
+ # file given with the @ syntax.
+ get_filename_component(_moc_outfile_name "${outfile}" NAME)
+ get_filename_component(_moc_outfile_dir "${outfile}" PATH)
+ if(_moc_outfile_dir)
+ set(_moc_working_dir WORKING_DIRECTORY ${_moc_outfile_dir})
+ endif()
+ set(_moc_parameters_file ${outfile}_parameters)
+ set(_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}")
+ string(REPLACE ";" "\n" _moc_parameters "${_moc_parameters}")
+ file(WRITE ${_moc_parameters_file} "${_moc_parameters}")
+ add_custom_command(OUTPUT ${outfile}
+ COMMAND ${QT_MOC_EXECUTABLE} @${_moc_outfile_name}_parameters
+ DEPENDS ${infile}
+ ${_moc_working_dir}
+ VERBATIM)
+ else()
+ add_custom_command(OUTPUT ${outfile}
+ COMMAND ${QT_MOC_EXECUTABLE}
+ ARGS ${moc_flags} ${moc_options} -o ${outfile} ${infile}
+ DEPENDS ${infile} VERBATIM)
+ endif()
+endmacro()
+
+
+function(QT5_GENERATE_MOC infile outfile )
+ # get include dirs and flags
+ qt5_get_moc_flags(moc_flags)
+ get_filename_component(abs_infile ${infile} ABSOLUTE)
+ set(_outfile "${outfile}")
+ if(NOT IS_ABSOLUTE "${outfile}")
+ set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}")
+ endif()
+ qt5_create_moc_command(${abs_infile} ${_outfile} "${moc_flags}" "")
+ set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file
+endfunction()
+
+
+# qt5_wrap_cpp(outfiles inputfile ... )
+
+function(QT5_WRAP_CPP outfiles )
+ # get include dirs
+ qt5_get_moc_flags(moc_flags)
+
+ set(options)
+ set(oneValueArgs)
+ set(multiValueArgs OPTIONS)
+
+ cmake_parse_arguments(_WRAP_CPP "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ set(moc_files ${_WRAP_CPP_UNPARSED_ARGUMENTS})
+ set(moc_options ${_WRAP_CPP_OPTIONS})
+ foreach(it ${moc_files})
+ get_filename_component(it ${it} ABSOLUTE)
+ qt5_make_output_file(${it} moc_ cxx outfile)
+ qt5_create_moc_command(${it} ${outfile} "${moc_flags}" "${moc_options}")
+ list(APPEND ${outfiles} ${outfile})
+ endforeach()
+ set(${outfiles} ${${outfiles}} PARENT_SCOPE)
+endfunction()
+
+
+# qt5_add_resources(outfiles inputfile ... )
+
+function(QT5_ADD_RESOURCES outfiles )
+
+ set(options)
+ set(oneValueArgs)
+ set(multiValueArgs OPTIONS)
+
+ cmake_parse_arguments(_RCC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ set(rcc_files ${_RCC_UNPARSED_ARGUMENTS})
+ set(rcc_options ${_RCC_OPTIONS})
+
+ foreach(it ${rcc_files})
+ get_filename_component(outfilename ${it} NAME_WE)
+ get_filename_component(infile ${it} ABSOLUTE)
+ get_filename_component(rc_path ${infile} PATH)
+ set(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx)
+ # parse file for dependencies
+ # all files are absolute paths or relative to the location of the qrc file
+ file(READ "${infile}" _RC_FILE_CONTENTS)
+ string(REGEX MATCHALL "<file[^<]+" _RC_FILES "${_RC_FILE_CONTENTS}")
+ set(_RC_DEPENDS)
+ foreach(_RC_FILE ${_RC_FILES})
+ string(REGEX REPLACE "^<file[^>]*>" "" _RC_FILE "${_RC_FILE}")
+ if(NOT IS_ABSOLUTE "${_RC_FILE}")
+ set(_RC_FILE "${rc_path}/${_RC_FILE}")
+ endif()
+ set(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}")
+ endforeach()
+ # Since this cmake function is doing the dependency scanning for these files,
+ # let's make a configured file and add it as a dependency so cmake is run
+ # again when dependencies need to be recomputed.
+ qt5_make_output_file("${infile}" "" "qrc.depends" out_depends)
+ configure_file("${infile}" "${out_depends}" COPY_ONLY)
+ add_custom_command(OUTPUT ${outfile}
+ COMMAND ${QT_RCC_EXECUTABLE}
+ ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile}
+ MAIN_DEPENDENCY ${infile}
+ DEPENDS ${_RC_DEPENDS} "${out_depends}" VERBATIM)
+ list(APPEND ${outfiles} ${outfile})
+ endforeach()
+ set(${outfiles} ${${outfiles}} PARENT_SCOPE)
+endfunction()
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index b529359f71..040715f54a 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -157,18 +157,69 @@
#ifndef QT_NO_ANIMATION
#define DEFAULT_TIMER_INTERVAL 16
-#define STARTSTOP_TIMER_DELAY 0
+#define PAUSE_TIMER_COARSE_THRESHOLD 2000
QT_BEGIN_NAMESPACE
+/*!
+ \class QAbstractAnimationTimer
+ \brief QAbstractAnimationTimer is the base class for animation timers.
+ \internal
+
+ Subclass QAbstractAnimationTimer to provide an animation timer that is run by
+ QUnifiedTimer and can in turn be used to run any number of animations.
+
+ Currently two subclasses have been implemented: QAnimationTimer to drive the Qt C++
+ animation framework (QAbstractAnimation and subclasses) and QDeclarativeAnimationTimer
+ to drive the Qt QML animation framework.
+*/
+
+/*!
+ \fn virtual void QAbstractAnimationTimer::updateAnimationsTime(qint64 delta) = 0;
+ \internal
+
+ This pure virtual function is called when the animation timer needs to update
+ the current time for all animations it is running.
+*/
+
+/*!
+ \fn virtual void QAbstractAnimationTimer::restartAnimationTimer() = 0;
+ \internal
+
+ This pure virtual function restarts the animation timer as needed.
+
+ Classes implementing this function may choose to pause or resume the timer
+ as appropriate, or conditionally restart it.
+*/
+
+/*!
+ \fn virtual int QAbstractAnimationTimer::runningAnimationCount() = 0;
+ \internal
+
+ This pure virtual function returns the number of animations the timer is running.
+ This information is useful for profiling.
+*/
+
+/*!
+ \class QUnifiedTimer
+ \brief QUnifiedTimer provides a unified timing mechanism for animations in Qt C++ and QML.
+ \internal
+
+ QUnifiedTimer allows animations run by Qt to share a single timer. This keeps animations
+ visually in sync, as well as being more efficient than running numerous timers.
+
+ QUnifiedTimer drives animations indirectly, via QAbstractAnimationTimer.
+*/
+
#ifndef QT_NO_THREAD
Q_GLOBAL_STATIC(QThreadStorage<QUnifiedTimer *>, unifiedTimer)
#endif
QUnifiedTimer::QUnifiedTimer() :
QObject(), defaultDriver(this), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL),
- currentAnimationIdx(0), insideTick(false), consistentTiming(false), slowMode(false),
- slowdownFactor(5.0f), isPauseTimerActive(false), runningLeafAnimations(0), profilerCallback(0)
+ currentAnimationIdx(0), insideTick(false), insideRestart(false), consistentTiming(false), slowMode(false),
+ startTimersPending(false), stopTimerPending(false),
+ slowdownFactor(5.0f), profilerCallback(0)
{
time.invalidate();
driver = &defaultDriver;
@@ -183,7 +234,7 @@ QUnifiedTimer *QUnifiedTimer::instance(bool create)
inst = new QUnifiedTimer;
unifiedTimer()->setLocalData(inst);
} else {
- inst = unifiedTimer()->localData();
+ inst = unifiedTimer() ? unifiedTimer()->localData() : 0;
}
#else
static QUnifiedTimer unifiedTimer;
@@ -197,23 +248,16 @@ QUnifiedTimer *QUnifiedTimer::instance()
return instance(true);
}
-void QUnifiedTimer::ensureTimerUpdate()
-{
- QUnifiedTimer *inst = QUnifiedTimer::instance(false);
- if (inst && inst->isPauseTimerActive)
- inst->updateAnimationsTime(-1);
-}
-
-void QUnifiedTimer::updateAnimationsTime(qint64 timeStep)
+void QUnifiedTimer::updateAnimationTimers(qint64 currentTick)
{
//setCurrentTime can get this called again while we're the for loop. At least with pauseAnimations
if(insideTick)
return;
- qint64 totalElapsed = timeStep >= 0 ? timeStep : time.elapsed();
+ qint64 totalElapsed = currentTick >= 0 ? currentTick : time.elapsed();
// ignore consistentTiming in case the pause timer is active
- int delta = (consistentTiming && !isPauseTimerActive) ?
+ qint64 delta = (consistentTiming && !pauseTimer.isActive()) ?
timingInterval : totalElapsed - lastTick;
if (slowMode) {
if (slowdownFactor > 0)
@@ -229,177 +273,195 @@ void QUnifiedTimer::updateAnimationsTime(qint64 timeStep)
//when the CPU load is high
if (delta) {
insideTick = true;
- for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) {
- QAbstractAnimation *animation = animations.at(currentAnimationIdx);
- int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime
- + (animation->direction() == QAbstractAnimation::Forward ? delta : -delta);
- animation->setCurrentTime(elapsed);
-
- if (profilerCallback)
- profilerCallback(delta);
+ if (profilerCallback)
+ profilerCallback(delta);
+ for (currentAnimationIdx = 0; currentAnimationIdx < animationTimers.count(); ++currentAnimationIdx) {
+ QAbstractAnimationTimer *animation = animationTimers.at(currentAnimationIdx);
+ animation->updateAnimationsTime(delta);
}
insideTick = false;
currentAnimationIdx = 0;
}
}
-void QUnifiedTimer::registerProfilerCallback(void (*cb)(qint64))
+int QUnifiedTimer::runningAnimationCount()
{
- profilerCallback = cb;
+ int count = 0;
+ for (int i = 0; i < animationTimers.count(); ++i)
+ count += animationTimers.at(i)->runningAnimationCount();
+ return count;
}
-void QUnifiedTimer::updateAnimationTimer()
+void QUnifiedTimer::registerProfilerCallback(void (*cb)(qint64))
{
- QUnifiedTimer *inst = QUnifiedTimer::instance(false);
- if (inst)
- inst->restartAnimationTimer();
+ profilerCallback = cb;
}
-void QUnifiedTimer::restartAnimationTimer()
+void QUnifiedTimer::localRestart()
{
- if (runningLeafAnimations == 0 && !runningPauseAnimations.isEmpty()) {
- int closestTimeToFinish = closestPauseAnimationTimeToFinish();
- if (closestTimeToFinish < 0) {
- qDebug() << runningPauseAnimations;
- qDebug() << closestPauseAnimationTimeToFinish();
- }
+ if (insideRestart)
+ return;
+
+ if (!pausedAnimationTimers.isEmpty() && (animationTimers.count() + animationTimersToStart.count() == pausedAnimationTimers.count())) {
driver->stop();
- animationTimer.start(closestTimeToFinish, this);
- isPauseTimerActive = true;
- } else if (!driver->isRunning() || isPauseTimerActive) {
+ int closestTimeToFinish = closestPausedAnimationTimerTimeToFinish();
+ // use a precise timer if the pause will be short
+ Qt::TimerType timerType = closestTimeToFinish < PAUSE_TIMER_COARSE_THRESHOLD ? Qt::PreciseTimer : Qt::CoarseTimer;
+ pauseTimer.start(closestTimeToFinish, timerType, this);
+ } else if (!driver->isRunning()) {
+ if (pauseTimer.isActive())
+ pauseTimer.stop();
driver->start();
- isPauseTimerActive = false;
- } else if (runningLeafAnimations == 0)
- driver->stop();
+ }
+
+}
+
+void QUnifiedTimer::restart()
+{
+ insideRestart = true;
+ for (int i = 0; i < animationTimers.count(); ++i)
+ animationTimers.at(i)->restartAnimationTimer();
+ insideRestart = false;
+
+ localRestart();
}
void QUnifiedTimer::setTimingInterval(int interval)
{
timingInterval = interval;
- if (driver->isRunning() && !isPauseTimerActive) {
+ if (driver->isRunning() && !pauseTimer.isActive()) {
//we changed the timing interval
driver->stop();
driver->start();
}
}
+void QUnifiedTimer::startTimers()
+{
+ startTimersPending = false;
+ if (!animationTimers.isEmpty())
+ updateAnimationTimers(-1);
+
+ //we transfer the waiting animations into the "really running" state
+ animationTimers += animationTimersToStart;
+ animationTimersToStart.clear();
+ if (!animationTimers.isEmpty()) {
+ localRestart();
+ if (!time.isValid()) {
+ lastTick = 0;
+ time.start();
+ }
+ }
+}
+
+void QUnifiedTimer::stopTimer()
+{
+ stopTimerPending = false;
+ if (animationTimers.isEmpty()) {
+ driver->stop();
+ pauseTimer.stop();
+ // invalidate the start reference time
+ time.invalidate();
+ }
+}
void QUnifiedTimer::timerEvent(QTimerEvent *event)
{
- //in the case of consistent timing we make sure the orders in which events come is always the same
- //for that purpose we do as if the startstoptimer would always fire before the animation timer
- if ((consistentTiming && startStopAnimationTimer.isActive()) ||
- event->timerId() == startStopAnimationTimer.timerId()) {
- startStopAnimationTimer.stop();
-
- //we transfer the waiting animations into the "really running" state
- animations += animationsToStart;
- animationsToStart.clear();
- if (animations.isEmpty()) {
- animationTimer.stop();
- isPauseTimerActive = false;
- // invalidate the start reference time
- time.invalidate();
- } else {
- restartAnimationTimer();
- if (!time.isValid()) {
- lastTick = 0;
- time.start();
- }
- }
+ //in the case of consistent timing we make sure the order in which events come is always the same
+ //for that purpose we do as if the startstoptimer would always fire before the animation timer
+ if (consistentTiming) {
+ if (stopTimerPending)
+ stopTimer();
+ if (startTimersPending)
+ startTimers();
}
- if (event->timerId() == animationTimer.timerId()) {
- // update current time on all top level animations
- updateAnimationsTime(-1);
- restartAnimationTimer();
+ if (event->timerId() == pauseTimer.timerId()) {
+ // update current time on all timers
+ updateAnimationTimers(-1);
+ restart();
}
}
-void QUnifiedTimer::registerAnimation(QAbstractAnimation *animation, bool isTopLevel)
+void QUnifiedTimer::startAnimationTimer(QAbstractAnimationTimer *timer)
{
+ if (timer->isRegistered)
+ return;
+ timer->isRegistered = true;
+
QUnifiedTimer *inst = instance(true); //we create the instance if needed
- inst->registerRunningAnimation(animation);
- if (isTopLevel) {
- Q_ASSERT(!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer);
- QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer = true;
- inst->animationsToStart << animation;
- if (!inst->startStopAnimationTimer.isActive())
- inst->startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, inst);
+ inst->animationTimersToStart << timer;
+ if (!inst->startTimersPending) {
+ inst->startTimersPending = true;
+ QMetaObject::invokeMethod(inst, "startTimers", Qt::QueuedConnection);
}
}
-void QUnifiedTimer::unregisterAnimation(QAbstractAnimation *animation)
+void QUnifiedTimer::stopAnimationTimer(QAbstractAnimationTimer *timer)
{
QUnifiedTimer *inst = QUnifiedTimer::instance(false);
if (inst) {
//at this point the unified timer should have been created
//but it might also have been already destroyed in case the application is shutting down
- inst->unregisterRunningAnimation(animation);
-
- if (!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer)
+ if (!timer->isRegistered)
return;
+ timer->isRegistered = false;
- int idx = inst->animations.indexOf(animation);
+ int idx = inst->animationTimers.indexOf(timer);
if (idx != -1) {
- inst->animations.removeAt(idx);
+ inst->animationTimers.removeAt(idx);
// this is needed if we unregister an animation while its running
if (idx <= inst->currentAnimationIdx)
--inst->currentAnimationIdx;
- if (inst->animations.isEmpty() && !inst->startStopAnimationTimer.isActive())
- inst->startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, inst);
+ if (inst->animationTimers.isEmpty() && !inst->stopTimerPending) {
+ inst->stopTimerPending = true;
+ QMetaObject::invokeMethod(inst, "stopTimer", Qt::QueuedConnection);
+ }
} else {
- inst->animationsToStart.removeOne(animation);
+ inst->animationTimersToStart.removeOne(timer);
}
}
- QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer = false;
}
-void QUnifiedTimer::registerRunningAnimation(QAbstractAnimation *animation)
+void QUnifiedTimer::pauseAnimationTimer(QAbstractAnimationTimer *timer, int duration)
{
- if (QAbstractAnimationPrivate::get(animation)->isGroup)
- return;
-
- if (QAbstractAnimationPrivate::get(animation)->isPause) {
- runningPauseAnimations << animation;
- } else
- runningLeafAnimations++;
+ QUnifiedTimer *inst = QUnifiedTimer::instance();
+ if (!timer->isRegistered)
+ inst->startAnimationTimer(timer);
+
+ bool timerWasPaused = timer->isPaused;
+ timer->isPaused = true;
+ timer->pauseDuration = duration;
+ if (!timerWasPaused)
+ inst->pausedAnimationTimers << timer;
+ inst->localRestart();
}
-void QUnifiedTimer::unregisterRunningAnimation(QAbstractAnimation *animation)
+void QUnifiedTimer::resumeAnimationTimer(QAbstractAnimationTimer *timer)
{
- if (QAbstractAnimationPrivate::get(animation)->isGroup)
+ if (!timer->isPaused)
return;
- if (QAbstractAnimationPrivate::get(animation)->isPause)
- runningPauseAnimations.removeOne(animation);
- else
- runningLeafAnimations--;
- Q_ASSERT(runningLeafAnimations >= 0);
+ timer->isPaused = false;
+ QUnifiedTimer *inst = QUnifiedTimer::instance();
+ inst->pausedAnimationTimers.removeOne(timer);
+ inst->localRestart();
}
-int QUnifiedTimer::closestPauseAnimationTimeToFinish()
+int QUnifiedTimer::closestPausedAnimationTimerTimeToFinish()
{
int closestTimeToFinish = INT_MAX;
- for (int i = 0; i < runningPauseAnimations.size(); ++i) {
- QAbstractAnimation *animation = runningPauseAnimations.at(i);
- int timeToFinish;
-
- if (animation->direction() == QAbstractAnimation::Forward)
- timeToFinish = animation->duration() - animation->currentLoopTime();
- else
- timeToFinish = animation->currentLoopTime();
-
+ for (int i = 0; i < pausedAnimationTimers.size(); ++i) {
+ int timeToFinish = pausedAnimationTimers.at(i)->pauseDuration;
if (timeToFinish < closestTimeToFinish)
closestTimeToFinish = timeToFinish;
}
return closestTimeToFinish;
}
-
void QUnifiedTimer::installAnimationDriver(QAnimationDriver *d)
{
if (driver != &defaultDriver) {
@@ -416,7 +478,6 @@ void QUnifiedTimer::installAnimationDriver(QAnimationDriver *d)
}
-
void QUnifiedTimer::uninstallAnimationDriver(QAnimationDriver *d)
{
if (driver != d) {
@@ -441,6 +502,199 @@ bool QUnifiedTimer::canUninstallAnimationDriver(QAnimationDriver *d)
return d == driver && driver != &defaultDriver;
}
+#ifndef QT_NO_THREAD
+Q_GLOBAL_STATIC(QThreadStorage<QAnimationTimer *>, animationTimer)
+#endif
+
+QAnimationTimer::QAnimationTimer() :
+ QAbstractAnimationTimer(), lastTick(0),
+ currentAnimationIdx(0), insideTick(false),
+ startAnimationPending(false), stopTimerPending(false),
+ runningLeafAnimations(0)
+{
+}
+
+QAnimationTimer *QAnimationTimer::instance(bool create)
+{
+ QAnimationTimer *inst;
+#ifndef QT_NO_THREAD
+ if (create && !animationTimer()->hasLocalData()) {
+ inst = new QAnimationTimer;
+ animationTimer()->setLocalData(inst);
+ } else {
+ inst = animationTimer() ? animationTimer()->localData() : 0;
+ }
+#else
+ static QAnimationTimer animationTimer;
+ inst = &animationTimer;
+#endif
+ return inst;
+}
+
+QAnimationTimer *QAnimationTimer::instance()
+{
+ return instance(true);
+}
+
+void QAnimationTimer::ensureTimerUpdate()
+{
+ QAnimationTimer *inst = QAnimationTimer::instance(false);
+ QUnifiedTimer *instU = QUnifiedTimer::instance(false);
+ if (instU && inst && inst->isPaused)
+ instU->updateAnimationTimers(-1);
+}
+
+void QAnimationTimer::updateAnimationsTime(qint64 delta)
+{
+ //setCurrentTime can get this called again while we're the for loop. At least with pauseAnimations
+ if (insideTick)
+ return;
+
+ lastTick += delta;
+
+ //we make sure we only call update time if the time has actually changed
+ //it might happen in some cases that the time doesn't change because events are delayed
+ //when the CPU load is high
+ if (delta) {
+ insideTick = true;
+ for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) {
+ QAbstractAnimation *animation = animations.at(currentAnimationIdx);
+ int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime
+ + (animation->direction() == QAbstractAnimation::Forward ? delta : -delta);
+ animation->setCurrentTime(elapsed);
+ }
+ insideTick = false;
+ currentAnimationIdx = 0;
+ }
+}
+
+void QAnimationTimer::updateAnimationTimer()
+{
+ QAnimationTimer *inst = QAnimationTimer::instance(false);
+ if (inst)
+ inst->restartAnimationTimer();
+}
+
+void QAnimationTimer::restartAnimationTimer()
+{
+ if (runningLeafAnimations == 0 && !runningPauseAnimations.isEmpty())
+ QUnifiedTimer::pauseAnimationTimer(this, closestPauseAnimationTimeToFinish());
+ else if (isPaused)
+ QUnifiedTimer::resumeAnimationTimer(this);
+ else if (!isRegistered)
+ QUnifiedTimer::startAnimationTimer(this);
+}
+
+void QAnimationTimer::startAnimations()
+{
+ startAnimationPending = false;
+ //force timer to update, which prevents large deltas for our newly added animations
+ if (!animations.isEmpty())
+ QUnifiedTimer::instance()->updateAnimationTimers(-1);
+
+ //we transfer the waiting animations into the "really running" state
+ animations += animationsToStart;
+ animationsToStart.clear();
+ if (!animations.isEmpty())
+ restartAnimationTimer();
+}
+
+void QAnimationTimer::stopTimer()
+{
+ stopTimerPending = false;
+ if (animations.isEmpty()) {
+ QUnifiedTimer::resumeAnimationTimer(this);
+ QUnifiedTimer::stopAnimationTimer(this);
+ // invalidate the start reference time
+ lastTick = 0;
+ }
+}
+
+void QAnimationTimer::registerAnimation(QAbstractAnimation *animation, bool isTopLevel)
+{
+ QAnimationTimer *inst = instance(true); //we create the instance if needed
+ inst->registerRunningAnimation(animation);
+ if (isTopLevel) {
+ Q_ASSERT(!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer);
+ QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer = true;
+ inst->animationsToStart << animation;
+ if (!inst->startAnimationPending) {
+ inst->startAnimationPending = true;
+ QMetaObject::invokeMethod(inst, "startAnimations", Qt::QueuedConnection);
+ }
+ }
+}
+
+void QAnimationTimer::unregisterAnimation(QAbstractAnimation *animation)
+{
+ QAnimationTimer *inst = QAnimationTimer::instance(false);
+ if (inst) {
+ //at this point the unified timer should have been created
+ //but it might also have been already destroyed in case the application is shutting down
+
+ inst->unregisterRunningAnimation(animation);
+
+ if (!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer)
+ return;
+
+ int idx = inst->animations.indexOf(animation);
+ if (idx != -1) {
+ inst->animations.removeAt(idx);
+ // this is needed if we unregister an animation while its running
+ if (idx <= inst->currentAnimationIdx)
+ --inst->currentAnimationIdx;
+
+ if (inst->animations.isEmpty() && !inst->stopTimerPending) {
+ inst->stopTimerPending = true;
+ QMetaObject::invokeMethod(inst, "stopTimer", Qt::QueuedConnection);
+ }
+ } else {
+ inst->animationsToStart.removeOne(animation);
+ }
+ }
+ QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer = false;
+}
+
+void QAnimationTimer::registerRunningAnimation(QAbstractAnimation *animation)
+{
+ if (QAbstractAnimationPrivate::get(animation)->isGroup)
+ return;
+
+ if (QAbstractAnimationPrivate::get(animation)->isPause) {
+ runningPauseAnimations << animation;
+ } else
+ runningLeafAnimations++;
+}
+
+void QAnimationTimer::unregisterRunningAnimation(QAbstractAnimation *animation)
+{
+ if (QAbstractAnimationPrivate::get(animation)->isGroup)
+ return;
+
+ if (QAbstractAnimationPrivate::get(animation)->isPause)
+ runningPauseAnimations.removeOne(animation);
+ else
+ runningLeafAnimations--;
+ Q_ASSERT(runningLeafAnimations >= 0);
+}
+
+int QAnimationTimer::closestPauseAnimationTimeToFinish()
+{
+ int closestTimeToFinish = INT_MAX;
+ for (int i = 0; i < runningPauseAnimations.size(); ++i) {
+ QAbstractAnimation *animation = runningPauseAnimations.at(i);
+ int timeToFinish;
+
+ if (animation->direction() == QAbstractAnimation::Forward)
+ timeToFinish = animation->duration() - animation->currentLoopTime();
+ else
+ timeToFinish = animation->currentLoopTime();
+
+ if (timeToFinish < closestTimeToFinish)
+ closestTimeToFinish = timeToFinish;
+ }
+ return closestTimeToFinish;
+}
/*!
\class QAnimationDriver
@@ -486,8 +740,8 @@ void QAnimationDriver::advanceAnimation(qint64 timeStep)
QUnifiedTimer *instance = QUnifiedTimer::instance();
// update current time on all top level animations
- instance->updateAnimationsTime(timeStep);
- instance->restartAnimationTimer();
+ instance->updateAnimationTimers(timeStep);
+ instance->restart();
}
@@ -601,7 +855,8 @@ void QDefaultAnimationDriver::timerEvent(QTimerEvent *e)
void QDefaultAnimationDriver::startTimer()
{
- m_timer.start(m_unified_timer->timingInterval, this);
+ // always use a precise timer to drive animations
+ m_timer.start(m_unified_timer->timingInterval, Qt::PreciseTimer, this);
}
void QDefaultAnimationDriver::stopTimer()
@@ -643,11 +898,11 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState)
bool isTopLevel = !group || group->state() == QAbstractAnimation::Stopped;
if (oldState == QAbstractAnimation::Running) {
if (newState == QAbstractAnimation::Paused && hasRegisteredTimer)
- QUnifiedTimer::ensureTimerUpdate();
+ QAnimationTimer::ensureTimerUpdate();
//the animation, is not running any more
- QUnifiedTimer::unregisterAnimation(q);
+ QAnimationTimer::unregisterAnimation(q);
} else if (newState == QAbstractAnimation::Running) {
- QUnifiedTimer::registerAnimation(q, isTopLevel);
+ QAnimationTimer::registerAnimation(q, isTopLevel);
}
q->updateState(newState, oldState);
@@ -669,7 +924,7 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState)
if (oldState == QAbstractAnimation::Stopped) {
if (isTopLevel) {
// currentTime needs to be updated if pauseTimer is active
- QUnifiedTimer::ensureTimerUpdate();
+ QAnimationTimer::ensureTimerUpdate();
q->setCurrentTime(totalCurrentTime);
}
}
@@ -728,7 +983,7 @@ QAbstractAnimation::~QAbstractAnimation()
d->state = Stopped;
emit stateChanged(oldState, d->state);
if (oldState == QAbstractAnimation::Running)
- QUnifiedTimer::unregisterAnimation(this);
+ QAnimationTimer::unregisterAnimation(this);
}
}
@@ -827,14 +1082,14 @@ void QAbstractAnimation::setDirection(Direction direction)
// the commands order below is important: first we need to setCurrentTime with the old direction,
// then update the direction on this and all children and finally restart the pauseTimer if needed
if (d->hasRegisteredTimer)
- QUnifiedTimer::ensureTimerUpdate();
+ QAnimationTimer::ensureTimerUpdate();
d->direction = direction;
updateDirection(direction);
if (d->hasRegisteredTimer)
// needed to update the timer interval in case of a pause animation
- QUnifiedTimer::updateAnimationTimer();
+ QAnimationTimer::updateAnimationTimer();
emit directionChanged(direction);
}
diff --git a/src/corelib/animation/qabstractanimation.h b/src/corelib/animation/qabstractanimation.h
index 456c017bba..4c20d25a53 100644
--- a/src/corelib/animation/qabstractanimation.h
+++ b/src/corelib/animation/qabstractanimation.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h
index 7e7571bc58..2b2d5b8872 100644
--- a/src/corelib/animation/qabstractanimation_p.h
+++ b/src/corelib/animation/qabstractanimation_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -140,20 +140,36 @@ public:
bool running;
};
-typedef QElapsedTimer ElapsedTimer;
+class Q_CORE_EXPORT QAbstractAnimationTimer : public QObject
+{
+ Q_OBJECT
+public:
+ QAbstractAnimationTimer() : isRegistered(false), isPaused(false), pauseDuration(0) {}
+
+ virtual void updateAnimationsTime(qint64 delta) = 0;
+ virtual void restartAnimationTimer() = 0;
+ virtual int runningAnimationCount() = 0;
+
+ bool isRegistered;
+ bool isPaused;
+ int pauseDuration;
+};
class Q_CORE_EXPORT QUnifiedTimer : public QObject
{
+ Q_OBJECT
private:
QUnifiedTimer();
public:
- //XXX this is needed by dui
static QUnifiedTimer *instance();
static QUnifiedTimer *instance(bool create);
- static void registerAnimation(QAbstractAnimation *animation, bool isTopLevel);
- static void unregisterAnimation(QAbstractAnimation *animation);
+ static void startAnimationTimer(QAbstractAnimationTimer *timer);
+ static void stopAnimationTimer(QAbstractAnimationTimer *timer);
+
+ static void pauseAnimationTimer(QAbstractAnimationTimer *timer, int duration);
+ static void resumeAnimationTimer(QAbstractAnimationTimer *timer);
//defines the timing interval. Default is DEFAULT_TIMER_INTERVAL
void setTimingInterval(int interval);
@@ -168,32 +184,24 @@ public:
void setSlowModeEnabled(bool enabled) { slowMode = enabled; }
void setSlowdownFactor(qreal factor) { slowdownFactor = factor; }
- /*
- this is used for updating the currentTime of all animations in case the pause
- timer is active or, otherwise, only of the animation passed as parameter.
- */
- static void ensureTimerUpdate();
-
- /*
- this will evaluate the need of restarting the pause timer in case there is still
- some pause animations running.
- */
- static void updateAnimationTimer();
-
void installAnimationDriver(QAnimationDriver *driver);
void uninstallAnimationDriver(QAnimationDriver *driver);
bool canUninstallAnimationDriver(QAnimationDriver *driver);
- void restartAnimationTimer();
- void updateAnimationsTime(qint64 timeStep);
+ void restart();
+ void updateAnimationTimers(qint64 currentTick);
//useful for profiling/debugging
- int runningAnimationCount() { return animations.count(); }
+ int runningAnimationCount();
void registerProfilerCallback(void (*cb)(qint64));
protected:
void timerEvent(QTimerEvent *);
+private Q_SLOTS:
+ void startTimers();
+ void stopTimer();
+
private:
friend class QDefaultAnimationDriver;
friend class QAnimationDriver;
@@ -201,26 +209,75 @@ private:
QAnimationDriver *driver;
QDefaultAnimationDriver defaultDriver;
- QBasicTimer animationTimer;
- // timer used to delay the check if we should start/stop the animation timer
- QBasicTimer startStopAnimationTimer;
+ QBasicTimer pauseTimer;
- ElapsedTimer time;
+ QElapsedTimer time;
qint64 lastTick;
int timingInterval;
int currentAnimationIdx;
bool insideTick;
+ bool insideRestart;
bool consistentTiming;
bool slowMode;
+ bool startTimersPending;
+ bool stopTimerPending;
// This factor will be used to divide the DEFAULT_TIMER_INTERVAL at each tick
// when slowMode is enabled. Setting it to 0 or higher than DEFAULT_TIMER_INTERVAL (16)
// stops all animations.
qreal slowdownFactor;
- // bool to indicate that only pause animations are active
- bool isPauseTimerActive;
+ QList<QAbstractAnimationTimer*> animationTimers, animationTimersToStart;
+ QList<QAbstractAnimationTimer*> pausedAnimationTimers;
+
+ void localRestart();
+ int closestPausedAnimationTimerTimeToFinish();
+
+ void (*profilerCallback)(qint64);
+};
+
+class QAnimationTimer : public QAbstractAnimationTimer
+{
+ Q_OBJECT
+private:
+ QAnimationTimer();
+
+public:
+ static QAnimationTimer *instance();
+ static QAnimationTimer *instance(bool create);
+
+ static void registerAnimation(QAbstractAnimation *animation, bool isTopLevel);
+ static void unregisterAnimation(QAbstractAnimation *animation);
+
+ /*
+ this is used for updating the currentTime of all animations in case the pause
+ timer is active or, otherwise, only of the animation passed as parameter.
+ */
+ static void ensureTimerUpdate();
+
+ /*
+ this will evaluate the need of restarting the pause timer in case there is still
+ some pause animations running.
+ */
+ static void updateAnimationTimer();
+
+ void restartAnimationTimer();
+ void updateAnimationsTime(qint64 delta);
+
+ //useful for profiling/debugging
+ int runningAnimationCount() { return animations.count(); }
+
+private Q_SLOTS:
+ void startAnimations();
+ void stopTimer();
+
+private:
+ qint64 lastTick;
+ int currentAnimationIdx;
+ bool insideTick;
+ bool startAnimationPending;
+ bool stopTimerPending;
QList<QAbstractAnimation*> animations, animationsToStart;
@@ -232,8 +289,6 @@ private:
void unregisterRunningAnimation(QAbstractAnimation *animation);
int closestPauseAnimationTimeToFinish();
-
- void (*profilerCallback)(qint64);
};
QT_END_NAMESPACE
diff --git a/src/corelib/animation/qanimationgroup.cpp b/src/corelib/animation/qanimationgroup.cpp
index 0d2eac2ebb..5993eda307 100644
--- a/src/corelib/animation/qanimationgroup.cpp
+++ b/src/corelib/animation/qanimationgroup.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/animation/qanimationgroup.h b/src/corelib/animation/qanimationgroup.h
index 7569671374..69a2686b69 100644
--- a/src/corelib/animation/qanimationgroup.h
+++ b/src/corelib/animation/qanimationgroup.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/animation/qanimationgroup_p.h b/src/corelib/animation/qanimationgroup_p.h
index d2e2498a87..8415610bdc 100644
--- a/src/corelib/animation/qanimationgroup_p.h
+++ b/src/corelib/animation/qanimationgroup_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp
index 6e942e0257..6e21efbc7f 100644
--- a/src/corelib/animation/qparallelanimationgroup.cpp
+++ b/src/corelib/animation/qparallelanimationgroup.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/animation/qparallelanimationgroup.h b/src/corelib/animation/qparallelanimationgroup.h
index 74eb36f4cd..b03163cfbb 100644
--- a/src/corelib/animation/qparallelanimationgroup.h
+++ b/src/corelib/animation/qparallelanimationgroup.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/animation/qparallelanimationgroup_p.h b/src/corelib/animation/qparallelanimationgroup_p.h
index cb8b3ae190..73fed5541c 100644
--- a/src/corelib/animation/qparallelanimationgroup_p.h
+++ b/src/corelib/animation/qparallelanimationgroup_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/animation/qpauseanimation.cpp b/src/corelib/animation/qpauseanimation.cpp
index 0f1e07e1f1..fe5bafa3bd 100644
--- a/src/corelib/animation/qpauseanimation.cpp
+++ b/src/corelib/animation/qpauseanimation.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/animation/qpauseanimation.h b/src/corelib/animation/qpauseanimation.h
index 827f1694ad..7f8a2ddf26 100644
--- a/src/corelib/animation/qpauseanimation.h
+++ b/src/corelib/animation/qpauseanimation.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp
index 481b79d196..d34242739e 100644
--- a/src/corelib/animation/qpropertyanimation.cpp
+++ b/src/corelib/animation/qpropertyanimation.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/animation/qpropertyanimation.h b/src/corelib/animation/qpropertyanimation.h
index 28fc837f33..f41b96ce64 100644
--- a/src/corelib/animation/qpropertyanimation.h
+++ b/src/corelib/animation/qpropertyanimation.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/animation/qpropertyanimation_p.h b/src/corelib/animation/qpropertyanimation_p.h
index c8c69720e9..83f7c3f0fa 100644
--- a/src/corelib/animation/qpropertyanimation_p.h
+++ b/src/corelib/animation/qpropertyanimation_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp
index 8b32d6b76d..a991a38823 100644
--- a/src/corelib/animation/qsequentialanimationgroup.cpp
+++ b/src/corelib/animation/qsequentialanimationgroup.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/animation/qsequentialanimationgroup.h b/src/corelib/animation/qsequentialanimationgroup.h
index 40201a9a32..07b2e3b8fc 100644
--- a/src/corelib/animation/qsequentialanimationgroup.h
+++ b/src/corelib/animation/qsequentialanimationgroup.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/animation/qsequentialanimationgroup_p.h b/src/corelib/animation/qsequentialanimationgroup_p.h
index 33af063bc9..87cdc044b2 100644
--- a/src/corelib/animation/qsequentialanimationgroup_p.h
+++ b/src/corelib/animation/qsequentialanimationgroup_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp
index 7dfb4bddc1..8984abbe03 100644
--- a/src/corelib/animation/qvariantanimation.cpp
+++ b/src/corelib/animation/qvariantanimation.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/animation/qvariantanimation.h b/src/corelib/animation/qvariantanimation.h
index 3c92219b2a..4176b4f428 100644
--- a/src/corelib/animation/qvariantanimation.h
+++ b/src/corelib/animation/qvariantanimation.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/animation/qvariantanimation_p.h b/src/corelib/animation/qvariantanimation_p.h
index a8868d13ce..940cdbfe39 100644
--- a/src/corelib/animation/qvariantanimation_p.h
+++ b/src/corelib/animation/qvariantanimation_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/alpha/qatomic_alpha.s b/src/corelib/arch/alpha/qatomic_alpha.s
index 31f3925499..7dd09d4480 100644
--- a/src/corelib/arch/alpha/qatomic_alpha.s
+++ b/src/corelib/arch/alpha/qatomic_alpha.s
@@ -1,6 +1,6 @@
;/****************************************************************************
;**
-;** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+;** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
;** All rights reserved.
;** Contact: Nokia Corporation (qt-info@nokia.com)
;**
diff --git a/src/corelib/arch/arm/qatomic_arm.cpp b/src/corelib/arch/arm/qatomic_arm.cpp
index 30612cef11..0eaeb5a15b 100644
--- a/src/corelib/arch/arm/qatomic_arm.cpp
+++ b/src/corelib/arch/arm/qatomic_arm.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/generic/qatomic_generic_unix.cpp b/src/corelib/arch/generic/qatomic_generic_unix.cpp
index e474a65642..78292e7e49 100644
--- a/src/corelib/arch/generic/qatomic_generic_unix.cpp
+++ b/src/corelib/arch/generic/qatomic_generic_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/generic/qatomic_generic_windows.cpp b/src/corelib/arch/generic/qatomic_generic_windows.cpp
index 7ce0eea076..94129cb106 100644
--- a/src/corelib/arch/generic/qatomic_generic_windows.cpp
+++ b/src/corelib/arch/generic/qatomic_generic_windows.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/ia64/qatomic_ia64.s b/src/corelib/arch/ia64/qatomic_ia64.s
index 26db10d994..f6b100c170 100644
--- a/src/corelib/arch/ia64/qatomic_ia64.s
+++ b/src/corelib/arch/ia64/qatomic_ia64.s
@@ -1,6 +1,6 @@
;/****************************************************************************
;**
-;** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+;** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
;** All rights reserved.
;** Contact: Nokia Corporation (qt-info@nokia.com)
;**
diff --git a/src/corelib/arch/macosx/qatomic32_ppc.s b/src/corelib/arch/macosx/qatomic32_ppc.s
index edb80473e1..97d68cba70 100644
--- a/src/corelib/arch/macosx/qatomic32_ppc.s
+++ b/src/corelib/arch/macosx/qatomic32_ppc.s
@@ -1,6 +1,6 @@
;/****************************************************************************
;**
-;** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+;** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
;** All rights reserved.
;** Contact: Nokia Corporation (qt-info@nokia.com)
;**
diff --git a/src/corelib/arch/mips/qatomic_mips32.s b/src/corelib/arch/mips/qatomic_mips32.s
index cd1585ecbc..b4013dfff5 100644
--- a/src/corelib/arch/mips/qatomic_mips32.s
+++ b/src/corelib/arch/mips/qatomic_mips32.s
@@ -1,6 +1,6 @@
;/****************************************************************************
;**
-;** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+;** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
;** All rights reserved.
;** Contact: Nokia Corporation (qt-info@nokia.com)
;**
diff --git a/src/corelib/arch/mips/qatomic_mips64.s b/src/corelib/arch/mips/qatomic_mips64.s
index 60c9a83881..a66b785e30 100644
--- a/src/corelib/arch/mips/qatomic_mips64.s
+++ b/src/corelib/arch/mips/qatomic_mips64.s
@@ -1,6 +1,6 @@
;/****************************************************************************
;**
-;** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+;** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
;** All rights reserved.
;** Contact: Nokia Corporation (qt-info@nokia.com)
;**
diff --git a/src/corelib/arch/parisc/q_ldcw.s b/src/corelib/arch/parisc/q_ldcw.s
index 86d50c79a5..0c1db6f394 100644
--- a/src/corelib/arch/parisc/q_ldcw.s
+++ b/src/corelib/arch/parisc/q_ldcw.s
@@ -1,6 +1,6 @@
;/****************************************************************************
;**
-;** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+;** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
;** All rights reserved.
;** Contact: Nokia Corporation (qt-info@nokia.com)
;**
diff --git a/src/corelib/arch/parisc/qatomic_parisc.cpp b/src/corelib/arch/parisc/qatomic_parisc.cpp
index aa2189162c..da8d480a4f 100644
--- a/src/corelib/arch/parisc/qatomic_parisc.cpp
+++ b/src/corelib/arch/parisc/qatomic_parisc.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/powerpc/qatomic32.s b/src/corelib/arch/powerpc/qatomic32.s
index 794a397b77..dfc0605cff 100644
--- a/src/corelib/arch/powerpc/qatomic32.s
+++ b/src/corelib/arch/powerpc/qatomic32.s
@@ -1,6 +1,6 @@
############################################################################
##
-## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
## Contact: Nokia Corporation (qt-info@nokia.com)
##
diff --git a/src/corelib/arch/powerpc/qatomic64.s b/src/corelib/arch/powerpc/qatomic64.s
index 4a10b25012..9e81eb0bc0 100644
--- a/src/corelib/arch/powerpc/qatomic64.s
+++ b/src/corelib/arch/powerpc/qatomic64.s
@@ -1,6 +1,6 @@
############################################################################
##
-## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
## Contact: Nokia Corporation (qt-info@nokia.com)
##
diff --git a/src/corelib/arch/qatomic_alpha.h b/src/corelib/arch/qatomic_alpha.h
index a99a84b32a..b44b9f23f5 100644
--- a/src/corelib/arch/qatomic_alpha.h
+++ b/src/corelib/arch/qatomic_alpha.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_arch.h b/src/corelib/arch/qatomic_arch.h
index 905ccd7d99..66e12cc95b 100644
--- a/src/corelib/arch/qatomic_arch.h
+++ b/src/corelib/arch/qatomic_arch.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_arm.h b/src/corelib/arch/qatomic_arm.h
index 0f27009066..b5856102b2 100644
--- a/src/corelib/arch/qatomic_arm.h
+++ b/src/corelib/arch/qatomic_arm.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_armv5.h b/src/corelib/arch/qatomic_armv5.h
index 2a18042a26..d602e83e64 100644
--- a/src/corelib/arch/qatomic_armv5.h
+++ b/src/corelib/arch/qatomic_armv5.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_armv6.h b/src/corelib/arch/qatomic_armv6.h
index dd465db18b..260f48d563 100644
--- a/src/corelib/arch/qatomic_armv6.h
+++ b/src/corelib/arch/qatomic_armv6.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_armv7.h b/src/corelib/arch/qatomic_armv7.h
index 3554cd4301..814eefb376 100644
--- a/src/corelib/arch/qatomic_armv7.h
+++ b/src/corelib/arch/qatomic_armv7.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_avr32.h b/src/corelib/arch/qatomic_avr32.h
index 78d5fc7dd3..749cc0fd36 100644
--- a/src/corelib/arch/qatomic_avr32.h
+++ b/src/corelib/arch/qatomic_avr32.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_bfin.h b/src/corelib/arch/qatomic_bfin.h
index 21026ee440..4784b634fc 100644
--- a/src/corelib/arch/qatomic_bfin.h
+++ b/src/corelib/arch/qatomic_bfin.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_bootstrap.h b/src/corelib/arch/qatomic_bootstrap.h
index 74dc6cfbb2..86376062a2 100644
--- a/src/corelib/arch/qatomic_bootstrap.h
+++ b/src/corelib/arch/qatomic_bootstrap.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_generic.h b/src/corelib/arch/qatomic_generic.h
index 2565451a41..0abc29cdb0 100644
--- a/src/corelib/arch/qatomic_generic.h
+++ b/src/corelib/arch/qatomic_generic.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_i386.h b/src/corelib/arch/qatomic_i386.h
index 86230054b9..53a81864bf 100644
--- a/src/corelib/arch/qatomic_i386.h
+++ b/src/corelib/arch/qatomic_i386.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_ia64.h b/src/corelib/arch/qatomic_ia64.h
index e3cab66dc6..0782ab3f36 100644
--- a/src/corelib/arch/qatomic_ia64.h
+++ b/src/corelib/arch/qatomic_ia64.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_integrity.h b/src/corelib/arch/qatomic_integrity.h
index f957297769..e83124bf4e 100644
--- a/src/corelib/arch/qatomic_integrity.h
+++ b/src/corelib/arch/qatomic_integrity.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_macosx.h b/src/corelib/arch/qatomic_macosx.h
index e26cf65ecd..a973fe1b57 100644
--- a/src/corelib/arch/qatomic_macosx.h
+++ b/src/corelib/arch/qatomic_macosx.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_mips.h b/src/corelib/arch/qatomic_mips.h
index 8b025adfd5..97cef3c457 100644
--- a/src/corelib/arch/qatomic_mips.h
+++ b/src/corelib/arch/qatomic_mips.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_parisc.h b/src/corelib/arch/qatomic_parisc.h
index 8fbbb2e709..200ca14aee 100644
--- a/src/corelib/arch/qatomic_parisc.h
+++ b/src/corelib/arch/qatomic_parisc.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_powerpc.h b/src/corelib/arch/qatomic_powerpc.h
index c0f957b8ac..bb9afe38d7 100644
--- a/src/corelib/arch/qatomic_powerpc.h
+++ b/src/corelib/arch/qatomic_powerpc.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_s390.h b/src/corelib/arch/qatomic_s390.h
index 079dd2db16..e167c7c6e3 100644
--- a/src/corelib/arch/qatomic_s390.h
+++ b/src/corelib/arch/qatomic_s390.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_sh.h b/src/corelib/arch/qatomic_sh.h
index a764a31c71..ca50eb1bf0 100644
--- a/src/corelib/arch/qatomic_sh.h
+++ b/src/corelib/arch/qatomic_sh.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_sh4a.h b/src/corelib/arch/qatomic_sh4a.h
index 3ca1917863..14238a6f10 100644
--- a/src/corelib/arch/qatomic_sh4a.h
+++ b/src/corelib/arch/qatomic_sh4a.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_sparc.h b/src/corelib/arch/qatomic_sparc.h
index ab4386a675..feb172e68d 100644
--- a/src/corelib/arch/qatomic_sparc.h
+++ b/src/corelib/arch/qatomic_sparc.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_symbian.h b/src/corelib/arch/qatomic_symbian.h
index 0162ebccfd..6cb91f0788 100644
--- a/src/corelib/arch/qatomic_symbian.h
+++ b/src/corelib/arch/qatomic_symbian.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_vxworks.h b/src/corelib/arch/qatomic_vxworks.h
index 706dea6f4f..13d6764d36 100644
--- a/src/corelib/arch/qatomic_vxworks.h
+++ b/src/corelib/arch/qatomic_vxworks.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_windows.h b/src/corelib/arch/qatomic_windows.h
index 4807c69905..667e58124e 100644
--- a/src/corelib/arch/qatomic_windows.h
+++ b/src/corelib/arch/qatomic_windows.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_windowsce.h b/src/corelib/arch/qatomic_windowsce.h
index f58119ebdf..3681655285 100644
--- a/src/corelib/arch/qatomic_windowsce.h
+++ b/src/corelib/arch/qatomic_windowsce.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/qatomic_x86_64.h b/src/corelib/arch/qatomic_x86_64.h
index abbf0a932e..c2627c825f 100644
--- a/src/corelib/arch/qatomic_x86_64.h
+++ b/src/corelib/arch/qatomic_x86_64.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/sh/qatomic_sh.cpp b/src/corelib/arch/sh/qatomic_sh.cpp
index c1f0f332d6..b552392b64 100644
--- a/src/corelib/arch/sh/qatomic_sh.cpp
+++ b/src/corelib/arch/sh/qatomic_sh.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/arch/sparc/qatomic32.s b/src/corelib/arch/sparc/qatomic32.s
index 612093b81c..5f695a9093 100644
--- a/src/corelib/arch/sparc/qatomic32.s
+++ b/src/corelib/arch/sparc/qatomic32.s
@@ -1,6 +1,6 @@
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
-!! Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+!! Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
!! All rights reserved.
!! Contact: Nokia Corporation (qt-info@nokia.com)
!!
diff --git a/src/corelib/arch/sparc/qatomic64.s b/src/corelib/arch/sparc/qatomic64.s
index d78b5b628e..448afbd34e 100644
--- a/src/corelib/arch/sparc/qatomic64.s
+++ b/src/corelib/arch/sparc/qatomic64.s
@@ -1,6 +1,6 @@
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
-!! Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+!! Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
!! All rights reserved.
!! Contact: Nokia Corporation (qt-info@nokia.com)
!!
diff --git a/src/corelib/arch/sparc/qatomic_sparc.cpp b/src/corelib/arch/sparc/qatomic_sparc.cpp
index 71859aeaec..85848d04a0 100644
--- a/src/corelib/arch/sparc/qatomic_sparc.cpp
+++ b/src/corelib/arch/sparc/qatomic_sparc.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri
index 46d7dd46da..96f4d7f111 100644
--- a/src/corelib/codecs/codecs.pri
+++ b/src/corelib/codecs/codecs.pri
@@ -35,7 +35,7 @@ unix {
HEADERS += codecs/qiconvcodec_p.h
SOURCES += codecs/qiconvcodec.cpp
DEFINES += GNU_LIBICONV
- } else:!symbian {
+ } else {
# no iconv, so we put all plugins in the library
HEADERS += \
../plugins/codecs/cn/qgb18030codec.h \
@@ -56,4 +56,3 @@ unix {
../plugins/codecs/jp/qfontjpcodec.cpp
}
}
-symbian:LIBS += -lcharconv
diff --git a/src/corelib/codecs/codecs.qdoc b/src/corelib/codecs/codecs.qdoc
index ff14e67c83..76c3f98b42 100644
--- a/src/corelib/codecs/codecs.qdoc
+++ b/src/corelib/codecs/codecs.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/codecs/qfontlaocodec.cpp b/src/corelib/codecs/qfontlaocodec.cpp
index b852cf576c..ea21fa2898 100644
--- a/src/corelib/codecs/qfontlaocodec.cpp
+++ b/src/corelib/codecs/qfontlaocodec.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/codecs/qfontlaocodec_p.h b/src/corelib/codecs/qfontlaocodec_p.h
index f81ac1d821..c61ac2181b 100644
--- a/src/corelib/codecs/qfontlaocodec_p.h
+++ b/src/corelib/codecs/qfontlaocodec_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp
index fb27f6ddfd..428e7d4bbe 100644
--- a/src/corelib/codecs/qiconvcodec.cpp
+++ b/src/corelib/codecs/qiconvcodec.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/codecs/qiconvcodec_p.h b/src/corelib/codecs/qiconvcodec_p.h
index 5a9742e192..fb2d89eeac 100644
--- a/src/corelib/codecs/qiconvcodec_p.h
+++ b/src/corelib/codecs/qiconvcodec_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/codecs/qisciicodec.cpp b/src/corelib/codecs/qisciicodec.cpp
index e66f424e43..e17b21a507 100644
--- a/src/corelib/codecs/qisciicodec.cpp
+++ b/src/corelib/codecs/qisciicodec.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/codecs/qisciicodec_p.h b/src/corelib/codecs/qisciicodec_p.h
index 9ae450b848..d529be1215 100644
--- a/src/corelib/codecs/qisciicodec_p.h
+++ b/src/corelib/codecs/qisciicodec_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/codecs/qlatincodec.cpp b/src/corelib/codecs/qlatincodec.cpp
index 3c69ab0dd7..d95fcfc601 100644
--- a/src/corelib/codecs/qlatincodec.cpp
+++ b/src/corelib/codecs/qlatincodec.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/codecs/qlatincodec_p.h b/src/corelib/codecs/qlatincodec_p.h
index f7930e72f6..71eded6d08 100644
--- a/src/corelib/codecs/qlatincodec_p.h
+++ b/src/corelib/codecs/qlatincodec_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/codecs/qsimplecodec.cpp b/src/corelib/codecs/qsimplecodec.cpp
index d24b4d4cfd..757351f196 100644
--- a/src/corelib/codecs/qsimplecodec.cpp
+++ b/src/corelib/codecs/qsimplecodec.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -54,7 +54,6 @@ static const struct {
int mib;
quint16 values[128];
} unicodevalues[QSimpleTextCodec::numSimpleCodecs] = {
-#ifndef Q_OS_SYMBIAN
// from RFC 1489, ftp://ftp.isi.edu/in-notes/rfc1489.txt
{ "KOI8-R", { "csKOI8R", 0 }, 2084,
{ 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524,
@@ -289,7 +288,6 @@ static const struct {
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
0x0175, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x1E6B,
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x0177, 0x00FF} },
-#endif
{ "ISO-8859-16", { "iso-ir-226", "latin10", 0 }, 112,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
@@ -311,7 +309,6 @@ static const struct {
// next bits generated again from tables on the Unicode 3.0 CD.
// $ for a in CP* ; do (awk '/^0x[89ABCDEF]/{ print $1, $2 }' < $a) | sort | sed -e 's/#UNDEF.*$/0xFFFD/' | cut -c6- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/$a ; done
-#ifndef Q_OS_SYMBIAN
{ "IBM850", { "CP850", "csPC850Multilingual", 0 }, 2009,
{ 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7,
0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
@@ -346,7 +343,6 @@ static const struct {
0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F,
0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57,
0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} },
-#endif //Q_OS_SYMBIAN
{ "IBM866", { "CP866", "csIBM866", 0 }, 2086,
{ 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
@@ -365,7 +361,6 @@ static const struct {
0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040E, 0x045E,
0x00B0, 0x2219, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0} },
-#ifndef Q_OS_SYMBIAN
{ "windows-1250", { "CP1250", 0 }, 2250,
{ 0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021,
0xFFFD, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179,
@@ -520,7 +515,6 @@ static const struct {
0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7,
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF} },
-#endif
{ "Apple Roman", { "macintosh", "MacRoman", 0 }, -168,
{ 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1,
0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8,
@@ -560,7 +554,6 @@ static const struct {
0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF} },
-#ifndef Q_OS_SYMBIAN
// this one is generated from the charmap file located in /usr/share/i18n/charmaps
// on most Linux distributions. The thai character set tis620 is byte by byte equivalent
// to iso8859-11, so we name it 8859-11 here, but recognise the name tis620 too.
@@ -584,7 +577,6 @@ static const struct {
0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57,
0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD } },
-#endif
/*
Name: hp-roman8 [HP-PCL5,RFC1345,KXS2]
MIBenum: 2004
diff --git a/src/corelib/codecs/qsimplecodec_p.h b/src/corelib/codecs/qsimplecodec_p.h
index fc28c97c67..6d0ceb3c95 100644
--- a/src/corelib/codecs/qsimplecodec_p.h
+++ b/src/corelib/codecs/qsimplecodec_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -64,11 +64,7 @@ template <typename T> class QAtomicPointer;
class QSimpleTextCodec: public QTextCodec
{
public:
-#ifdef Q_OS_SYMBIAN
- enum { numSimpleCodecs = 5 };
-#else
enum { numSimpleCodecs = 30 };
-#endif
explicit QSimpleTextCodec(int);
~QSimpleTextCodec();
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 42fac98a71..465caea62f 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -64,7 +64,7 @@
#ifndef QT_NO_CODECS
# include "qtsciicodec_p.h"
# include "qisciicodec_p.h"
-#if !defined(Q_OS_SYMBIAN) && !defined(Q_OS_INTEGRITY)
+#if !defined(Q_OS_INTEGRITY)
# if defined(QT_NO_ICONV) && !defined(QT_BOOTSTRAPPED)
// no iconv(3) support, must build all codecs into the library
# include "../../plugins/codecs/cn/qgb18030codec.h"
@@ -78,7 +78,7 @@
# include "qfontlaocodec_p.h"
# include "../../plugins/codecs/jp/qfontjpcodec.h"
# endif
-#endif // QT_NO_SYMBIAN
+#endif // !Q_OS_INTEGRITY
#endif // QT_NO_CODECS
#include "qlocale.h"
#include "qmutex.h"
@@ -95,10 +95,6 @@
# define QT_NO_SETLOCALE
#endif
-#ifdef Q_OS_SYMBIAN
-#include "qtextcodec_symbian.cpp"
-#endif
-
// enabling this is not exception safe!
// #define Q_DEBUG_TEXTCODEC
@@ -231,14 +227,7 @@ Q_GLOBAL_STATIC(QTextCodecCleanup, createQTextCodecCleanup)
bool QTextCodec::validCodecs()
{
-#ifdef Q_OS_SYMBIAN
- // If we don't have a trap handler, we're outside of the main() function,
- // ie. in global constructors or destructors. Don't use codecs in this
- // case as it would lead to crashes because we don't have a cleanup stack on Symbian
- return (User::TrapHandler() != NULL);
-#else
return true;
-#endif
}
@@ -588,12 +577,6 @@ static QTextCodec *checkForCodec(const QByteArray &name) {
*/
static void setupLocaleMapper()
{
-#ifdef Q_OS_SYMBIAN
- localeMapper = QSymbianTextCodec::localeMapper;
- if (localeMapper)
- return;
-#endif
-
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
localeMapper = QTextCodec::codecForName("System");
#else
@@ -728,14 +711,6 @@ static void setup()
if (all)
return;
-#ifdef Q_OS_SYMBIAN
- // If we don't have a trap handler, we're outside of the main() function,
- // ie. in global constructors or destructors. Don't create codecs in this
- // case as it would lead to crashes because of a missing cleanup stack on Symbian
- if (User::TrapHandler() == NULL)
- return;
-#endif
-
#ifdef Q_DEBUG_TEXTCODEC
if (destroying_is_ok)
qWarning("QTextCodec: Creating new codec during codec cleanup");
@@ -752,10 +727,6 @@ static void setup()
for (int i = 0; i < QSimpleTextCodec::numSimpleCodecs; ++i)
(void)new QSimpleTextCodec(i);
-#ifdef Q_OS_SYMBIAN
- localeMapper = QSymbianTextCodec::init();
-#endif
-
# if defined(Q_OS_UNIX) && !defined(QT_BOOTSTRAPPED)
// no font codecs when bootstrapping
(void)new QFontLaoCodec;
@@ -773,7 +744,7 @@ static void setup()
# endif // Q_OS_UNIX
-#if !defined(Q_OS_SYMBIAN) && !defined(Q_OS_INTEGRITY)
+#if !defined(Q_OS_INTEGRITY)
# if defined(QT_NO_ICONV) && !defined(QT_BOOTSTRAPPED)
// no asian codecs when bootstrapping, sorry
(void)new QGb18030Codec;
@@ -787,7 +758,7 @@ static void setup()
(void)new QBig5Codec;
(void)new QBig5hkscsCodec;
# endif // QT_NO_ICONV && !QT_BOOTSTRAPPED
-#endif //Q_OS_SYMBIAN
+#endif // !Q_OS_INTEGRITY
#endif // QT_NO_CODECS
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
@@ -800,13 +771,11 @@ static void setup()
(void)new QUtf32Codec;
(void)new QUtf32BECodec;
(void)new QUtf32LECodec;
-#ifndef Q_OS_SYMBIAN
(void)new QLatin15Codec;
-#endif
(void)new QLatin1Codec;
(void)new QUtf8Codec;
-#if !defined(Q_OS_SYMBIAN) && !defined(Q_OS_INTEGRITY)
+#if !defined(Q_OS_INTEGRITY)
#if defined(Q_OS_UNIX) && !defined(QT_NO_ICONV) && !defined(QT_BOOTSTRAPPED)
// QIconvCodec depends on the UTF-16 codec, so it needs to be created last
(void) new QIconvCodec();
@@ -842,7 +811,7 @@ QTextCodec::ConverterState::~ConverterState()
if (flags & FreeFunction)
(QTextCodecUnalignedPointer::decode(state_data))(this);
else if (d)
- qFree(d);
+ free(d);
}
/*!
@@ -1315,17 +1284,6 @@ QList<QByteArray> QTextCodec::aliases() const
*/
/*!
- Creates a QTextDecoder which stores enough state to decode chunks
- of \c{char *} data to create chunks of Unicode data.
-
- The caller is responsible for deleting the returned object.
-*/
-QTextDecoder* QTextCodec::makeDecoder() const
-{
- return new QTextDecoder(this);
-}
-
-/*!
Creates a QTextDecoder with a specified \a flags to decode chunks
of \c{char *} data to create chunks of Unicode data.
@@ -1338,18 +1296,6 @@ QTextDecoder* QTextCodec::makeDecoder(QTextCodec::ConversionFlags flags) const
return new QTextDecoder(this, flags);
}
-
-/*!
- Creates a QTextEncoder which stores enough state to encode chunks
- of Unicode data as \c{char *} data.
-
- The caller is responsible for deleting the returned object.
-*/
-QTextEncoder* QTextCodec::makeEncoder() const
-{
- return new QTextEncoder(this);
-}
-
/*!
Creates a QTextEncoder with a specified \a flags to encode chunks
of Unicode data as \c{char *} data.
diff --git a/src/corelib/codecs/qtextcodec.h b/src/corelib/codecs/qtextcodec.h
index 015c0941f2..c4f1a09726 100644
--- a/src/corelib/codecs/qtextcodec.h
+++ b/src/corelib/codecs/qtextcodec.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -117,11 +117,8 @@ public:
QByteArray fromUnicode(const QChar *in, int length, ConverterState *state = 0) const
{ return convertFromUnicode(in, length, state); }
- // ### Qt 5: merge these functions.
- QTextDecoder* makeDecoder() const;
- QTextDecoder* makeDecoder(ConversionFlags flags) const;
- QTextEncoder* makeEncoder() const;
- QTextEncoder* makeEncoder(ConversionFlags flags) const;
+ QTextDecoder* makeDecoder(ConversionFlags flags = DefaultConversion) const;
+ QTextEncoder* makeEncoder(ConversionFlags flags = DefaultConversion) const;
virtual QByteArray name() const = 0;
virtual QList<QByteArray> aliases() const;
diff --git a/src/corelib/codecs/qtextcodec_p.h b/src/corelib/codecs/qtextcodec_p.h
index ed09c4d1ac..03d9d3dfaf 100644
--- a/src/corelib/codecs/qtextcodec_p.h
+++ b/src/corelib/codecs/qtextcodec_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/codecs/qtextcodec_symbian.cpp b/src/corelib/codecs/qtextcodec_symbian.cpp
deleted file mode 100644
index c8a7357edc..0000000000
--- a/src/corelib/codecs/qtextcodec_symbian.cpp
+++ /dev/null
@@ -1,689 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qtextcodec_p.h"
-
-#include <private/qcore_symbian_p.h>
-#include <QThreadStorage>
-#include <QScopedPointer>
-
-#include <charconv.h>
-
-struct QSymbianCodecInitData {
- uint charsetId;
- int mib;
- const char *aliases;
-};
-
-/* This table contains the known Symbian codecs aliases.
- It is required because symbian does not provide aliases for codecs.
- It is also faster to have a name here than asking the system.
- It is ordered by charsetId to allow binary search lookup
- */
-static const QSymbianCodecInitData codecsData[] = {
- { /*268439485*/ KCharacterSetIdentifierShiftJis, 17, "Shift_JIS\0MS_Kanji\0csShiftJIS\0SJIS\0" },
- { /*268439486*/ KCharacterSetIdentifierGb2312, 57, "GB2312\0csGB2312\0CN-GB\0EUC-CN\0" }, // Note: ConvertCharacterSetIdentifierToMibEnumL returns Mib 0 instaead of 57
- { /*268439487*/ KCharacterSetIdentifierBig5, 2026, "Big5\0csBig5\0Big5-ETen\0CP950\0BIG-FIVE\0CN-BIG5\0" },
- { /*268440246*/ KCharacterSetIdentifierCodePage1252, 2252, "windows-1252\0Code Page 1252\0CP1252\0MS-ANSI\0" },
-// { /*268450576*/ KCharacterSetIdentifierIso88591, 4, "ISO-8859-1\0ISO_8859-1:1987\0iso-ir-100\0ISO_8859-1\0latin1\0l1\0IBM819\0CP819\0csISOLatin1\0ISO-IR-100\0ISO8859-1\0L1\0LATIN1\0CSISOLATIN1\0" },
- { /*268451531*/ KCharacterSetIdentifierGbk, 113, "GBK\0MS936\0windows-936\0CP936\0" },
- { /*268451866*/ KCharacterSetIdentifierGb12345, 0, "GB12345\0" },
- { /*268455110*/ KCharacterSetIdentifierAscii, 3, "US-ASCII\0ANSI_X3.4-1968\0iso-ir-6\0ANSI_X3.4-1986\0ISO_646.irv:1991\0ASCII\0ISO646-US\0us\0IBM367\0cp367\0csASCII\0ISO-IR-6\0ISO_646.IRV:1991\0"},
- { /*268456062*/ KCharacterSetIdentifierIso88592, 5, "ISO-8859-2\0ISO_8859-2:1987\0iso-ir-101\0latin2\0l2\0csISOLatin2\0" },
- { /*268456063*/ KCharacterSetIdentifierIso88594, 7, "ISO-8859-4\0ISO_8859-4:1988\0iso-ir-110\0latin4\0l4\0csISOLatin4\0" },
- { /*268456064*/ KCharacterSetIdentifierIso88595, 8, "ISO-8859-5\0ISO_8859-5:1988\0iso-ir-144\0cyrillic\0csISOLatinCyrillic\0" },
- { /*268456065*/ KCharacterSetIdentifierIso88597, 10, "ISO-8859-7\0ISO_8859-7:1987\0iso-ir-126\0ELOT_928\0ECMA-118\0greek\0greek8\0csISOLatinGreek\0" },
- { /*268456066*/ KCharacterSetIdentifierIso88599, 12, "ISO-8859-9\0ISO_8859-9:1989\0iso-ir-148\0latin5\0l5\0csISOLatin5\0" },
- { /*268456875*/ KCharacterSetIdentifierSms7Bit, 0, "SMS 7-bit\0" },
- { /*268458028*/ KCharacterSetIdentifierUtf7, 103, "UTF-7\0UNICODE-1-1-UTF-7\0CSUNICODE11UTF7\0" },
-// { /*268458029*/ KCharacterSetIdentifierUtf8, 106, "UTF-8\0" },
- { /*268458030*/ KCharacterSetIdentifierImapUtf7, 0, "IMAP UTF-7\0" },
- { /*268458031*/ KCharacterSetIdentifierJavaConformantUtf8, 0, "JAVA UTF-8\0" },
- { /*268458454*/ 268458454, 2250, "Windows-1250\0CP1250\0MS-EE\0" },
- { /*268458455*/ 268458455, 2251, "Windows-1251\0CP1251\0MS-CYRL\0" },
- { /*268458456*/ 268458456, 2253, "Windows-1253\0CP1253\0MS-GREEK\0" },
- { /*268458457*/ 268458457, 2254, "Windows-1254\0CP1254\0MS-TURK\0" },
- { /*268458458*/ 268458458, 2257, "Windows-1257\0CP1257\0WINBALTRIM\0" },
- { /*268460133*/ KCharacterSetIdentifierHz, 2085, "HZ-GB-2312\0HZ\0" },
- { /*268460134*/ KCharacterSetIdentifierJis, 16, "JIS_Encoding\0JIS\0" },
- { /*268460135*/ KCharacterSetIdentifierEucJpPacked, 18, "EUC-JP\0Extended_UNIX_Code_Packed_Format_for_Japanese\0csEUCPkdFmtJapanese\0EUCJP_PACKED\0" },
- { /*268461728*/ KCharacterSetIdentifierIso2022Jp, 39, "ISO-2022-JP\0csISO2022JP\0JIS7\0" },
- { /*268461731*/ KCharacterSetIdentifierIso2022Jp1, 0, "ISO2022JP1\0" },
- { /*268470824*/ KCharacterSetIdentifierIso88593, 6, "ISO-8859-3\0ISO_8859-3:1988\0iso-ir-109\0latin3\0l3\0csISOLatin3\0" },
- { /*268470825*/ KCharacterSetIdentifierIso88596, 9, "ISO-8859-6\0ISO_8859-6:1987\0iso-ir-127\0ECMA-114\0ASMO-708\0arabic\0ISO88596\0csISOLatinArabic\0ARABIC\0" },
- { /*268470826*/ KCharacterSetIdentifierIso88598, 11, "ISO-8859-8\0ISO_8859-8:1988\0iso-ir-138\0hebrew\0csISOLatinHebrew\0" },
- { /*268470827*/ KCharacterSetIdentifierIso885910, 13, "ISO-8859-10\0iso-ir-157\0l6\0ISO_8859-10:1992\0csISOLatin6\0latin6\0" },
- { /*268470828*/ KCharacterSetIdentifierIso885913, 109, "ISO-8859-13\0ISO885913\0ISO-IR-179\0ISO8859-13\0L7\0LATIN7\0CSISOLATIN7\0" },
- { /*268470829*/ KCharacterSetIdentifierIso885914, 110, "ISO-8859-14\0iso-ir-199\0ISO_8859-14:1998\0latin8\0iso-celtic\0l8\0" },
- { /*268470830*/ KCharacterSetIdentifierIso885915, 111, "ISO-8859-15\0latin-9\0ISO-IR-203\0" },
-// { /*270483374*/ KCharacterSetIdentifierUnicodeLittle, 1014, "UTF-16LE\0Little-Endian UNICODE\0" },
-// { /*270483538*/ KCharacterSetIdentifierUnicodeBig, 1013, "UTF-16BE\0Big-Endian UNICODE\0" },
- { /*270501191*/ 270501191, 2255, "Windows-1255\0CP1255\0MS-HEBR\0" },
- { /*270501192*/ 270501192, 2256, "Windows-1256\0CP1256\0MS-ARAB\0" },
- { /*270501193*/ 270501193, 2259, "TIS-620\0ISO-IR-166\0TIS620-0\0TIS620.2529-1\0TIS620.2533-0\0TIS620.2533-1\0" },
- { /*270501194*/ 270501194, 0, "windows-874\0CP874\0IBM874\0" },
- { /*270501325*/ 270501325, 0, "SmsStrict\0" },
- { /*270501521*/ 270501521, 0, "ShiftJisDirectmap\0" },
- { /*270501542*/ 270501542, 0, "EucJpDirectmap\0" },
- /* 270501691 (duplicate) Windows-1252 | windows-1252 |Windows-1252 |Code Page 1252 |CP1252 |MS-ANSI |WINDOWS-1252 |2252 */
- { /*270501729*/ 270501729, 2088, "KOI8-U\0" },
- { /*270501752*/ 270501752, 2084, "KOI8-R\0csKOI8R\0" },
- { /*270529682*/ 270529682, 1000, "ISO-10646-UCS-2\0UCS-2\0CSUNICODE\0" },
- { /*270562232*/ 270562232, 2258, "Windows-1258\0CP1258\0WINDOWS-1258\0" },
- { /*270586888*/ 270586888, 0, "J5\0" },
- { /*271011982*/ 271011982, 0, "ISCII\0" },
- { /*271066541*/ 271066541, 2009, "CP850\0IBM850\0""850\0csPC850Multilingual\0" }, // Note: ConvertCharacterSetIdentifierToMibEnumL returns Mib 0 instead of 2009
- { /*271082493*/ 271082493, 0, "EXTENDED_SMS_7BIT\0" },
- { /*271082494*/ 271082494, 0, "gsm7_turkish_single\0" },
- { /*271082495*/ 271082495, 0, "turkish_locking_gsm7ext\0" },
- { /*271082496*/ 271082496, 0, "turkish_locking_single\0" },
- { /*271082503*/ 271082503, 0, "portuguese_gsm7_single\0" },
- { /*271082504*/ 271082504, 0, "portuguese_locking_gsm7ext\0" },
- { /*271082505*/ 271082505, 0, "portuguese_locking_single\0" },
- { /*271082506*/ 271082506, 0, "spanish_gsm7_single\0" },
- { /*271085624*/ 271085624, 114, "GB18030\0" },
- { /*536929574*/ 536929574, 38, "EUC-KR\0" },
- { /*536936703*/ 536936703, 0, "CP949\0" },
- { /*536936705*/ 536936705, 37, "ISO-2022-KR\0csISO2022KR\0" },
- { /*536941517*/ 536941517, 36, "KS_C_5601-1987\0iso-ir-149\0KS_C_5601-1989\0KSC_5601\0Korean\0csKSC56011987\0" }
- };
-
-
-class QSymbianTextCodec : public QTextCodec
-{
-public:
- QString convertToUnicode(const char*, int, ConverterState*) const;
- QByteArray convertFromUnicode(const QChar*, int, ConverterState*) const;
- QList<QByteArray> aliases() const;
- QByteArray name() const;
- int mibEnum() const;
-
- explicit QSymbianTextCodec(uint charsetId, int staticIndex = -1) : m_charsetId(charsetId), m_staticIndex(staticIndex) { }
-
- static QSymbianTextCodec *init();
- static QSymbianTextCodec *localeMapper;
-private:
- static CCnvCharacterSetConverter *converter();
- static uint getLanguageDependentCharacterSet();
- uint m_charsetId;
- int m_staticIndex;
-};
-
-QSymbianTextCodec *QSymbianTextCodec::localeMapper = 0;
-
-class QSymbianTextCodecWithName : public QSymbianTextCodec
-{
-public:
- QSymbianTextCodecWithName(uint charsetId, const QByteArray &name)
- : QSymbianTextCodec(charsetId) , m_name(name) { }
- QByteArray name() const { return m_name; }
- QList<QByteArray> aliases() const { return QList<QByteArray>(); }
-private:
- QByteArray m_name;
-};
-
-Q_GLOBAL_STATIC(QThreadStorage<CCnvCharacterSetConverter *>,gs_converterStore);
-
-CCnvCharacterSetConverter *QSymbianTextCodec::converter()
-{
- CCnvCharacterSetConverter *&conv = gs_converterStore()->localData();
- if (!conv)
- QT_TRAP_THROWING(conv = CCnvCharacterSetConverter::NewL())
- return conv;
-}
-
-
-QByteArray QSymbianTextCodec::name() const
-{
- if (m_staticIndex >= 0)
- return QByteArray(codecsData[m_staticIndex].aliases);
- QScopedPointer<HBufC8> buf;
- QT_TRAP_THROWING(buf.reset(converter()->ConvertCharacterSetIdentifierToStandardNameL(m_charsetId, qt_s60GetRFs())))
- if (buf)
- return QByteArray(reinterpret_cast<const char *>(buf->Ptr()), buf->Length());
- return QByteArray();
-}
-
-int QSymbianTextCodec::mibEnum() const
-{
- if (m_staticIndex >= 0)
- return codecsData[m_staticIndex].mib;
- int mib;
- QT_TRAP_THROWING(mib = converter()->ConvertCharacterSetIdentifierToMibEnumL(m_charsetId, qt_s60GetRFs()))
- return mib;
-}
-
-QList<QByteArray> QSymbianTextCodec::aliases() const
-{
- QList<QByteArray> result;
- if (m_staticIndex >= 0) {
- const char *aliases = codecsData[m_staticIndex].aliases;
- aliases += strlen(aliases) + 1;
- while (*aliases) {
- int len = strlen(aliases);
- result += QByteArray(aliases, len);
- aliases += len + 1;
- }
- }
- return result;
-}
-
-
-QString QSymbianTextCodec::convertToUnicode(const char *str, int len, ConverterState *state) const
-{
- uint charsetId = m_charsetId;
-
- // no support for utf7 with state
- if (state && (charsetId == KCharacterSetIdentifierUtf7 ||
- charsetId == KCharacterSetIdentifierImapUtf7)) {
- return QString();
- }
- CCnvCharacterSetConverter *converter = QSymbianTextCodec::converter();
- if (!str) {
- return QString();
- }
-
- //Search the character set array containing all of the character sets for which conversion is available
- CCnvCharacterSetConverter::TAvailability av;
- QT_TRAP_THROWING(av = converter->PrepareToConvertToOrFromL(charsetId, qt_s60GetRFs()))
- if (av == CCnvCharacterSetConverter::ENotAvailable) {
- return QString();
- }
-
- char *str2;
- int len2;
- QByteArray helperBA;
- if (state && (state->remainingChars > 0)) {
- // we should prepare the input string ourselves
- // the real size
- len2 = len + state->remainingChars;
- helperBA.resize(len2);
- str2 = helperBA.data();
- if (state->remainingChars > 3) { // doesn't happen usually
- memcpy(str2, state->d, state->remainingChars);
- qFree(state->d);
- state->d = 0;
- } else {
- char charTbl[3];
- charTbl[0] = state->state_data[0];
- charTbl[1] = state->state_data[1];
- charTbl[2] = state->state_data[2];
- memcpy(str2, charTbl, state->remainingChars);
- }
- memcpy(str2+state->remainingChars, str, len);
- }
- else {
- len2 = len;
- str2 = const_cast<char*>(str);
- }
-
- QString UnicodeText(len2, Qt::Uninitialized);
- TPtrC8 remainderOfForeignText;
- remainderOfForeignText.Set(reinterpret_cast<const unsigned char *>(str2), len2);
-
- int numberOfUnconvertibleCharacters = 0;
- int indexOfFirstUnconvertibleCharacter;
-
- // Use null character as replacement, if it is asked
- bool convertToNull = (state && (state->flags & QTextCodec::ConvertInvalidToNull));
- if (convertToNull) {
- _LIT8(KReplacement, "\x00");
- QT_TRAP_THROWING(converter->SetReplacementForUnconvertibleUnicodeCharactersL(KReplacement))
- }
- // use state->invalidChars for keeping symbian state
- int sState = CCnvCharacterSetConverter::KStateDefault;
- if (state && (state->invalidChars != CCnvCharacterSetConverter::KStateDefault)) {
- sState = state->invalidChars;
- }
- //Convert text encoded in a non-Unicode character set into the Unicode character set (UCS-2).
- int remainingChars = -1;
- int initial_size=0;
- while (1) {
- TPtr16 UnicodePtr(reinterpret_cast<unsigned short *>(UnicodeText.data()+initial_size), UnicodeText.size());
- QT_TRAP_THROWING(remainingChars = converter->ConvertToUnicode(UnicodePtr,
- remainderOfForeignText,
- sState,
- numberOfUnconvertibleCharacters,
- indexOfFirstUnconvertibleCharacter))
-
- initial_size += UnicodePtr.Length();
- // replace 0xFFFD with 0x0000 and only if state set to convert to it
- if (numberOfUnconvertibleCharacters>0 && convertToNull) {
- int len2 = UnicodePtr.Length();
- for (int i = indexOfFirstUnconvertibleCharacter; i < len2; i++) {
- UnicodePtr[i] = 0x0000;
- }
- }
- // success
- if (remainingChars==KErrNone) {
- break;
- }
- // if ConvertToUnicode could not consume the foreign text at all
- // UTF-8: EErrorIllFormedInput = KErrCorrupt
- // UCS-2: KErrNotFound
- if (remainingChars == CCnvCharacterSetConverter::EErrorIllFormedInput ||
- remainingChars == KErrNotFound) {
- remainingChars = remainderOfForeignText.Size();
- break;
- }
- else {
- if (remainingChars < 0) {
- return QString();
- }
- }
- //
- UnicodeText.resize(UnicodeText.size() + remainingChars*2);
- remainderOfForeignText.Set(reinterpret_cast<const unsigned char *>(str2+len2-remainingChars), remainingChars);
- }
- // save symbian state
- if (state) {
- state->invalidChars = sState;
- }
-
- if (remainingChars > 0) {
- if (!state) {
- // No way to signal, if there is still remaining chars, for ex. UTF-8 still can have
- // some characters hanging around.
- return QString();
- }
- const unsigned char *charPtr = remainderOfForeignText.Right(remainingChars).Ptr();
- if (remainingChars > 3) { // doesn't happen usually
- state->d = (void*)qMalloc(remainingChars);
- if (!state->d)
- return QString();
- // copy characters there
- memcpy(state->d, charPtr, remainingChars);
- }
- else {
- // fallthru is correct
- switch (remainingChars) {
- case 3:
- state->state_data[2] = charPtr[2];
- case 2:
- state->state_data[1] = charPtr[1];
- case 1:
- state->state_data[0] = charPtr[0];
- }
- }
- state->remainingChars = remainingChars;
- }
- else {
- if (state) {
- // If we continued from an earlier iteration
- state->remainingChars = 0;
- }
- }
- // check if any ORIGINAL headers should be left
- if (initial_size > 0) {
- if (!state || (state && !(state->flags & QTextCodec::IgnoreHeader))) {
- // always skip headers on following state loops
- if (state) {
- state->flags |= QTextCodec::IgnoreHeader;
- }
- const TUint16 *ptr = reinterpret_cast<const TUint16 *>(UnicodeText.data());
- if (ptr[0] == QChar::ByteOrderMark || ptr[0] == QChar::ByteOrderSwapped) {
- return UnicodeText.mid(1, initial_size - 1);
- }
- }
- }
- if (initial_size >= 0) {
- UnicodeText.resize(initial_size);
- return UnicodeText;
- }
- else {
- return QString();
- }
-}
-
-
-QByteArray QSymbianTextCodec::convertFromUnicode(const QChar *str, int len, ConverterState *state) const
-{
- uint charsetId = m_charsetId;
- CCnvCharacterSetConverter *converter = QSymbianTextCodec::converter();
- if (!str)
- return QByteArray();
-
- if (len == 0)
- return QByteArray();
-
- // no support for utf7 with state
- if (state && (charsetId == KCharacterSetIdentifierUtf7 ||
- charsetId == KCharacterSetIdentifierImapUtf7))
- return QByteArray();
-
- //Get reference file session from backend
- RFs &fileSession = qt_s60GetRFs();
-
- //Search the character set array containing all of the character sets for which conversion is available
- CCnvCharacterSetConverter::TAvailability av = CCnvCharacterSetConverter::ENotAvailable;
- QT_TRAP_THROWING(av = converter->PrepareToConvertToOrFromL(charsetId, fileSession))
- if (av == CCnvCharacterSetConverter::ENotAvailable)
- return QByteArray();
-
- // Use null character as replacement, if it is asked
- if (state && (state->flags & QTextCodec::ConvertInvalidToNull)) {
- _LIT8(KReplacement, "\x00");
- QT_TRAP_THROWING(converter->SetReplacementForUnconvertibleUnicodeCharactersL(KReplacement))
- }
- else {
- _LIT8(KReplacement, "?");
- QT_TRAP_THROWING(converter->SetReplacementForUnconvertibleUnicodeCharactersL(KReplacement))
- }
- QByteArray outputBuffer;
-
- // add header if no state (one run), or if no ignoreheader (from first state)
- int bomofs = 0;
- if (!state || (state && !(state->flags & QTextCodec::IgnoreHeader))) {
-
- QChar bom(QChar::ByteOrderMark);
-
- if (state)
- state->flags |= QTextCodec::IgnoreHeader; // bom handling only on first state
-
- switch (charsetId) {
- case KCharacterSetIdentifierUcs2:
- outputBuffer.append(bom.row());
- outputBuffer.append(bom.cell());
- bomofs = 2;
- break;
-
- case KCharacterSetIdentifierUtf8: // we don't add bom for UTF-8
- case KCharacterSetIdentifierJavaConformantUtf8:
- /*outputBuffer.append("\xef\xbb\xbf");
- bomofs = 3;
- */
- break;
-
- case KCharacterSetIdentifierUnicodeLittle:
- outputBuffer.append(bom.cell());
- outputBuffer.append(bom.row());
- bomofs = 2;
- break;
-
- case KCharacterSetIdentifierUnicodeBig:
- outputBuffer.append(bom.row());
- outputBuffer.append(bom.cell());
- bomofs = 2;
- break;
-
- default:
- break;
- }
- }
-
- // len is 16bit chars, reserve 3 8bit chars for each input char
- // jsz - it could be differentiated, to allocate less
- outputBuffer.resize(len * 3 + bomofs);
-
- // loop for too short output buffer
- int unconverted;
- int numberOfUnconvertibleCharacters = len;
- int indexOfFirstUnconvertibleCharacter;
- int convertedSize;
- int lastUnconverted = 0;
- int initial_size=0;
- int remainderToConvert = len;
- while (1) {
- TPtr8 outputPtr(reinterpret_cast<unsigned char *>(outputBuffer.data() + bomofs + initial_size), outputBuffer.size() - bomofs);
-
- TPtrC16 UnicodeText(reinterpret_cast<const unsigned short *>(str+len-remainderToConvert), remainderToConvert);
-
- //Convert text encoded in the Unicode character set (UCS-2) into other character sets
- unconverted = -1;
- QT_TRAP_THROWING( unconverted = converter->ConvertFromUnicode(outputPtr,
- UnicodeText,
- numberOfUnconvertibleCharacters,
- indexOfFirstUnconvertibleCharacter))
- initial_size += outputPtr.Length();
- if (unconverted < 0) {
- return QByteArray();
- }
-
-
- if (unconverted == 0 ) {
- convertedSize = initial_size;
- break;
- }
-
- // check what means unconverted > 0
- if (indexOfFirstUnconvertibleCharacter<0) {
- // 8859-6 and 8859-8 break with certain input (string of \xc0 - \xd9 converted to unicode and back)
- if (unconverted == lastUnconverted) {
- return QByteArray();
- }
- lastUnconverted = unconverted;
- }
- else {
- // were some character not possible to convert
-
- }
- remainderToConvert = unconverted; // len - indexOfFirstUnconvertibleCharacter;
- // resize output buffer, use =op for the null check
- outputBuffer.resize(outputBuffer.size() + remainderToConvert * 3 + bomofs);
- };
-
- // shorten output
- outputBuffer.resize(convertedSize + bomofs);
-
- if (state) {
- state->invalidChars = numberOfUnconvertibleCharacters;
-
- // check if any Symbian CONVERTED headers should be removed
- if (state->flags & QTextCodec::IgnoreHeader && state->state_data[0] == 0) {
-
- state->state_data[0] = 0xff; // bom handling only on first state
-
- if (charsetId == KCharacterSetIdentifierUcs2 && outputBuffer.size() > 1) {
-
- QChar bom(QChar::ByteOrderMark);
- if (outputBuffer.at(0) == bom.row() && outputBuffer.at(1) == bom.cell()) {
- outputBuffer.remove(0, 2);
- } else if (outputBuffer.at(0) == bom.cell() && outputBuffer.at(1) == bom.row()) {
- outputBuffer.remove(0, 2);
- }
-
- } else if ((charsetId == KCharacterSetIdentifierUtf8 ||
- charsetId == KCharacterSetIdentifierJavaConformantUtf8) &&
- outputBuffer.size() > 2) {
- if (outputBuffer.at(0) == 0xef && outputBuffer.at(1) == 0xbb && outputBuffer.at(2) == 0xbf) {
- outputBuffer.remove(0, 3);
- }
-
- } else if (charsetId == KCharacterSetIdentifierUnicodeLittle &&
- outputBuffer.size() > 1) {
-
- QChar bom(QChar::ByteOrderMark);
- if (outputBuffer.at(0) == bom.row() && outputBuffer.at(1) == bom.cell()) {
- outputBuffer.remove(0, 2);
- }
-
- } else if (charsetId == KCharacterSetIdentifierUnicodeBig &&
- outputBuffer.size() > 1) {
-
- QChar bom(QChar::ByteOrderSwapped);
- if (outputBuffer.at(0) == bom.row() && outputBuffer.at(1) == bom.cell()) {
- outputBuffer.remove(0, 2);
- }
- }
-
- }
- }
-
- return outputBuffer;
-}
-
-
-uint QSymbianTextCodec::getLanguageDependentCharacterSet()
-{
- TLanguage lang = User::Language();
-
- uint langIndex = 0;
-
- switch (lang) {
- case 14: //ELangTurkish
- langIndex = KCharacterSetIdentifierIso88599; break;
- case 16: //ELangRussian
- langIndex = KCharacterSetIdentifierIso88595; break;
- case 17: //ELangHungarian
- langIndex = KCharacterSetIdentifierIso88592; break;
- case 25: //ELangCzec
- case 26: //ELangSlovak
- case 27: //ELangPolish
- case 28: //ELangSlovenian
- langIndex = KCharacterSetIdentifierIso88592; break;
- case 29: //ELangTaiwanChinese
- case 30: //ELangHongKongChinese
- langIndex = KCharacterSetIdentifierBig5; break;
- case 31: //ELangPrcChinese
- langIndex = KCharacterSetIdentifierGbk; break;
- case 32: //ELangJapanese
- langIndex = KCharacterSetIdentifierShiftJis; break;
- case 33: //ELangThai
- langIndex = 270501193 /*KCharacterSetIdentifierTis620*/; break;
- case 37: //ELangArabic
- langIndex = KCharacterSetIdentifierIso88596; break;
- case 40: //ELangBelarussian
- case 42: //ELangBulgarian
- langIndex = KCharacterSetIdentifierIso88595; break;
- case 45: //ELangCroatian
- langIndex = KCharacterSetIdentifierIso88592; break;
- case 49: //ELangEstonian
- langIndex = KCharacterSetIdentifierIso88594; break;
- case 54: //ELangGreek
- case 55: //ELangCyprusGreek
- langIndex = KCharacterSetIdentifierIso88597; break;
- case 57: //ELangHebrew
- langIndex = KCharacterSetIdentifierIso88598; break;
- case 58: //ELangHindi
- langIndex = 271011982/*KCharacterSetIdentifierIscii*/; break;
- case 67: //ELangLatvian
- case 68: //ELangLithuanian
- langIndex = KCharacterSetIdentifierIso88594; break;
- case 69: //ELangMacedonian
- langIndex = KCharacterSetIdentifierIso88595; break;
- case 78: //ELangRomanian
- langIndex = KCharacterSetIdentifierIso88592; break;
- case 79: //ELangSerbian
- langIndex = KCharacterSetIdentifierIso88592; break;
- case 91: //ELangCyprusTurkish
- langIndex = KCharacterSetIdentifierIso88599; break;
- case 93: //ELangUkrainian
- langIndex = KCharacterSetIdentifierIso88595; break;
- case 94: //ELangUrdu
- langIndex = KCharacterSetIdentifierIso88596; break;
- case 157: //ELangEnglish_Taiwan
- case 158: //ELangEnglish_HongKong
- langIndex = KCharacterSetIdentifierBig5; break;
- case 159: //ELangEnglish_Prc
- langIndex = KCharacterSetIdentifierGbk; break;
- case 160:
- langIndex = KCharacterSetIdentifierShiftJis; break;
- case 161: //ELangEnglish_Thailand
- langIndex = 270501193/*KCharacterSetIdentifierTis620*/; break;
- }
-
- if (langIndex > 0) {
- return langIndex;
- }
- return KCharacterSetIdentifierCodePage1252;
-}
-
-/* Create the codecs that have aliases and return the locale mapper*/
-QSymbianTextCodec *QSymbianTextCodec::init()
-{
- const uint localeMapperId = getLanguageDependentCharacterSet();
- QScopedPointer<CArrayFix<CCnvCharacterSetConverter::SCharacterSet> > array;
- QT_TRAP_THROWING(array.reset(CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableL(qt_s60GetRFs())))
- CCnvCharacterSetConverter *converter = QSymbianTextCodec::converter();
- int count = array->Count();
- for (int i = 0; i < count; i++) {
- int charsetId = array->At(i).Identifier();
-
- // skip builtin Qt codecs
- if (charsetId == KCharacterSetIdentifierUtf8 || charsetId == KCharacterSetIdentifierUnicodeLittle
- || charsetId == KCharacterSetIdentifierUnicodeLittle || charsetId == KCharacterSetIdentifierUnicodeBig
- || charsetId == KCharacterSetIdentifierIso88591
- || charsetId == 270501691 /* skip Windows-1252 duplicate*/) {
- continue;
- }
-
- int begin = 0;
- int n = sizeof(codecsData) / sizeof(codecsData[0]);
- int half;
-
- while (n > 0) {
- half = n >> 1;
- int middle = begin + half;
- if (codecsData[middle].charsetId < charsetId) {
- begin = middle + 1;
- n -= half + 1;
- } else {
- n = half;
- }
- }
- if (codecsData[begin].charsetId == charsetId) {
- QSymbianTextCodec *c = new QSymbianTextCodec(charsetId, begin);
- if (charsetId == localeMapperId)
- localeMapper = c;
- } else {
- // We did not find the charsetId in our codecsData[], therefore we ask
- // the OS for the codec name. We first try to get a "standard name" and fall
- // back to array->At(i).Name(), if really needed. array->At(i).Name() is not
- // guaranteed to be a correct name for QTextCodec::codecFromName().
- QScopedPointer<HBufC8> buf;
- QT_TRAP_THROWING(buf.reset(converter->ConvertCharacterSetIdentifierToStandardNameL(charsetId, qt_s60GetRFs())))
- QByteArray name;
- if (buf && buf->Length()) {
- name = QByteArray(reinterpret_cast<const char *>(buf->Ptr()), buf->Length());
- } else {
- TPtrC charSetName = array->At(i).NameIsFileName() ? TParsePtrC(array->At(i).Name()).Name() : array->At(i).Name();
- int len = charSetName.Length();
- QString str;
- str.setUnicode(reinterpret_cast<const QChar*>(charSetName.Ptr()), len);
- name = str.toLatin1();
- }
- if (!name.isEmpty())
- new QSymbianTextCodecWithName(charsetId, name);
- }
-
- }
- return localeMapper;
-}
diff --git a/src/corelib/codecs/qtextcodecplugin.cpp b/src/corelib/codecs/qtextcodecplugin.cpp
index 91b172d591..4eb075c5f2 100644
--- a/src/corelib/codecs/qtextcodecplugin.cpp
+++ b/src/corelib/codecs/qtextcodecplugin.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/codecs/qtextcodecplugin.h b/src/corelib/codecs/qtextcodecplugin.h
index d80b173c8c..9a00bbc9fa 100644
--- a/src/corelib/codecs/qtextcodecplugin.h
+++ b/src/corelib/codecs/qtextcodecplugin.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/codecs/qtsciicodec.cpp b/src/corelib/codecs/qtsciicodec.cpp
index 868136605e..c158ad2dc5 100644
--- a/src/corelib/codecs/qtsciicodec.cpp
+++ b/src/corelib/codecs/qtsciicodec.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/codecs/qtsciicodec_p.h b/src/corelib/codecs/qtsciicodec_p.h
index b55d8bf288..b74b38c429 100644
--- a/src/corelib/codecs/qtsciicodec_p.h
+++ b/src/corelib/codecs/qtsciicodec_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp
index 34e4695a26..d279f8591c 100644
--- a/src/corelib/codecs/qutfcodec.cpp
+++ b/src/corelib/codecs/qutfcodec.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/codecs/qutfcodec_p.h b/src/corelib/codecs/qutfcodec_p.h
index 982a3d198a..737697f5d6 100644
--- a/src/corelib/codecs/qutfcodec_p.h
+++ b/src/corelib/codecs/qutfcodec_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qfuture.cpp b/src/corelib/concurrent/qfuture.cpp
index 5bffd66fc3..81655502e9 100644
--- a/src/corelib/concurrent/qfuture.cpp
+++ b/src/corelib/concurrent/qfuture.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qfuture.h b/src/corelib/concurrent/qfuture.h
index 911fb7ecc5..6407fc39e7 100644
--- a/src/corelib/concurrent/qfuture.h
+++ b/src/corelib/concurrent/qfuture.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qfutureinterface.cpp b/src/corelib/concurrent/qfutureinterface.cpp
index f54b335403..63033080a1 100644
--- a/src/corelib/concurrent/qfutureinterface.cpp
+++ b/src/corelib/concurrent/qfutureinterface.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qfutureinterface.h b/src/corelib/concurrent/qfutureinterface.h
index b92a47a33d..2acd1f46fd 100644
--- a/src/corelib/concurrent/qfutureinterface.h
+++ b/src/corelib/concurrent/qfutureinterface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qfutureinterface_p.h b/src/corelib/concurrent/qfutureinterface_p.h
index 7b5275f5f8..96567c35eb 100644
--- a/src/corelib/concurrent/qfutureinterface_p.h
+++ b/src/corelib/concurrent/qfutureinterface_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qfuturesynchronizer.cpp b/src/corelib/concurrent/qfuturesynchronizer.cpp
index 18990ae2f0..d46aa3e7e7 100644
--- a/src/corelib/concurrent/qfuturesynchronizer.cpp
+++ b/src/corelib/concurrent/qfuturesynchronizer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qfuturesynchronizer.h b/src/corelib/concurrent/qfuturesynchronizer.h
index ba838a8b66..4fc1987f65 100644
--- a/src/corelib/concurrent/qfuturesynchronizer.h
+++ b/src/corelib/concurrent/qfuturesynchronizer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qfuturewatcher.cpp b/src/corelib/concurrent/qfuturewatcher.cpp
index e405896f0b..e0f197c7e7 100644
--- a/src/corelib/concurrent/qfuturewatcher.cpp
+++ b/src/corelib/concurrent/qfuturewatcher.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qfuturewatcher.h b/src/corelib/concurrent/qfuturewatcher.h
index a5f723c100..efd7d94101 100644
--- a/src/corelib/concurrent/qfuturewatcher.h
+++ b/src/corelib/concurrent/qfuturewatcher.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qfuturewatcher_p.h b/src/corelib/concurrent/qfuturewatcher_p.h
index e90bff1e9b..4898779c33 100644
--- a/src/corelib/concurrent/qfuturewatcher_p.h
+++ b/src/corelib/concurrent/qfuturewatcher_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qrunnable.cpp b/src/corelib/concurrent/qrunnable.cpp
index 9ac335bc83..e5f7dc0efb 100644
--- a/src/corelib/concurrent/qrunnable.cpp
+++ b/src/corelib/concurrent/qrunnable.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qrunnable.h b/src/corelib/concurrent/qrunnable.h
index 34ef16bc10..d4b3bda956 100644
--- a/src/corelib/concurrent/qrunnable.h
+++ b/src/corelib/concurrent/qrunnable.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentcompilertest.h b/src/corelib/concurrent/qtconcurrentcompilertest.h
index c139c7a8b2..b6385b5a8f 100644
--- a/src/corelib/concurrent/qtconcurrentcompilertest.h
+++ b/src/corelib/concurrent/qtconcurrentcompilertest.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentexception.cpp b/src/corelib/concurrent/qtconcurrentexception.cpp
index 237152c0d3..3bc4c05684 100644
--- a/src/corelib/concurrent/qtconcurrentexception.cpp
+++ b/src/corelib/concurrent/qtconcurrentexception.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentexception.h b/src/corelib/concurrent/qtconcurrentexception.h
index 1c100a5206..c926d9ffe7 100644
--- a/src/corelib/concurrent/qtconcurrentexception.h
+++ b/src/corelib/concurrent/qtconcurrentexception.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentfilter.cpp b/src/corelib/concurrent/qtconcurrentfilter.cpp
index dff5e2e5ed..0b3ddd829d 100644
--- a/src/corelib/concurrent/qtconcurrentfilter.cpp
+++ b/src/corelib/concurrent/qtconcurrentfilter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentfilter.h b/src/corelib/concurrent/qtconcurrentfilter.h
index d8c5f43a48..c9ed9bbdfa 100644
--- a/src/corelib/concurrent/qtconcurrentfilter.h
+++ b/src/corelib/concurrent/qtconcurrentfilter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentfilterkernel.h b/src/corelib/concurrent/qtconcurrentfilterkernel.h
index 95dc5b70be..61d13423a3 100644
--- a/src/corelib/concurrent/qtconcurrentfilterkernel.h
+++ b/src/corelib/concurrent/qtconcurrentfilterkernel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentfunctionwrappers.h b/src/corelib/concurrent/qtconcurrentfunctionwrappers.h
index 1e09221cee..1468b4e4e6 100644
--- a/src/corelib/concurrent/qtconcurrentfunctionwrappers.h
+++ b/src/corelib/concurrent/qtconcurrentfunctionwrappers.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentiteratekernel.cpp b/src/corelib/concurrent/qtconcurrentiteratekernel.cpp
index c9ea79bd34..9b3b177ce8 100644
--- a/src/corelib/concurrent/qtconcurrentiteratekernel.cpp
+++ b/src/corelib/concurrent/qtconcurrentiteratekernel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentiteratekernel.h b/src/corelib/concurrent/qtconcurrentiteratekernel.h
index 49c053caf7..6adb05574b 100644
--- a/src/corelib/concurrent/qtconcurrentiteratekernel.h
+++ b/src/corelib/concurrent/qtconcurrentiteratekernel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentmap.cpp b/src/corelib/concurrent/qtconcurrentmap.cpp
index ebd0ccdcd8..f078a0646a 100644
--- a/src/corelib/concurrent/qtconcurrentmap.cpp
+++ b/src/corelib/concurrent/qtconcurrentmap.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentmap.h b/src/corelib/concurrent/qtconcurrentmap.h
index 166d5c8527..d735045173 100644
--- a/src/corelib/concurrent/qtconcurrentmap.h
+++ b/src/corelib/concurrent/qtconcurrentmap.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentmapkernel.h b/src/corelib/concurrent/qtconcurrentmapkernel.h
index 48f5b60de1..ed8a1543ce 100644
--- a/src/corelib/concurrent/qtconcurrentmapkernel.h
+++ b/src/corelib/concurrent/qtconcurrentmapkernel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentmedian.h b/src/corelib/concurrent/qtconcurrentmedian.h
index e563b3bd3a..13983fd2a4 100644
--- a/src/corelib/concurrent/qtconcurrentmedian.h
+++ b/src/corelib/concurrent/qtconcurrentmedian.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentreducekernel.h b/src/corelib/concurrent/qtconcurrentreducekernel.h
index ebc37e7936..1a30d2e3e3 100644
--- a/src/corelib/concurrent/qtconcurrentreducekernel.h
+++ b/src/corelib/concurrent/qtconcurrentreducekernel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentresultstore.cpp b/src/corelib/concurrent/qtconcurrentresultstore.cpp
index 89f561c2ac..e9d76448a7 100644
--- a/src/corelib/concurrent/qtconcurrentresultstore.cpp
+++ b/src/corelib/concurrent/qtconcurrentresultstore.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentresultstore.h b/src/corelib/concurrent/qtconcurrentresultstore.h
index 627aca27bd..c2a9f0a3e2 100644
--- a/src/corelib/concurrent/qtconcurrentresultstore.h
+++ b/src/corelib/concurrent/qtconcurrentresultstore.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentrun.cpp b/src/corelib/concurrent/qtconcurrentrun.cpp
index 87952da882..676a542471 100644
--- a/src/corelib/concurrent/qtconcurrentrun.cpp
+++ b/src/corelib/concurrent/qtconcurrentrun.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentrun.h b/src/corelib/concurrent/qtconcurrentrun.h
index ef51b2adcb..06da380430 100644
--- a/src/corelib/concurrent/qtconcurrentrun.h
+++ b/src/corelib/concurrent/qtconcurrentrun.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentrunbase.h b/src/corelib/concurrent/qtconcurrentrunbase.h
index c1270e953b..51390028b0 100644
--- a/src/corelib/concurrent/qtconcurrentrunbase.h
+++ b/src/corelib/concurrent/qtconcurrentrunbase.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h b/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h
index 9beb0b9c35..8a02497ddd 100644
--- a/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h
+++ b/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentthreadengine.cpp b/src/corelib/concurrent/qtconcurrentthreadengine.cpp
index 71a47164d2..559e7bb490 100644
--- a/src/corelib/concurrent/qtconcurrentthreadengine.cpp
+++ b/src/corelib/concurrent/qtconcurrentthreadengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qtconcurrentthreadengine.h b/src/corelib/concurrent/qtconcurrentthreadengine.h
index 38d01ee11a..98edd2d9ec 100644
--- a/src/corelib/concurrent/qtconcurrentthreadengine.h
+++ b/src/corelib/concurrent/qtconcurrentthreadengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qthreadpool.cpp b/src/corelib/concurrent/qthreadpool.cpp
index 91e77d9eff..2cc31b9943 100644
--- a/src/corelib/concurrent/qthreadpool.cpp
+++ b/src/corelib/concurrent/qthreadpool.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qthreadpool.h b/src/corelib/concurrent/qthreadpool.h
index d857073b42..1b5677b9fa 100644
--- a/src/corelib/concurrent/qthreadpool.h
+++ b/src/corelib/concurrent/qthreadpool.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/concurrent/qthreadpool_p.h b/src/corelib/concurrent/qthreadpool_p.h
index db50ec92c6..009dfcdee2 100644
--- a/src/corelib/concurrent/qthreadpool_p.h
+++ b/src/corelib/concurrent/qthreadpool_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index edb5ecb849..17c15d42b1 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -23,6 +23,7 @@ include(global/global.pri)
include(thread/thread.pri)
include(tools/tools.pri)
include(io/io.pri)
+include(itemmodels/itemmodels.pri)
include(plugin/plugin.pri)
include(kernel/kernel.pri)
include(codecs/codecs.pri)
diff --git a/src/corelib/global/qconfig-dist.h b/src/corelib/global/qconfig-dist.h
index bc3ab9a024..727eea0018 100644
--- a/src/corelib/global/qconfig-dist.h
+++ b/src/corelib/global/qconfig-dist.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/global/qconfig-large.h b/src/corelib/global/qconfig-large.h
index 65367e9be1..8a2553a6a6 100644
--- a/src/corelib/global/qconfig-large.h
+++ b/src/corelib/global/qconfig-large.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/global/qconfig-medium.h b/src/corelib/global/qconfig-medium.h
index f9ecf92388..96207d1cd8 100644
--- a/src/corelib/global/qconfig-medium.h
+++ b/src/corelib/global/qconfig-medium.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/global/qconfig-minimal.h b/src/corelib/global/qconfig-minimal.h
index ace1eea508..30440243de 100644
--- a/src/corelib/global/qconfig-minimal.h
+++ b/src/corelib/global/qconfig-minimal.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -104,9 +104,6 @@
#ifndef QT_NO_TEMPORARYFILE
# define QT_NO_TEMPORARYFILE
#endif
-#ifndef QT_NO_TEXTSTREAM
-# define QT_NO_TEXTSTREAM
-#endif
#ifndef QT_NO_SETTINGS
# define QT_NO_SETTINGS
#endif
diff --git a/src/corelib/global/qconfig-nacl.h b/src/corelib/global/qconfig-nacl.h
index 18ae261809..6b943ab422 100644
--- a/src/corelib/global/qconfig-nacl.h
+++ b/src/corelib/global/qconfig-nacl.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/global/qconfig-small.h b/src/corelib/global/qconfig-small.h
index 4f34169d75..84a5ec59d9 100644
--- a/src/corelib/global/qconfig-small.h
+++ b/src/corelib/global/qconfig-small.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -77,9 +77,6 @@
#endif
/* File I/O */
-#ifndef QT_NO_TEXTSTREAM
-# define QT_NO_TEXTSTREAM
-#endif
#ifndef QT_NO_SETTINGS
# define QT_NO_SETTINGS
#endif
diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h
index 8a17af55f2..66d66cb78f 100644
--- a/src/corelib/global/qendian.h
+++ b/src/corelib/global/qendian.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/global/qendian.qdoc b/src/corelib/global/qendian.qdoc
index 307db59426..3133d3c252 100644
--- a/src/corelib/global/qendian.qdoc
+++ b/src/corelib/global/qendian.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h
index e0b8a8fb6d..5055414834 100644
--- a/src/corelib/global/qfeatures.h
+++ b/src/corelib/global/qfeatures.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -289,9 +289,6 @@
// HtmlParser
//#define QT_NO_TEXTHTMLPARSER
-// QTextStream
-//#define QT_NO_TEXTSTREAM
-
// QToolTip
//#define QT_NO_TOOLTIP
@@ -351,16 +348,6 @@
#define QT_NO_FILESYSTEMMODEL
#endif
-// QHostInfo
-#if !defined(QT_NO_HOSTINFO) && (defined(QT_NO_TEXTSTREAM))
-#define QT_NO_HOSTINFO
-#endif
-
-// XPM Image Format
-#if !defined(QT_NO_IMAGEFORMAT_XPM) && (defined(QT_NO_TEXTSTREAM))
-#define QT_NO_IMAGEFORMAT_XPM
-#endif
-
// QLibrary
#if !defined(QT_NO_LIBRARY) && (defined(QT_NO_SETTINGS))
#define QT_NO_LIBRARY
@@ -597,7 +584,7 @@
#endif
// QPrinter
-#if !defined(QT_NO_PRINTER) && (defined(QT_NO_TEXTSTREAM) || defined(QT_NO_PICTURE) || defined(QT_NO_TEMPORARYFILE))
+#if !defined(QT_NO_PRINTER) && (defined(QT_NO_PICTURE) || defined(QT_NO_TEMPORARYFILE))
#define QT_NO_PRINTER
#endif
diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt
index 6b861d4d17..4eae2f50ec 100644
--- a/src/corelib/global/qfeatures.txt
+++ b/src/corelib/global/qfeatures.txt
@@ -192,13 +192,6 @@ Requires:
Name: QProcess
SeeAlso: ???
-Feature: TEXTSTREAM
-Description: Supports reading and writing of text.
-Section: File I/O
-Requires:
-Name: QTextStream
-SeeAlso: ???
-
Feature: TEMPORARYFILE
Description: Provides an I/O device that operates on temporary files.
Section: File I/O
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 615598b378..f8fc49ddbf 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -78,17 +78,6 @@
#include <CoreServices/CoreServices.h>
#endif
-#if defined(Q_OS_SYMBIAN)
-#include <e32def.h>
-#include <e32debug.h>
-#include <f32file.h>
-#include <e32math.h>
-# include "private/qcore_symbian_p.h"
-
-_LIT(qt_S60Filter, "Series60v?.*.sis");
-_LIT(qt_symbianSystemInstallDir, "z:\\system\\install\\");
-#endif
-
QT_BEGIN_NAMESPACE
@@ -970,22 +959,6 @@ bool qSharedBuild()
*/
/*!
- \fn QSysInfo::SymbianVersion QSysInfo::symbianVersion()
- \since 4.6
-
- Returns the version of the Symbian operating system on which the
- application is run (Symbian only).
-*/
-
-/*!
- \fn QSysInfo::S60Version QSysInfo::s60Version()
- \since 4.6
-
- Returns the version of the S60 SDK system on which the
- application is run (S60 only).
-*/
-
-/*!
\enum QSysInfo::Endian
\value BigEndian Big-endian byte order (also called Network byte order)
@@ -1041,7 +1014,7 @@ bool qSharedBuild()
\value WV_NT_based NT-based version of Windows
\value WV_CE_based CE-based version of Windows
- \sa MacVersion, SymbianVersion
+ \sa MacVersion
*/
/*!
@@ -1072,50 +1045,7 @@ bool qSharedBuild()
\value MV_SNOWLEOPARD Apple codename for MV_10_6
\value MV_LION Apple codename for MV_10_7
- \sa WinVersion, SymbianVersion
-*/
-
-/*!
- \enum QSysInfo::SymbianVersion
-
- This enum provides symbolic names for the various versions of the
- Symbian operating system. On Symbian, the
- QSysInfo::symbianVersion() function gives the version of the
- system on which the application is run.
-
- \value SV_9_2 Symbian OS v9.2
- \value SV_9_3 Symbian OS v9.3
- \value SV_9_4 Symbian OS v9.4
- \value SV_SF_1 S60 5th Edition (Symbian^1)
- \value SV_SF_2 Symbian^2
- \value SV_SF_3 Symbian^3 or Symbian Anna
- \value SV_SF_4 \e{This enum value is deprecated.}
- \value SV_API_5_3 Symbian/S60 API version 5.3 release
- \value SV_API_5_4 Symbian/S60 API version 5.4 release
- \value SV_Unknown An unknown and currently unsupported platform
-
- \sa S60Version, WinVersion, MacVersion
-*/
-
-/*!
- \enum QSysInfo::S60Version
-
- This enum provides symbolic names for the various versions of the
- S60 SDK. On S60, the
- QSysInfo::s60Version() function gives the version of the
- SDK on which the application is run.
-
- \value SV_S60_3_1 S60 3rd Edition Feature Pack 1
- \value SV_S60_3_2 S60 3rd Edition Feature Pack 2
- \value SV_S60_5_0 S60 5th Edition
- \value SV_S60_5_1 \e{This enum value is deprecated.}
- \value SV_S60_5_2 Symbian^3 and Symbian Anna
- \value SV_S60_5_3 Symbian/S60 API version 5.3 release
- \value SV_S60_5_4 Symbian/S60 API version 5.4 release
- \value SV_S60_Unknown An unknown and currently unsupported platform
- \omitvalue SV_S60_None
-
- \sa SymbianVersion, WinVersion, MacVersion
+ \sa WinVersion
*/
/*!
@@ -1625,108 +1555,6 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion()
#endif
-#ifdef Q_OS_SYMBIAN
-static QSysInfo::SymbianVersion cachedSymbianVersion = QSysInfo::SymbianVersion(-1);
-static QSysInfo::S60Version cachedS60Version = QSysInfo::S60Version(-1);
-
-static void symbianInitVersions()
-{
- // Use pure Symbian code, because if done using QDir, there will be a call back
- // to this method, resulting doing this expensive operation twice before the cache kicks in.
- // Pure Symbian code also makes this method ~10x faster, speeding up the application launch.
- RFs rfs = qt_s60GetRFs();
- TFindFile fileFinder(rfs);
- CDir* contents;
-
- // Check for platform version
- TInt err = fileFinder.FindWildByDir(qt_S60Filter, qt_symbianSystemInstallDir, contents);
- if (err == KErrNone) {
- QScopedPointer<CDir> contentsDeleter(contents);
- err = contents->Sort(EDescending|ESortByName);
- if (err == KErrNone && contents->Count() > 0 && (*contents)[0].iName.Length() >= 12) {
- TInt major = (*contents)[0].iName[9] - '0';
- TInt minor = (*contents)[0].iName[11] - '0';
- if (major == 3) {
- if (minor == 1) {
- cachedS60Version = QSysInfo::SV_S60_3_1;
- cachedSymbianVersion = QSysInfo::SV_9_2;
- } else if (minor == 2) {
- cachedS60Version = QSysInfo::SV_S60_3_2;
- cachedSymbianVersion = QSysInfo::SV_9_3;
- }
- } else if (major == 5) {
- if (minor == 0) {
- cachedS60Version = QSysInfo::SV_S60_5_0;
- cachedSymbianVersion = QSysInfo::SV_9_4;
- } else if (minor == 1) {
- cachedS60Version = QSysInfo::SV_S60_5_1;
- cachedSymbianVersion = QSysInfo::SV_SF_2;
- } else if (minor == 2) {
- cachedS60Version = QSysInfo::SV_S60_5_2;
- cachedSymbianVersion = QSysInfo::SV_SF_3;
- } else if (minor == 3) {
- cachedS60Version = QSysInfo::SV_S60_5_3;
- cachedSymbianVersion = QSysInfo::SV_API_5_3;
- } else if (minor >= 4) {
- cachedS60Version = QSysInfo::SV_S60_5_4;
- cachedSymbianVersion = QSysInfo::SV_API_5_4;
- }
- }
- }
- }
-
-# ifdef Q_CC_NOKIAX86
- if (cachedS60Version == -1) {
- // Some emulator environments may not contain the version specific .sis files, so
- // simply hardcode the version on those environments. Note that can't use
- // S60_VERSION_* defines for S60 3.x/5.0 platforms, as they do not define them
- // right anyway in case .sis files are not found.
-# if defined(__SERIES60_31__)
- cachedS60Version = QSysInfo::SV_S60_3_1;
- cachedSymbianVersion = QSysInfo::SV_9_2;
-# elif defined(__S60_32__)
- cachedS60Version = QSysInfo::SV_S60_3_2;
- cachedSymbianVersion = QSysInfo::SV_9_3;
-# elif defined(__S60_50__)
- cachedS60Version = QSysInfo::SV_S60_5_0;
- cachedSymbianVersion = QSysInfo::SV_9_4;
-# elif defined(S60_VERSION_5_2)
- cachedS60Version = QSysInfo::SV_S60_5_2;
- cachedSymbianVersion = QSysInfo::SV_SF_3;
-# elif defined(S60_VERSION_5_3)
- cachedS60Version = QSysInfo::SV_S60_5_3;
- cachedSymbianVersion = QSysInfo::SV_API_5_3;
-# elif defined(S60_VERSION_5_4)
- cachedS60Version = QSysInfo::SV_S60_5_4;
- cachedSymbianVersion = QSysInfo::SV_API_5_4;
-# endif
- }
-# endif
-
- if (cachedS60Version == -1) {
- //If reaching here, it was not possible to determine the version
- cachedS60Version = QSysInfo::SV_S60_Unknown;
- cachedSymbianVersion = QSysInfo::SV_Unknown;
- }
-}
-
-QSysInfo::SymbianVersion QSysInfo::symbianVersion()
-{
- if (cachedSymbianVersion == -1)
- symbianInitVersions();
-
- return cachedSymbianVersion;
-}
-
-QSysInfo::S60Version QSysInfo::s60Version()
-{
- if (cachedS60Version == -1)
- symbianInitVersions();
-
- return cachedS60Version;
-}
-#endif // ifdef Q_OS_SYMBIAN
-
/*!
\macro void Q_ASSERT(bool test)
\relates <QtGlobal>
@@ -2037,18 +1865,6 @@ static void qDefaultMsgHandler(QtMsgType, const char *buf)
QString fstr = QString::fromLatin1(buf);
fstr += QLatin1Char('\n');
OutputDebugString(reinterpret_cast<const wchar_t *> (fstr.utf16()));
-#elif defined(Q_OS_SYMBIAN)
- // RDebug::Print has a cap of 256 characters so break it up
- _LIT(format, "[Qt Message] %S");
- const int maxBlockSize = 256 - ((const TDesC &)format).Length();
- const TPtrC8 ptr(reinterpret_cast<const TUint8*>(buf));
- HBufC* hbuffer = HBufC::New(qMin(maxBlockSize, ptr.Length()));
- Q_CHECK_PTR(hbuffer);
- for (int i = 0; i < ptr.Length(); i += hbuffer->Length()) {
- hbuffer->Des().Copy(ptr.Mid(i, qMin(maxBlockSize, ptr.Length()-i)));
- RDebug::Print(format, hbuffer);
- }
- delete hbuffer;
#else
fprintf(stderr, "%s\n", buf);
fflush(stderr);
@@ -2099,15 +1915,7 @@ void qt_message_output(QtMsgType msgType, const char *buf)
_CrtDbgBreak();
#endif
-#if defined(Q_OS_SYMBIAN)
- __DEBUGGER(); // on the emulator, get the debugger to kick in if there's one around
- TBuf<256> tmp;
- TPtrC8 ptr(reinterpret_cast<const TUint8*>(buf));
- TInt len = Min(tmp.MaxLength(), ptr.Length());
- tmp.Copy(ptr.Left(len));
- // Panic the current thread. We don't use real panic codes, so 0 has no special meaning.
- User::Panic(tmp, 0);
-#elif (defined(Q_OS_UNIX) || defined(Q_CC_MINGW))
+#if (defined(Q_OS_UNIX) || defined(Q_CC_MINGW))
abort(); // trap; generates core dump
#else
exit(1); // goodbye cruel world
@@ -2400,7 +2208,7 @@ bool qputenv(const char *varName, const QByteArray& value)
#endif
}
-#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) && !defined(QT_NO_THREAD)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD)
# if defined(Q_OS_INTEGRITY) && defined(__GHS_VERSION_NUMBER) && (__GHS_VERSION_NUMBER < 500)
// older versions of INTEGRITY used a long instead of a uint for the seed.
@@ -2431,7 +2239,7 @@ Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value
*/
void qsrand(uint seed)
{
-#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) && !defined(QT_NO_THREAD)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD)
SeedStorage *seedStorage = randTLS();
if (seedStorage) {
SeedStorageType *pseed = seedStorage->localData();
@@ -2446,7 +2254,7 @@ void qsrand(uint seed)
srand(seed);
}
#else
- // On Windows and Symbian srand() and rand() already use Thread-Local-Storage
+ // On Windows srand() and rand() already use Thread-Local-Storage
// to store the seed between calls
// this is also valid for QT_NO_THREAD
srand(seed);
@@ -2470,7 +2278,7 @@ void qsrand(uint seed)
*/
int qrand()
{
-#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) && !defined(QT_NO_THREAD)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD)
SeedStorage *seedStorage = randTLS();
if (seedStorage) {
SeedStorageType *pseed = seedStorage->localData();
@@ -2487,7 +2295,7 @@ int qrand()
return rand();
}
#else
- // On Windows and Symbian srand() and rand() already use Thread-Local-Storage
+ // On Windows srand() and rand() already use Thread-Local-Storage
// to store the seed between calls
// this is also valid for QT_NO_THREAD
return rand();
@@ -3160,185 +2968,15 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
\sa Q_DECL_EXPORT
*/
-#if defined(Q_OS_SYMBIAN)
-
-#include <typeinfo>
-
-/*! \macro QT_TRAP_THROWING(function)
- \relates <QtGlobal>
- \ingroup qts60
-
- TRAP leaves from Symbian \a function and throws an appropriate
- standard C++ exception instead.
- This must be used when calling Symbian OS leaving functions
- from inside Qt or standard C++ code, so that the code can respond
- correctly to the exception.
-
- \warning This macro is only available on Symbian.
-
- Example:
-
- \code
- // A Symbian leaving function is being called within a Qt function.
- // Any leave must be converted to an exception
- CAknTitlePane* titlePane = S60->titlePane();
- if (titlePane) {
- TPtrC captionPtr(qt_QString2TPtrC(caption));
- QT_TRAP_THROWING(titlePane->SetTextL(captionPtr));
- }
- \endcode
-
- \sa QT_TRYCATCH_ERROR(), QT_TRYCATCH_LEAVING()
-*/
-
-/*! \macro QT_TRYCATCH_ERROR(error, function)
- \relates <QtGlobal>
- \ingroup qts60
-
- Catch standard C++ exceptions from a \a function and convert them to a Symbian OS
- \a error code, or \c KErrNone if there is no exception.
- This must be used inside Qt or standard C++ code when using exception throwing
- code (practically anything) and returning an error code to Symbian OS.
-
- \warning This macro is only available on Symbian.
-
- Example:
-
- \code
- // An exception might be thrown in this Symbian TInt error returning function.
- // It is caught and translated to an error code
- TInt QServerApp::Connect(const QString &serverName)
- {
- TPtrC name;
- TInt err;
- QT_TRYCATCH_ERROR(err, name.Set(qt_QString2TPtrC(serverName)));
- if (err != KErrNone)
- return err;
- return iServer.Connect(name);
- }
- \endcode
-}
-
- \sa QT_TRYCATCH_LEAVING(), QT_TRAP_THROWING()
-*/
-
-/*! \macro QT_TRYCATCH_LEAVING(function)
+/*!
+ \macro Q_DECL_CONSTEXPR
\relates <QtGlobal>
- \ingroup qts60
-
- Catch standard C++ exceptions from \a function and convert them to Symbian OS
- leaves. This must be used inside Qt or standard C++ code when using exception
- throwing code (practically anything) and returning to Symbian OS from a leaving function.
- For example inside a Symbian active object's \c RunL function implemented with Qt code.
-
- \warning This macro is only available on Symbian.
-
- Example:
-
- \code
- // This active object signals Qt code
- // Exceptions from the Qt code must be converted to Symbian OS leaves for the active scheduler
- void QWakeUpActiveObject::RunL()
- {
- iStatus = KRequestPending;
- SetActive();
- QT_TRYCATCH_LEAVING(m_dispatcher->wakeUpWasCalled());
- }
- \endcode
-
- \sa QT_TRAP_THROWING(), QT_TRYCATCH_ERROR()
-*/
-#include <stdexcept>
+ This macro can be used to declare variable that should be constructed at compile-time,
+ or an inline function that can be computed at compile-time.
-class QSymbianLeaveException : public std::exception
-{
-public:
- inline QSymbianLeaveException(int err) : error(err) {}
- inline const char* what() const throw() { return "Symbian leave exception"; }
-
-public:
- int error;
-};
-
-/*! \relates <QtGlobal>
- \ingroup qts60
-
- Throws an exception if the \a error parameter is a symbian error code.
- This is the exception throwing equivalent of Symbian's User::LeaveIfError.
-
- \warning This function is only available on Symbian.
-
- \sa qt_symbian_exception2LeaveL(), qt_symbian_exception2Error()
+ It expands to "constexpr" if your compiler supports that C++11 keyword, or to nothing
+ otherwise.
*/
-void qt_symbian_throwIfError(int error)
-{
- if (error >= KErrNone)
- return; // do nothing - not an exception
- switch (error) {
- case KErrNoMemory:
- throw std::bad_alloc();
- case KErrArgument:
- throw std::invalid_argument("from Symbian error");
- case KErrOverflow:
- throw std::overflow_error("from Symbian error");
- case KErrUnderflow:
- throw std::underflow_error("from Symbian error");
- default:
- throw QSymbianLeaveException(error);
- }
-}
-
-/*! \relates <QtGlobal>
- \ingroup qts60
-
- Convert a caught standard C++ exception \a aThrow to a Symbian leave
-
- \warning This function is only available on Symbian.
-
- \sa qt_symbian_throwIfError(), qt_symbian_exception2Error()
-*/
-void qt_symbian_exception2LeaveL(const std::exception& aThrow)
-{
- User::Leave(qt_symbian_exception2Error(aThrow));
-}
-
-/*! \relates <QtGlobal>
- \ingroup qts60
-
- Convert a caught standard C++ exception \a aThrow to a Symbian error code
-
- \warning This function is only available on Symbian.
-
- \sa qt_symbian_throwIfError(), qt_symbian_exception2LeaveL()
-*/
-int qt_symbian_exception2Error(const std::exception& aThrow)
-{
- const std::type_info& atype = typeid(aThrow);
- int err = KErrGeneral;
-
- if(atype == typeid (std::bad_alloc))
- err = KErrNoMemory;
- else if(atype == typeid(QSymbianLeaveException))
- err = static_cast<const QSymbianLeaveException&>(aThrow).error;
- else {
- if(atype == typeid(std::invalid_argument))
- err = KErrArgument;
- else if(atype == typeid(std::out_of_range))
- // std::out_of_range is of type logic_error which by definition means that it is
- // "presumably detectable before the program executes".
- // std::out_of_range is used to report an argument is not within the expected range.
- // The description of KErrArgument says an argument is out of range. Hence the mapping.
- err = KErrArgument;
- else if(atype == typeid(std::overflow_error))
- err = KErrOverflow;
- else if(atype == typeid(std::underflow_error))
- err = KErrUnderflow;
- qWarning("translation from std exception \"%s\" to %d", aThrow.what(), err);
- }
-
- return err;
-}
-#endif
QT_END_NAMESPACE
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index e22d66628e..fd5c5d6315 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -76,8 +76,12 @@
# define QT_END_NAMESPACE
# define QT_BEGIN_INCLUDE_NAMESPACE
# define QT_END_INCLUDE_NAMESPACE
+#ifndef QT_BEGIN_MOC_NAMESPACE
# define QT_BEGIN_MOC_NAMESPACE
+#endif
+#ifndef QT_END_MOC_NAMESPACE
# define QT_END_MOC_NAMESPACE
+#endif
# define QT_FORWARD_DECLARE_CLASS(name) class name;
# define QT_FORWARD_DECLARE_STRUCT(name) struct name;
# define QT_MANGLE_NAMESPACE(name) name
@@ -90,8 +94,12 @@
# define QT_END_NAMESPACE }
# define QT_BEGIN_INCLUDE_NAMESPACE }
# define QT_END_INCLUDE_NAMESPACE namespace QT_NAMESPACE {
+#ifndef QT_BEGIN_MOC_NAMESPACE
# define QT_BEGIN_MOC_NAMESPACE QT_USE_NAMESPACE
+#endif
+#ifndef QT_END_MOC_NAMESPACE
# define QT_END_MOC_NAMESPACE
+#endif
# define QT_FORWARD_DECLARE_CLASS(name) \
QT_BEGIN_NAMESPACE class name; QT_END_NAMESPACE \
using QT_PREPEND_NAMESPACE(name);
@@ -450,7 +458,6 @@ namespace QT_NAMESPACE {}
/* GCC 2.95 knows "using" but does not support it correctly */
# if __GNUC__ == 2 && __GNUC_MINOR__ <= 95
# define Q_NO_USING_KEYWORD
-# define QT_NO_STL_WCHAR
# endif
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
# define Q_ALIGNOF(type) __alignof__(type)
@@ -480,9 +487,13 @@ namespace QT_NAMESPACE {}
# define QT_NO_ARM_EABI
# endif
# endif
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
+# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
+# define Q_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
+# endif
+# if defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(__clang__) /* clang C++11 enablers are found below, don't do them here */
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
/* C++0x features supported in GCC 4.3: */
+# define Q_COMPILER_VARIADIC_MACROS
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_STATIC_ASSERT
@@ -509,6 +520,11 @@ namespace QT_NAMESPACE {}
# define Q_COMPILER_UNRESTRICTED_UNIONS
# define Q_COMPILER_RANGE_FOR
# endif
+# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407
+ /* C++0x features supported in GCC 4.7: */
+# define Q_COMPILER_EXPLICIT_OVERRIDES
+# define Q_COMPILER_FINAL
+# endif
# endif
@@ -541,7 +557,6 @@ namespace QT_NAMESPACE {}
# define Q_NO_BOOL_TYPE
# define Q_NO_EXPLICIT_KEYWORD
# define Q_NO_USING_KEYWORD
-# define Q_TYPENAME
# define Q_OUTOFLINE_TEMPLATE inline
# define Q_BROKEN_TEMPLATE_SPECIALIZATION
# define Q_CANNOT_DELETE_CONSTANT
@@ -575,7 +590,6 @@ namespace QT_NAMESPACE {}
/* Apply to all versions prior to Compaq C++ V6.0-000 - observed on
DEC C++ V5.5-004. */
# if __DECCXX_VER < 60060000
-# define Q_TYPENAME
# define Q_BROKEN_TEMPLATE_SPECIALIZATION
# define Q_CANNOT_DELETE_CONSTANT
# endif
@@ -773,6 +787,45 @@ namespace QT_NAMESPACE {}
# endif
#endif
+#ifdef Q_CC_CLANG
+/* General C++ features */
+# if !__has_feature(cxx_exceptions)
+# define QT_NO_EXCEPTIONS
+# endif
+# if !__has_feature(cxx_rtti)
+# define QT_NO_RTTI
+# endif
+/* C++11 features, see http://clang.llvm.org/cxx_status.html */
+# if __cplusplus >= 201103L || __GXX_EXPERIMENTAL_CXX0X__
+# if ((__clang_major__ * 100) + __clang_minor__) >= 209 /* since clang 2.9 */
+# define Q_COMPILER_AUTO_TYPE
+# define Q_COMPILER_DECLTYPE
+# define Q_COMPILER_EXTERN_TEMPLATES
+# define Q_COMPILER_RVALUE_REFS
+# define Q_COMPILER_STATIC_ASSERT
+# define Q_COMPILER_VARIADIC_MACROS
+# define Q_COMPILER_VARIADIC_TEMPLATES
+# endif
+# if ((__clang_major__ * 100) + __clang_minor__) >= 300 /* since clang 3.0 */
+# define Q_COMPILER_CLASS_ENUM
+ /* defaulted members in 3.0, deleted members in 2.9 */
+# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
+# define Q_COMPILER_EXPLICIT_OVERRIDES
+# define Q_COMPILER_NULLPTR
+# define Q_COMPILER_RANGE_FOR
+# define Q_COMPILER_UNICODE_STRINGS
+# endif
+# if 0 /*) not implemented in clang */
+# define Q_COMPILER_ATOMICS
+# define Q_COMPILER_CONSTEXPR
+# define Q_COMPILER_FINAL
+# define Q_COMPILER_INITIALIZER_LISTS
+# define Q_COMPILER_LAMBDA
+# define Q_COMPILER_UNRESTRICTED_UNIONS
+# endif
+# endif
+#endif
+
#ifndef Q_PACKED
# define Q_PACKED
# undef Q_NO_PACKED_REFERENCE
@@ -785,6 +838,10 @@ namespace QT_NAMESPACE {}
# define Q_UNLIKELY(x) (x)
#endif
+#ifndef Q_ALLOC_SIZE
+# define Q_ALLOC_SIZE(x)
+#endif
+
#ifndef Q_CONSTRUCTOR_FUNCTION
# define Q_CONSTRUCTOR_FUNCTION0(AFUNC) \
namespace { \
@@ -885,6 +942,7 @@ template <> struct QIntegerForSize<8> { typedef quint64 Unsigned; typedef qin
template <class T> struct QIntegerForSizeof: QIntegerForSize<sizeof(T)> { };
typedef QIntegerForSizeof<void*>::Unsigned quintptr;
typedef QIntegerForSizeof<void*>::Signed qptrdiff;
+typedef qptrdiff qintptr;
/*
Useful type definitions for Qt
@@ -907,14 +965,6 @@ QT_END_INCLUDE_NAMESPACE
*/
#ifndef QT_LINUXBASE /* the LSB defines TRUE and FALSE for us */
-/* Symbian OS defines TRUE = 1 and FALSE = 0,
-redefine to built-in booleans to make autotests work properly */
-#ifdef Q_OS_SYMBIAN
- #include <e32def.h> /* Symbian OS defines */
-
- #undef TRUE
- #undef FALSE
-#endif
# ifndef TRUE
# define TRUE true
# define FALSE false
@@ -1057,12 +1107,30 @@ redefine to built-in booleans to make autotests work properly */
# define Q_NULLPTR 0
#endif
+#ifdef Q_COMPILER_DEFAULT_DELETE_MEMBERS
+# define Q_DECL_EQ_DELETE = delete
+#else
+# define Q_DECL_EQ_DELETE
+#endif
+
#ifdef Q_COMPILER_CONSTEXPR
# define Q_DECL_CONSTEXPR constexpr
#else
# define Q_DECL_CONSTEXPR
#endif
+#ifdef Q_COMPILER_EXPLICIT_OVERRIDES
+# define Q_DECL_OVERRIDE override
+#else
+# define Q_DECL_OVERRIDE
+#endif
+
+#ifdef Q_COMPILER_FINAL
+# define Q_DECL_FINAL final
+#else
+# define Q_DECL_FINAL
+#endif
+
//defines the type for the WNDPROC on windows
//the alignment needs to be forced for sse2 to not crash with mingw
#if defined(Q_OS_WIN)
@@ -1079,7 +1147,7 @@ typedef int QNoImplicitBoolCast;
// This logic must match the one in qmetatype.h
#if defined(QT_COORD_TYPE)
typedef QT_COORD_TYPE qreal;
-#elif defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN)
+#elif defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE)
typedef float qreal;
#else
typedef double qreal;
@@ -1175,10 +1243,10 @@ class QDataStream;
/*
- Create Qt DLL if QT_DLL is defined (Windows and Symbian only)
+ Create Qt DLL if QT_DLL is defined (Windows only)
*/
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
# if defined(QT_NODLL)
# undef QT_MAKEDLL
# undef QT_DLL
@@ -1421,11 +1489,11 @@ class QDataStream;
for Qt's internal unit tests. If you want slower loading times and more
symbols that can vanish from version to version, feel free to define QT_BUILD_INTERNAL.
*/
-#if defined(QT_BUILD_INTERNAL) && (defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)) && defined(QT_MAKEDLL)
+#if defined(QT_BUILD_INTERNAL) && defined(Q_OS_WIN) && defined(QT_MAKEDLL)
# define Q_AUTOTEST_EXPORT Q_DECL_EXPORT
-#elif defined(QT_BUILD_INTERNAL) && (defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)) && defined(QT_DLL)
+#elif defined(QT_BUILD_INTERNAL) && defined(Q_OS_WIN) && defined(QT_DLL)
# define Q_AUTOTEST_EXPORT Q_DECL_IMPORT
-#elif defined(QT_BUILD_INTERNAL) && !(defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)) && defined(QT_SHARED)
+#elif defined(QT_BUILD_INTERNAL) && !defined(Q_OS_WIN) && defined(QT_SHARED)
# define Q_AUTOTEST_EXPORT Q_DECL_EXPORT
#else
# define Q_AUTOTEST_EXPORT
@@ -1558,35 +1626,6 @@ public:
};
static const MacVersion MacintoshVersion;
#endif
-#ifdef Q_OS_SYMBIAN
- enum SymbianVersion {
- SV_Unknown = 1000000, // Assume unknown is something newer than what is supported
- //These are the Symbian Ltd versions 9.2-9.4
- SV_9_2 = 10,
- SV_9_3 = 20,
- SV_9_4 = 30,
- //Following values are the symbian foundation versions, i.e. Symbian^1 == SV_SF_1
- SV_SF_1 = SV_9_4,
- SV_SF_2 = 40,
- SV_SF_3 = 50,
- SV_SF_4 = 60, // Deprecated
- SV_API_5_3 = 70,
- SV_API_5_4 = 80
- };
- static SymbianVersion symbianVersion();
- enum S60Version {
- SV_S60_None = 0,
- SV_S60_Unknown = SV_Unknown,
- SV_S60_3_1 = SV_9_2,
- SV_S60_3_2 = SV_9_3,
- SV_S60_5_0 = SV_9_4,
- SV_S60_5_1 = SV_SF_2, // Deprecated
- SV_S60_5_2 = SV_SF_3,
- SV_S60_5_3 = SV_API_5_3,
- SV_S60_5_4 = SV_API_5_4
- };
- static S60Version s60Version();
-#endif
};
Q_CORE_EXPORT const char *qVersion();
@@ -1603,10 +1642,6 @@ inline int qMacVersion() { return QSysInfo::MacintoshVersion; }
# define Q_INLINE_TEMPLATE inline
#endif
-#ifndef Q_TYPENAME
-# define Q_TYPENAME typename
-#endif
-
/*
Avoid "unused parameter" warnings
*/
@@ -1623,15 +1658,6 @@ inline void qUnused(T &x) { (void)x; }
Debugging and error handling
*/
-/*
- On Symbian we do not know beforehand whether we are compiling in
- release or debug mode, so check the Symbian build define here,
- and set the QT_NO_DEBUG define appropriately.
-*/
-#if defined(Q_OS_SYMBIAN) && defined(NDEBUG) && !defined(QT_NO_DEBUG)
-# define QT_NO_DEBUG
-#endif
-
#if !defined(QT_NO_DEBUG) && !defined(QT_DEBUG)
# define QT_DEBUG
#endif
@@ -1668,10 +1694,6 @@ Q_CORE_EXPORT void qFatal(const char *, ...) /* print fatal message and exit */
Q_CORE_EXPORT void qErrnoWarning(int code, const char *msg, ...);
Q_CORE_EXPORT void qErrnoWarning(const char *msg, ...);
-#if (defined(QT_NO_DEBUG_OUTPUT) || defined(QT_NO_TEXTSTREAM)) && !defined(QT_NO_DEBUG_STREAM)
-#define QT_NO_DEBUG_STREAM
-#endif
-
/*
Forward declarations only.
@@ -1679,13 +1701,19 @@ Q_CORE_EXPORT void qErrnoWarning(const char *msg, ...);
*/
class QDebug;
class QNoDebug;
-#ifndef QT_NO_DEBUG_STREAM
+#if !defined(QT_NO_DEBUG_OUTPUT) && !defined(QT_NO_DEBUG_STREAM)
Q_CORE_EXPORT_INLINE QDebug qDebug();
-Q_CORE_EXPORT_INLINE QDebug qWarning();
-Q_CORE_EXPORT_INLINE QDebug qCritical();
#else
inline QNoDebug qDebug();
#endif
+#if !defined(QT_NO_WARNING_OUTPUT) && !defined(QT_NO_DEBUG_STREAM)
+Q_CORE_EXPORT_INLINE QDebug qWarning();
+#else
+inline QNoDebug qWarning();
+#endif
+#if !defined(QT_NO_DEBUG_STREAM)
+Q_CORE_EXPORT_INLINE QDebug qCritical();
+#endif
#define QT_NO_QDEBUG_MACRO while (false) qDebug
#ifdef QT_NO_DEBUG_OUTPUT
@@ -1714,10 +1742,10 @@ Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line);
Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line);
#if !defined(Q_ASSERT_X)
-# ifndef QT_NO_DEBUG
-# define Q_ASSERT_X(cond, where, what) ((!(cond)) ? qt_assert_x(where, what,__FILE__,__LINE__) : qt_noop())
-# else
+# if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
# define Q_ASSERT_X(cond, where, what) qt_noop()
+# else
+# define Q_ASSERT_X(cond, where, what) ((!(cond)) ? qt_assert_x(where, what,__FILE__,__LINE__) : qt_noop())
# endif
#endif
@@ -1733,7 +1761,7 @@ template <> class QStaticAssertFailure<true> {};
#define Q_STATIC_ASSERT_PRIVATE_JOIN(A, B) Q_STATIC_ASSERT_PRIVATE_JOIN_IMPL(A, B)
#define Q_STATIC_ASSERT_PRIVATE_JOIN_IMPL(A, B) A ## B
#define Q_STATIC_ASSERT(Condition) \
- enum {Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, __LINE__) = sizeof(QStaticAssertFailure<(bool)(Condition)>)}
+ enum {Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, __LINE__) = sizeof(QStaticAssertFailure<(Condition)>)}
#define Q_STATIC_ASSERT_X(Condition, Message) Q_STATIC_ASSERT(Condition)
#endif
@@ -1758,7 +1786,7 @@ inline T *q_check_ptr(T *p) { Q_CHECK_PTR(p); return p; }
#elif defined(_MSC_VER)
# define Q_FUNC_INFO __FUNCSIG__
#else
-# if defined(Q_OS_SOLARIS) || defined(Q_CC_XLC) || defined(Q_OS_SYMBIAN)
+# if defined(Q_OS_SOLARIS) || defined(Q_CC_XLC)
# define Q_FUNC_INFO __FILE__ "(line number unavailable)"
# else
/* These two macros makes it possible to turn the builtin line expander into a
@@ -2027,6 +2055,19 @@ public:
};
};
+template<>
+class QTypeInfo<void>
+{
+public:
+ enum {
+ isPointer = false,
+ isComplex = false,
+ isStatic = false,
+ isLarge = false,
+ isDummy = false
+ };
+};
+
template <typename T>
class QTypeInfo<T*>
{
@@ -2140,11 +2181,11 @@ Q_DECLARE_TYPEINFO(long double, Q_PRIMITIVE_TYPE);
These functions make it possible to use standard C++ functions with
a similar name from Qt header files (especially template classes).
*/
-Q_CORE_EXPORT void *qMalloc(size_t size);
+Q_CORE_EXPORT void *qMalloc(size_t size) Q_ALLOC_SIZE(1);
Q_CORE_EXPORT void qFree(void *ptr);
-Q_CORE_EXPORT void *qRealloc(void *ptr, size_t size);
-Q_CORE_EXPORT void *qMallocAligned(size_t size, size_t alignment);
-Q_CORE_EXPORT void *qReallocAligned(void *ptr, size_t size, size_t oldsize, size_t alignment);
+Q_CORE_EXPORT void *qRealloc(void *ptr, size_t size) Q_ALLOC_SIZE(2);
+Q_CORE_EXPORT void *qMallocAligned(size_t size, size_t alignment) Q_ALLOC_SIZE(1);
+Q_CORE_EXPORT void *qReallocAligned(void *ptr, size_t size, size_t oldsize, size_t alignment) Q_ALLOC_SIZE(2);
Q_CORE_EXPORT void qFreeAligned(void *ptr);
Q_CORE_EXPORT void *qMemCopy(void *dest, const void *src, size_t n);
Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n);
@@ -2418,15 +2459,9 @@ Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1);
classes contains a private copy constructor and assignment
operator to disable copying (the compiler gives an error message).
*/
-#ifdef Q_COMPILER_DEFAULT_DELETE_MEMBERS
#define Q_DISABLE_COPY(Class) \
- Class(const Class &) = delete;\
- Class &operator=(const Class &) = delete;
-#else
-#define Q_DISABLE_COPY(Class) \
- Class(const Class &); \
- Class &operator=(const Class &);
-#endif
+ Class(const Class &) Q_DECL_EQ_DELETE;\
+ Class &operator=(const Class &) Q_DECL_EQ_DELETE;
class QByteArray;
Q_CORE_EXPORT QByteArray qgetenv(const char *varName);
@@ -2441,77 +2476,6 @@ inline int qIntCast(float f) { return int(f); }
Q_CORE_EXPORT void qsrand(uint seed);
Q_CORE_EXPORT int qrand();
-#if defined(Q_OS_SYMBIAN)
-
-#ifdef SYMBIAN_BUILD_GCE
-#define Q_SYMBIAN_SUPPORTS_SURFACES
-//RWsPointerCursor is fixed, so don't use low performance sprites
-#define Q_SYMBIAN_FIXED_POINTER_CURSORS
-#define Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE
-#define Q_SYMBIAN_WINDOW_SIZE_CACHE
-#define QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
-
-//enabling new graphics resources
-#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
-# define QT_SYMBIAN_SUPPORTS_SGIMAGE
-#endif
-
-#ifdef SYMBIAN_GRAPHICS_SET_SURFACE_TRANSPARENCY_AVAILABLE
-# define Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE
-#endif
-
-#ifdef SYMBIAN_GRAPHICS_TRANSITION_EFFECTS_SIGNALING_AVAILABLE
-# define Q_SYMBIAN_TRANSITION_EFFECTS
-#endif
-#endif
-
-#ifdef SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS
-#define Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS
-#endif
-
-#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
-#define Q_SYMBIAN_SUPPORTS_FIXNATIVEORIENTATION
-#endif
-
-//Symbian does not support data imports from a DLL
-#define Q_NO_DATA_RELOCATION
-
-QT_END_NAMESPACE
-// forward declare std::exception
-#ifdef __cplusplus
-namespace std { class exception; }
-#endif
-QT_BEGIN_NAMESPACE
-Q_CORE_EXPORT void qt_symbian_throwIfError(int error);
-Q_CORE_EXPORT void qt_symbian_exception2LeaveL(const std::exception& ex);
-Q_CORE_EXPORT int qt_symbian_exception2Error(const std::exception& ex);
-
-#define QT_TRAP_THROWING(_f) \
- { \
- TInt ____error; \
- TRAP(____error, _f); \
- qt_symbian_throwIfError(____error); \
- }
-
-#define QT_TRYCATCH_ERROR(_err, _f) \
- { \
- _err = KErrNone; \
- try { \
- _f; \
- } catch (const std::exception &____ex) { \
- _err = qt_symbian_exception2Error(____ex); \
- } \
- }
-
-#define QT_TRYCATCH_LEAVING(_f) \
- { \
- TInt ____err; \
- QT_TRYCATCH_ERROR(____err, _f) \
- User::LeaveIfError(____err); \
- }
-#endif
-
-
/*
This gives us the possibility to check which modules the user can
use. These are purely compile time checks and will generate no code.
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 7868d3db59..375349c18d 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -498,7 +498,7 @@ extern "C" void qt_core_boilerplate();
void qt_core_boilerplate()
{
printf("This is the QtCore library version " QT_VERSION_STR "\n"
- "Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).\n"
+ "Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).\n"
"Contact: Nokia Corporation (qt-info@nokia.com)\n"
"\n"
"Build date: %s\n"
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index 8d1607d045..21fcdeb62c 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/global/qmalloc.cpp b/src/corelib/global/qmalloc.cpp
index 466f70614d..2ec6938f98 100644
--- a/src/corelib/global/qmalloc.cpp
+++ b/src/corelib/global/qmalloc.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -78,7 +78,7 @@ void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t align
void *actualptr = oldptr ? static_cast<void **>(oldptr)[-1] : 0;
if (alignment <= sizeof(void*)) {
// special, fast case
- void **newptr = static_cast<void **>(qRealloc(actualptr, newsize + sizeof(void*)));
+ void **newptr = static_cast<void **>(realloc(actualptr, newsize + sizeof(void*)));
if (!newptr)
return 0;
if (newptr == actualptr) {
@@ -90,7 +90,7 @@ void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t align
return newptr + 1;
}
- // qMalloc returns pointers aligned at least at sizeof(size_t) boundaries
+ // malloc returns pointers aligned at least at sizeof(size_t) boundaries
// but usually more (8- or 16-byte boundaries).
// So we overallocate by alignment-sizeof(size_t) bytes, so we're guaranteed to find a
// somewhere within the first alignment-sizeof(size_t) that is properly aligned.
@@ -98,7 +98,7 @@ void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t align
// However, we need to store the actual pointer, so we need to allocate actually size +
// alignment anyway.
- void *real = qRealloc(actualptr, newsize + alignment);
+ void *real = realloc(actualptr, newsize + alignment);
if (!real)
return 0;
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index b6e2384ea0..ee4000498f 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -61,7 +61,7 @@ Qt {
Q_OBJECT
#endif
-#if (defined(Q_MOC_RUN) || defined(QT_JAMBI_RUN))
+#if defined(Q_MOC_RUN)
// NOTE: Generally, do not add Q_ENUMS if a corresponding Q_FLAGS exists.
Q_ENUMS(ScrollBarPolicy FocusPolicy ContextMenuPolicy)
Q_ENUMS(ArrowType ToolButtonStyle PenStyle PenCapStyle PenJoinStyle BrushStyle)
@@ -97,7 +97,8 @@ Qt {
Q_ENUMS(GestureType)
#endif
Q_ENUMS(CursorMoveStyle)
-#endif // (defined(Q_MOC_RUN) || defined(QT_JAMBI_RUN))
+ Q_ENUMS(TimerType)
+#endif // defined(Q_MOC_RUN)
#if defined(Q_MOC_RUN)
public:
@@ -461,25 +462,8 @@ public:
WA_MergeSoftkeys = 124,
WA_MergeSoftkeysRecursively = 125,
-#if 0 // these values are reserved for Maemo5 - do not re-use them
- WA_Maemo5NonComposited = 126,
- WA_Maemo5StackedWindow = 127,
-#endif
-
- WA_LockPortraitOrientation = 128,
- WA_LockLandscapeOrientation = 129,
- WA_AutoOrientation = 130,
-
-#if 0 // these values are reserved for Maemo5 - do not re-use them
- WA_Maemo5PortraitOrientation = WA_LockPortraitOrientation,
- WA_Maemo5LandscapeOrientation = WA_LockLandscapeOrientation,
- WA_Maemo5AutoOrientation = WA_AutoOrientation,
- WA_Maemo5ShowProgressIndicator = 131,
-#endif
-
- WA_X11DoNotAcceptFocus = 132,
- WA_SymbianNoSystemRotation = 133,
- WA_MacNoShadow = 134,
+ WA_X11DoNotAcceptFocus = 126,
+ WA_MacNoShadow = 127,
// Add new attributes before this line
WA_AttributeCount
@@ -495,9 +479,10 @@ public:
AA_MacPluginApplication = 5,
AA_DontUseNativeMenuBar = 6,
AA_MacDontSwapCtrlAndMeta = 7,
- AA_S60DontConstructApplicationPanes = 8,
- AA_S60DisablePartialScreenInputMode = 9,
+ AA_Use96Dpi = 8,
AA_X11InitThreads = 10,
+ AA_SynthesizeTouchForUnhandledMouseEvents = 11,
+ AA_SynthesizeMouseForUnhandledTouchEvents = 12,
// Add new attributes before this line
AA_AttributeCount
@@ -1313,7 +1298,8 @@ public:
ImhDate = 0x80,
ImhTime = 0x100,
- ImhMultiLine = 0x200,
+
+ ImhPreferLatin = 0x200,
ImhDigitsOnly = 0x10000,
ImhFormattedNumbersOnly = 0x20000,
@@ -1322,6 +1308,7 @@ public:
ImhDialableCharactersOnly = 0x100000,
ImhEmailCharactersOnly = 0x200000,
ImhUrlCharactersOnly = 0x400000,
+ ImhLatinOnly = 0x800000,
ImhExclusiveInputMask = 0xffff0000
};
@@ -1400,7 +1387,7 @@ public:
StatusTipPropertyRole = 30,
WhatsThisPropertyRole = 31,
// Reserved
- UserRole = 32
+ UserRole = 0x0100
};
enum ItemFlag {
@@ -1495,10 +1482,7 @@ public:
TouchPointPressed = 0x01,
TouchPointMoved = 0x02,
TouchPointStationary = 0x04,
- TouchPointReleased = 0x08,
- TouchPointStateMask = 0x0f,
-
- TouchPointPrimary = 0x10
+ TouchPointReleased = 0x08
};
Q_DECLARE_FLAGS(TouchPointStates, TouchPointState)
@@ -1547,6 +1531,12 @@ public:
LogicalMoveStyle,
VisualMoveStyle
};
+
+ enum TimerType {
+ PreciseTimer,
+ CoarseTimer,
+ VeryCoarseTimer
+ };
}
#ifdef Q_MOC_RUN
;
@@ -1566,6 +1556,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::DropActions)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::ItemFlags)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::MatchFlags)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TextInteractionFlags)
+Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::InputMethodQueries)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::InputMethodHints)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TouchPointStates)
#ifndef QT_NO_GESTURES
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 63ac4a95be..3add1a48c7 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -167,6 +167,15 @@
construction in order to make Xlib calls thread-safe. This
attribute must be set before QApplication is constructed.
+ \value AA_SynthesizeTouchForUnhandledMouseEvents All mouse events
+ that are not accepted by the application will be translated
+ to touch events instead.
+
+ \value AA_SynthesizeMouseForUnhandledTouchEvents All touch events
+ that are not accepted by the application will be translated
+ to left button mouse events instead. This attribute is enabled
+ by default.
+
\omitvalue AA_AttributeCount
*/
@@ -1158,13 +1167,6 @@
to this top level window. This attribute has no effect on non-X11
platforms.
- \value WA_LockPortraitOrientation Locks the widget to a portrait orientation,
- ignoring changes to the display's orientation with respect to the user.
- \value WA_LockLandscapeOrientation Locks the widget to a landscape orientation,
- ignoring changes to the display's orientation with respect to the user.
- \value WA_AutoOrientation Causes the widget to change orientation whenever the
- display changes orientation with respect to the user.
-
\value WA_MacNoShadow Since Qt 4.8, this attribute disables drop shadows
for this top level window. Only affects Cocoa builds of Qt for Mac OS X.
@@ -1198,7 +1200,6 @@
\omitvalue WA_SetWindowModality
\omitvalue WA_WState_WindowOpacitySet
\omitvalue WA_WState_AcceptedTouchBeginEvent
- \omitvalue WA_SymbianNoSystemRotation
*/
/*! \typedef Qt::HANDLE
@@ -2437,7 +2438,7 @@
\value ImhDate The text editor functions as a date field.
\value ImhTime The text editor functions as a time field.
- \value ImhMultiLine The text editor accepts multi-line content.
+ \value ImhPreferLatin Latin characters are preferred (but not required).
Flags that restrict input (exclusive flags):
@@ -2448,6 +2449,7 @@
\value ImhDialableCharactersOnly Only characters suitable for phone dialing are allowed.
\value ImhEmailCharactersOnly Only characters suitable for email addresses are allowed.
\value ImhUrlCharactersOnly Only characters suitable for URLs are allowed.
+ \value ImhLatinOnly Only latin based input is allowed.
Masks:
@@ -2873,3 +2875,27 @@
\sa QApplication::setNavigationMode()
\sa QApplication::navigationMode()
*/
+
+/*!
+ \enum Qt::TimerType
+
+ The timer type indicates how accurate a timer can be.
+
+ \value PreciseTimer Precise timers try to keep millisecond accuracy
+ \value CoarseTimer Coarse timers try to keep accuracy within 5% of the desired interval
+ \value VeryCoarseTimer Very coarse timers only keep full second accuracy
+
+ On UNIX (including Linux and Mac OS X), Qt will keep millisecond accuracy
+ for Qt::PreciseTimer. For Qt::CoarseTimer, the interval will be adjusted up
+ to 5% to align the timer with other timers that are expected to fire at or
+ around the same time. The objective is to make most timers wake up at the
+ same time, thereby reducing CPU wakeups and power consumption.
+
+ On Windows, Qt will use Windows's Multimedia timer facility (if available)
+ for Qt::PreciseTimer and normal Windows timers for Qt::CoarseTimer and
+ Qt::VeryCoarseTimer.
+
+ On all platforms, the interval for Qt::VeryCoarseTimer is rounded to the
+ nearest full second (e.g. an interval of 23500ms will be rounded to
+ 24000ms, and 20300ms to 20000ms).
+*/
diff --git a/src/corelib/global/qnumeric.cpp b/src/corelib/global/qnumeric.cpp
index 621b9885b0..7677d86db0 100644
--- a/src/corelib/global/qnumeric.cpp
+++ b/src/corelib/global/qnumeric.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/global/qnumeric.h b/src/corelib/global/qnumeric.h
index bd8c2a4237..9f5ce691b1 100644
--- a/src/corelib/global/qnumeric.h
+++ b/src/corelib/global/qnumeric.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h
index 336b348f3f..94d64409b3 100644
--- a/src/corelib/global/qnumeric_p.h
+++ b/src/corelib/global/qnumeric_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/global/qt_pch.h b/src/corelib/global/qt_pch.h
index 0926e02af1..a16e6be567 100644
--- a/src/corelib/global/qt_pch.h
+++ b/src/corelib/global/qt_pch.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h
index ba4041e765..3081645b6b 100644
--- a/src/corelib/global/qt_windows.h
+++ b/src/corelib/global/qt_windows.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index ef11621679..1d31e5d794 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -35,6 +35,7 @@ HEADERS += \
io/qfsfileengine_iterator_p.h \
io/qfilesystemwatcher.h \
io/qfilesystemwatcher_p.h \
+ io/qfilesystemwatcher_polling_p.h \
io/qfilesystementry_p.h \
io/qfilesystemengine_p.h \
io/qfilesystemmetadata_p.h \
@@ -65,36 +66,39 @@ SOURCES += \
io/qfsfileengine.cpp \
io/qfsfileengine_iterator.cpp \
io/qfilesystemwatcher.cpp \
+ io/qfilesystemwatcher_polling.cpp \
io/qfilesystementry.cpp \
io/qfilesystemengine.cpp
win32 {
SOURCES += io/qsettings_win.cpp
- SOURCES += io/qprocess_win.cpp
SOURCES += io/qfsfileengine_win.cpp
SOURCES += io/qfilesystemwatcher_win.cpp
HEADERS += io/qfilesystemwatcher_win_p.h
+ HEADERS += io/qwindowspipereader_p.h
+ SOURCES += io/qwindowspipereader.cpp
HEADERS += io/qwindowspipewriter_p.h
SOURCES += io/qwindowspipewriter.cpp
SOURCES += io/qfilesystemengine_win.cpp
SOURCES += io/qfilesystemiterator_win.cpp
SOURCES += io/qstandardpaths_win.cpp
-} else:unix {
- SOURCES += io/qfsfileengine_unix.cpp
- symbian {
- SOURCES += io/qfilesystemengine_symbian.cpp
- SOURCES += io/qprocess_symbian.cpp
- SOURCES += io/qfilesystemiterator_symbian.cpp
- } else {
- SOURCES += io/qfilesystemengine_unix.cpp
- SOURCES += io/qprocess_unix.cpp
- SOURCES += io/qfilesystemiterator_unix.cpp
- }
+
+ wince* {
+ SOURCES += io/qprocess_wince.cpp
+ } else {
+ SOURCES += io/qprocess_win.cpp
+ }
+} else:unix|integrity {
+ SOURCES += \
+ io/qfsfileengine_unix.cpp \
+ io/qfilesystemengine_unix.cpp \
+ io/qprocess_unix.cpp \
+ io/qfilesystemiterator_unix.cpp \
+
!nacl:macx-*: {
- HEADERS += io/qfilesystemwatcher_fsevents_p.h
SOURCES += io/qfilesystemengine_mac.cpp
- SOURCES += io/qsettings_mac.cpp io/qfilesystemwatcher_fsevents.cpp
+ SOURCES += io/qsettings_mac.cpp
}
macx-*: {
SOURCES += io/qstandardpaths_mac.cpp
@@ -102,14 +106,9 @@ win32 {
SOURCES += io/qstandardpaths_unix.cpp
}
- linux-*:!symbian {
- SOURCES += \
- io/qfilesystemwatcher_inotify.cpp \
- io/qfilesystemwatcher_dnotify.cpp
-
- HEADERS += \
- io/qfilesystemwatcher_inotify_p.h \
- io/qfilesystemwatcher_dnotify_p.h
+ linux-* {
+ SOURCES += io/qfilesystemwatcher_inotify.cpp
+ HEADERS += io/qfilesystemwatcher_inotify_p.h
}
!nacl {
@@ -118,17 +117,5 @@ win32 {
HEADERS += io/qfilesystemwatcher_kqueue_p.h
}
}
-
- symbian {
- SOURCES += io/qfilesystemwatcher_symbian.cpp
- HEADERS += io/qfilesystemwatcher_symbian_p.h
- INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
- LIBS += -lplatformenv -lesock
- }
-}
-integrity {
- SOURCES += io/qfsfileengine_unix.cpp \
- io/qfsfileengine_iterator.cpp \
- io/qfilesystemengine_unix.cpp \
- io/qfilesystemiterator_unix.cpp
}
+
diff --git a/src/corelib/io/qabstractfileengine.cpp b/src/corelib/io/qabstractfileengine.cpp
index d2b250d336..c315d33606 100644
--- a/src/corelib/io/qabstractfileengine.cpp
+++ b/src/corelib/io/qabstractfileengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qabstractfileengine.h b/src/corelib/io/qabstractfileengine.h
index cc167a2aa6..c9bab7d435 100644
--- a/src/corelib/io/qabstractfileengine.h
+++ b/src/corelib/io/qabstractfileengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qabstractfileengine_p.h b/src/corelib/io/qabstractfileengine_p.h
index dd9a707316..72b8339e39 100644
--- a/src/corelib/io/qabstractfileengine_p.h
+++ b/src/corelib/io/qabstractfileengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qbuffer.cpp b/src/corelib/io/qbuffer.cpp
index 35e7b6809c..a5e605b9d5 100644
--- a/src/corelib/io/qbuffer.cpp
+++ b/src/corelib/io/qbuffer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -143,12 +143,8 @@ QByteArray QBufferPrivate::peek(qint64 maxSize)
QBuffer emits readyRead() when new data has arrived in the
buffer. By connecting to this signal, you can use QBuffer to
- store temporary data before processing it. For example, you can
- pass the buffer to QFtp when downloading a file from an FTP
- server. Whenever a new payload of data has been downloaded,
- readyRead() is emitted, and you can process the data that just
- arrived. QBuffer also emits bytesWritten() every time new data
- has been written to the buffer.
+ store temporary data before processing it. QBuffer also emits
+ bytesWritten() every time new data has been written to the buffer.
\sa QFile, QDataStream, QTextStream, QByteArray
*/
diff --git a/src/corelib/io/qbuffer.h b/src/corelib/io/qbuffer.h
index 9227a2f3dc..b222c7d6ca 100644
--- a/src/corelib/io/qbuffer.h
+++ b/src/corelib/io/qbuffer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index 0e0a47267a..fb2528e45f 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h
index 1ae0573f6c..30cf8417ad 100644
--- a/src/corelib/io/qdatastream.h
+++ b/src/corelib/io/qdatastream.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qdatastream_p.h b/src/corelib/io/qdatastream_p.h
index d372d54e36..2501e98d1d 100644
--- a/src/corelib/io/qdatastream_p.h
+++ b/src/corelib/io/qdatastream_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qdataurl.cpp b/src/corelib/io/qdataurl.cpp
index ed8abdd839..7e856ad647 100644
--- a/src/corelib/io/qdataurl.cpp
+++ b/src/corelib/io/qdataurl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -51,51 +51,49 @@ QT_BEGIN_NAMESPACE
Decode a data: URL into its mimetype and payload. Returns a null string if
the URL could not be decoded.
*/
-Q_CORE_EXPORT QPair<QString, QByteArray> qDecodeDataUrl(const QUrl &uri)
+Q_CORE_EXPORT bool qDecodeDataUrl(const QUrl &uri, QString &mimeType, QByteArray &payload)
{
- QString mimeType;
- QByteArray payload;
+ if (uri.scheme() != QLatin1String("data") || !uri.host().isEmpty())
+ return false;
- if (uri.scheme() == QLatin1String("data") && uri.host().isEmpty()) {
- mimeType = QLatin1String("text/plain;charset=US-ASCII");
+ mimeType = QLatin1String("text/plain;charset=US-ASCII");
- // the following would have been the correct thing, but
- // reality often differs from the specification. People have
- // data: URIs with ? and #
- //QByteArray data = QByteArray::fromPercentEncoding(uri.encodedPath());
- QByteArray data = QByteArray::fromPercentEncoding(uri.toEncoded());
+ // the following would have been the correct thing, but
+ // reality often differs from the specification. People have
+ // data: URIs with ? and #
+ //QByteArray data = QByteArray::fromPercentEncoding(uri.encodedPath());
+ QByteArray data = QByteArray::fromPercentEncoding(uri.toEncoded());
- // remove the data: scheme
- data.remove(0, 5);
+ // remove the data: scheme
+ data.remove(0, 5);
- // parse it:
- int pos = data.indexOf(',');
- if (pos != -1) {
- payload = data.mid(pos + 1);
- data.truncate(pos);
- data = data.trimmed();
+ // parse it:
+ int pos = data.indexOf(',');
+ if (pos != -1) {
+ payload = data.mid(pos + 1);
+ data.truncate(pos);
+ data = data.trimmed();
- // find out if the payload is encoded in Base64
- if (data.endsWith(";base64")) {
- payload = QByteArray::fromBase64(payload);
- data.chop(7);
- }
+ // find out if the payload is encoded in Base64
+ if (data.endsWith(";base64")) {
+ payload = QByteArray::fromBase64(payload);
+ data.chop(7);
+ }
- if (data.toLower().startsWith("charset")) {
- int i = 7; // strlen("charset")
- while (data.at(i) == ' ')
- ++i;
- if (data.at(i) == '=')
- data.prepend("text/plain;");
- }
+ if (data.toLower().startsWith("charset")) {
+ int i = 7; // strlen("charset")
+ while (data.at(i) == ' ')
+ ++i;
+ if (data.at(i) == '=')
+ data.prepend("text/plain;");
+ }
- if (!data.isEmpty())
- mimeType = QLatin1String(data.trimmed());
+ if (!data.isEmpty())
+ mimeType = QLatin1String(data.trimmed());
- }
}
- return QPair<QString,QByteArray>(mimeType,payload);
+ return true;
}
QT_END_NAMESPACE
diff --git a/src/corelib/io/qdataurl_p.h b/src/corelib/io/qdataurl_p.h
index d666d9e52a..b92f363e1d 100644
--- a/src/corelib/io/qdataurl_p.h
+++ b/src/corelib/io/qdataurl_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -60,7 +60,7 @@
QT_BEGIN_NAMESPACE
-Q_CORE_EXPORT QPair<QString, QByteArray> qDecodeDataUrl(const QUrl &url);
+Q_CORE_EXPORT bool qDecodeDataUrl(const QUrl &url, QString &mimeType, QByteArray &payload);
QT_END_NAMESPACE
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp
index a27716b8dc..8ca15b19ca 100644
--- a/src/corelib/io/qdebug.cpp
+++ b/src/corelib/io/qdebug.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index 67221c7ce2..54663d5d65 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -129,10 +129,8 @@ public:
inline QNoDebug(){}
inline QNoDebug(const QDebug &){}
inline ~QNoDebug(){}
-#if !defined( QT_NO_TEXTSTREAM )
inline QNoDebug &operator<<(QTextStreamFunction) { return *this; }
inline QNoDebug &operator<<(QTextStreamManipulator) { return *this; }
-#endif
inline QNoDebug &space() { return *this; }
inline QNoDebug &nospace() { return *this; }
inline QNoDebug &maybeSpace() { return *this; }
@@ -141,8 +139,6 @@ public:
inline QNoDebug &operator<<(const T &) { return *this; }
};
-Q_CORE_EXPORT_INLINE QDebug qCritical() { return QDebug(QtCriticalMsg); }
-
inline QDebug &QDebug::operator=(const QDebug &other)
{
if (this != &other) {
@@ -161,7 +157,7 @@ inline QDebug operator<<(QDebug debug, const QList<T> &list)
#endif
{
debug.nospace() << '(';
- for (Q_TYPENAME QList<T>::size_type i = 0; i < list.count(); ++i) {
+ for (typename QList<T>::size_type i = 0; i < list.count(); ++i) {
if (i)
debug << ", ";
debug << list.at(i);
@@ -275,17 +271,15 @@ inline QDebug operator<<(QDebug debug, const QFlags<T> &flags)
return debug.space();
}
-#if !defined(QT_NO_DEBUG_STREAM)
+#if !defined(QT_NO_DEBUG_OUTPUT) && !defined(QT_NO_DEBUG_STREAM)
Q_CORE_EXPORT_INLINE QDebug qDebug() { return QDebug(QtDebugMsg); }
-
-#else // QT_NO_DEBUG_STREAM
+#else
#undef qDebug
inline QNoDebug qDebug() { return QNoDebug(); }
#define qDebug QT_NO_QDEBUG_MACRO
-
#endif
-#if !defined(QT_NO_WARNING_OUTPUT)
+#if !defined(QT_NO_WARNING_OUTPUT) && !defined(QT_NO_DEBUG_STREAM)
Q_CORE_EXPORT_INLINE QDebug qWarning() { return QDebug(QtWarningMsg); }
#else
#undef qWarning
@@ -293,6 +287,11 @@ inline QNoDebug qWarning() { return QNoDebug(); }
#define qWarning QT_NO_QWARNING_MACRO
#endif
+#if !defined(QT_NO_DEBUG_STREAM)
+Q_CORE_EXPORT_INLINE QDebug qCritical() { return QDebug(QtCriticalMsg); }
+#endif
+
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 44992fcd14..d6979bad57 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1502,7 +1502,7 @@ bool QDir::removeRecursively()
di.next();
const QFileInfo& fi = di.fileInfo();
bool ok;
- if (fi.isDir())
+ if (fi.isDir() && !fi.isSymLink())
ok = QDir(di.filePath()).removeRecursively(); // recursive
else
ok = QFile::remove(di.filePath());
diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h
index e246f2f1aa..5b058272e7 100644
--- a/src/corelib/io/qdir.h
+++ b/src/corelib/io/qdir.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qdir_p.h b/src/corelib/io/qdir_p.h
index a34427a716..7865c1d5a3 100644
--- a/src/corelib/io/qdir_p.h
+++ b/src/corelib/io/qdir_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp
index 0b02adb4b6..28aa4a0f59 100644
--- a/src/corelib/io/qdiriterator.cpp
+++ b/src/corelib/io/qdiriterator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qdiriterator.h b/src/corelib/io/qdiriterator.h
index 5ad8acb496..be03415372 100644
--- a/src/corelib/io/qdiriterator.h
+++ b/src/corelib/io/qdiriterator.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index d5118525cf..95d842da42 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfile.h b/src/corelib/io/qfile.h
index 554b2954e1..903ba13963 100644
--- a/src/corelib/io/qfile.h
+++ b/src/corelib/io/qfile.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfile_p.h b/src/corelib/io/qfile_p.h
index 3072f5bc9e..24013c3c3d 100644
--- a/src/corelib/io/qfile_p.h
+++ b/src/corelib/io/qfile_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index 1ea6c8d50a..226b5d3560 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfileinfo.h b/src/corelib/io/qfileinfo.h
index ef4573132c..6d6da3527a 100644
--- a/src/corelib/io/qfileinfo.h
+++ b/src/corelib/io/qfileinfo.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfileinfo_p.h b/src/corelib/io/qfileinfo_p.h
index 23ea0225f5..64e644f29f 100644
--- a/src/corelib/io/qfileinfo_p.h
+++ b/src/corelib/io/qfileinfo_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp
index 72900ec033..ab10f30585 100644
--- a/src/corelib/io/qfilesystemengine.cpp
+++ b/src/corelib/io/qfilesystemengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemengine_mac.cpp b/src/corelib/io/qfilesystemengine_mac.cpp
index 0d1556522a..f5e61ff29f 100644
--- a/src/corelib/io/qfilesystemengine_mac.cpp
+++ b/src/corelib/io/qfilesystemengine_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemengine_p.h b/src/corelib/io/qfilesystemengine_p.h
index bbd4c4c020..af32a1c575 100644
--- a/src/corelib/io/qfilesystemengine_p.h
+++ b/src/corelib/io/qfilesystemengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemengine_symbian.cpp b/src/corelib/io/qfilesystemengine_symbian.cpp
deleted file mode 100644
index c8c1dfdc84..0000000000
--- a/src/corelib/io/qfilesystemengine_symbian.cpp
+++ /dev/null
@@ -1,406 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qfilesystemengine_p.h"
-#include "qfsfileengine.h"
-#include <QtCore/private/qcore_symbian_p.h>
-#include <QtCore/qcoreapplication.h>
-
-#include <f32file.h>
-#include <pathinfo.h>
-#include <wchar.h>
-
-QT_BEGIN_NAMESPACE
-
-bool QFileSystemEngine::isCaseSensitive()
-{
- return false;
-}
-
-//TODO: resolve this with QDir::cleanPath, without breaking the behaviour of that
-//function which is documented only by autotest
-//input: a dirty absolute path, e.g. c:/../../foo/./
-//output: a clean absolute path, e.g. c:/foo/
-static QString symbianCleanAbsolutePath(const QString& path)
-{
- bool isDir = path.endsWith(QLatin1Char('/'));
- //using SkipEmptyParts flag to eliminate duplicated slashes
- QStringList components = path.split(QLatin1Char('/'), QString::SkipEmptyParts);
- int cdups = 0;
- for(int i=components.count() - 1; i>=0; --i) {
- if(components.at(i) == QLatin1String("..")) {
- components.removeAt(i);
- cdups++;
- }
- else if(components.at(i) == QLatin1String(".")) {
- components.removeAt(i);
- }
- else if(cdups && i > 0) {
- --cdups;
- components.removeAt(i);
- }
- }
- QString result = components.join(QLatin1String("/"));
- if ((isDir&& !result.endsWith(QLatin1Char('/')))
- || (result.length() == 2 && result.at(1).unicode() == ':'))
- result.append(QLatin1Char('/'));
- return result;
-}
-
-//static
-QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link, QFileSystemMetaData &data)
-{
- Q_UNUSED(data);
- return link;
-}
-
-//static
-QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry, QFileSystemMetaData &data)
-{
- if (entry.isEmpty() || entry.isRoot())
- return entry;
-
- QFileSystemEntry result = absoluteName(entry);
- if (!data.hasFlags(QFileSystemMetaData::ExistsAttribute))
- fillMetaData(result, data, QFileSystemMetaData::ExistsAttribute);
- if (!data.exists()) {
- // file doesn't exist
- return QFileSystemEntry();
- } else {
- return result;
- }
-}
-
-//static
-QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
-{
- QString orig = entry.filePath();
- const bool isAbsolute = entry.isAbsolute();
- const bool isDirty = !entry.isClean();
- if (isAbsolute && !isDirty)
- return entry;
-
- const bool isRelative = entry.isRelative();
- const bool needsDrive = (!orig.isEmpty() && orig.at(0).unicode() == '/');
- const bool isDriveLetter = !needsDrive && !isAbsolute && !isRelative && orig.length() == 2;
- const bool isDriveRelative = !needsDrive && !isAbsolute && !isRelative && orig.length() > 2;
-
- QString result;
- if (needsDrive || isDriveLetter || isDriveRelative || !isAbsolute || orig.isEmpty()) {
- QFileSystemEntry cur(currentPath());
- if(needsDrive)
- result = cur.filePath().left(2);
- else if(isDriveRelative && cur.filePath().at(0) != orig.at(0))
- result = orig.left(2); // for BC, see tst_QFileInfo::absolutePath(<not current drive>:my.dll)
- else
- result = cur.filePath();
- if(isDriveLetter) {
- result[0] = orig.at(0); //copy drive letter
- orig.clear();
- }
- if(isDriveRelative) {
- orig = orig.mid(2); //discard the drive specifier from orig
- }
- }
- if (!orig.isEmpty() && !(orig.length() == 1 && orig.at(0).unicode() == '.')) {
- if (!result.isEmpty() && !result.endsWith(QLatin1Char('/')))
- result.append(QLatin1Char('/'));
- result.append(orig);
- }
-
- return QFileSystemEntry(symbianCleanAbsolutePath(result), QFileSystemEntry::FromInternalPath());
-}
-
-void QFileSystemMetaData::fillFromTEntry(const TEntry& entry)
-{
- entryFlags &= ~(QFileSystemMetaData::SymbianTEntryFlags);
- knownFlagsMask |= QFileSystemMetaData::SymbianTEntryFlags;
- //Symbian doesn't have unix type file permissions
- entryFlags |= QFileSystemMetaData::ReadPermissions;
- if(!entry.IsReadOnly()) {
- entryFlags |= QFileSystemMetaData::WritePermissions;
- }
- //set the type
- if(entry.IsDir())
- entryFlags |= (QFileSystemMetaData::DirectoryType | QFileSystemMetaData::ExecutePermissions);
- else
- entryFlags |= QFileSystemMetaData::FileType;
-
- //set the attributes
- entryFlags |= QFileSystemMetaData::ExistsAttribute;
- if(entry.IsHidden())
- entryFlags |= QFileSystemMetaData::HiddenAttribute;
-
-#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- size_ = entry.FileSize();
-#else
- size_ = (TUint)(entry.iSize);
-#endif
-
- modificationTime_ = entry.iModified;
-}
-
-void QFileSystemMetaData::fillFromVolumeInfo(const TVolumeInfo& info)
-{
- entryFlags &= ~(QFileSystemMetaData::SymbianTEntryFlags);
- knownFlagsMask |= QFileSystemMetaData::SymbianTEntryFlags;
- entryFlags |= QFileSystemMetaData::ExistsAttribute;
- entryFlags |= QFileSystemMetaData::Permissions;
- if(info.iDrive.iDriveAtt & KDriveAttRom) {
- entryFlags &= ~(QFileSystemMetaData::WritePermissions);
- }
- entryFlags |= QFileSystemMetaData::DirectoryType;
- size_ = info.iSize;
- modificationTime_ = qt_symbian_time_t_To_TTime(0);
-}
-
-//static
-bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemMetaData &data, QFileSystemMetaData::MetaDataFlags what)
-{
- if (what & QFileSystemMetaData::SymbianTEntryFlags) {
- RFs& fs(qt_s60GetRFs());
- TInt err;
- QFileSystemEntry absentry(absoluteName(entry));
- if (entry.isEmpty()) {
- err = KErrNotFound;
- } else if (absentry.isRoot()) {
- //Root directories don't have an entry, and Entry() returns KErrBadName.
- //Therefore get information about the volume instead.
- TInt drive;
- err = RFs::CharToDrive(TChar(absentry.nativeFilePath().at(0).unicode()), drive);
- if (!err) {
- TVolumeInfo info;
- err = fs.Volume(info, drive);
- if (!err)
- data.fillFromVolumeInfo(info);
- }
- } else {
- TEntry ent;
- err = fs.Entry(qt_QString2TPtrC(absentry.nativeFilePath()), ent);
- if (!err)
- data.fillFromTEntry(ent);
- }
- if (err) {
- data.size_ = 0;
- data.modificationTime_ = TTime(0);
- data.entryFlags &= ~(QFileSystemMetaData::SymbianTEntryFlags);
- }
- //files in /sys/bin on any drive are executable, even though we don't normally have permission to check whether they exist or not
- if(absentry.filePath().midRef(1,10).compare(QLatin1String(":/sys/bin/"), Qt::CaseInsensitive) == 0)
- data.entryFlags |= QFileSystemMetaData::ExecutePermissions;
- }
- return data.hasFlags(what);
-}
-
-//static
-bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool createParents)
-{
- QString abspath = absoluteName(entry).nativeFilePath();
- if (!abspath.endsWith(QLatin1Char('\\')))
- abspath.append(QLatin1Char('\\'));
- TInt r;
- if (createParents)
- r = qt_s60GetRFs().MkDirAll(qt_QString2TPtrC(abspath));
- else
- r = qt_s60GetRFs().MkDir(qt_QString2TPtrC(abspath));
- if (createParents && r == KErrAlreadyExists)
- return true; //# Qt5 - QDir::mkdir returns false for existing dir, QDir::mkpath returns true (should be made consistent in Qt 5)
- return (r == KErrNone);
-}
-
-//static
-bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool removeEmptyParents)
-{
- QString abspath = absoluteName(entry).nativeFilePath();
- if (!abspath.endsWith(QLatin1Char('\\')))
- abspath.append(QLatin1Char('\\'));
- TPtrC dir(qt_QString2TPtrC(abspath));
- RFs& fs = qt_s60GetRFs();
- bool ok = false;
- //behaviour of FS file engine:
- //returns true if the directory could be removed
- //success/failure of removing parent directories does not matter
- while (KErrNone == fs.RmDir(dir)) {
- ok = true;
- if (!removeEmptyParents)
- break;
- //RFs::RmDir treats "c:\foo\bar" and "c:\foo\" the same, so it is sufficient to remove the last \ to the end
- dir.Set(dir.Left(dir.LocateReverse(TChar('\\'))));
- }
- return ok;
-}
-
-//static
-bool QFileSystemEngine::createLink(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error)
-{
- Q_UNUSED(source)
- Q_UNUSED(target)
- error = QSystemError(KErrNotSupported, QSystemError::NativeError);
- return false;
-}
-
-//static
-bool QFileSystemEngine::copyFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error)
-{
- //CFileMan is allocated each time because it is not thread-safe
- CFileMan *fm = 0;
- TRAPD(err, fm = CFileMan::NewL(qt_s60GetRFs()));
- if (err == KErrNone) {
- err = fm->Copy(qt_QString2TPtrC(absoluteName(source).nativeFilePath()), qt_QString2TPtrC(absoluteName(target).nativeFilePath()), 0);
- delete fm;
- }
- if (err == KErrNone)
- return true;
- error = QSystemError(err, QSystemError::NativeError);
- return false;
-}
-
-//static
-bool QFileSystemEngine::renameFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error)
-{
- QString sourcepath = absoluteName(source).nativeFilePath();
- QString targetpath = absoluteName(target).nativeFilePath();
- RFs& fs(qt_s60GetRFs());
- TInt err = fs.Rename(qt_QString2TPtrC(sourcepath), qt_QString2TPtrC(targetpath));
- if (err == KErrNone)
- return true;
- error = QSystemError(err, QSystemError::NativeError);
- return false;
-}
-
-//static
-bool QFileSystemEngine::removeFile(const QFileSystemEntry &entry, QSystemError &error)
-{
- QString targetpath = absoluteName(entry).nativeFilePath();
- RFs& fs(qt_s60GetRFs());
- TInt err = fs.Delete(qt_QString2TPtrC(targetpath));
- if (err == KErrNone)
- return true;
- error = QSystemError(err, QSystemError::NativeError);
- return false;
-}
-
-//static
-bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Permissions permissions, QSystemError &error, QFileSystemMetaData *data)
-{
- QString targetpath = absoluteName(entry).nativeFilePath();
- TUint setmask = 0;
- TUint clearmask = 0;
- RFs& fs(qt_s60GetRFs());
- if (permissions & (QFile::WriteOwner | QFile::WriteUser | QFile::WriteGroup | QFile::WriteOther))
- clearmask = KEntryAttReadOnly; //if anyone can write, it's not read-only
- else
- setmask = KEntryAttReadOnly;
- TInt err = fs.SetAtt(qt_QString2TPtrC(targetpath), setmask, clearmask);
- if (data && !err) {
- data->entryFlags &= ~QFileSystemMetaData::Permissions;
- data->entryFlags |= QFileSystemMetaData::MetaDataFlag(uint(permissions));
- data->knownFlagsMask |= QFileSystemMetaData::Permissions;
- }
- if (err == KErrNone)
- return true;
- error = QSystemError(err, QSystemError::NativeError);
- return false;
-}
-
-QString QFileSystemEngine::homePath()
-{
- QString home = QDir::fromNativeSeparators(qt_TDesC2QString(PathInfo::PhoneMemoryRootPath()));
- if(home.endsWith(QLatin1Char('/')))
- home.chop(1);
- return home;
-}
-
-QString QFileSystemEngine::rootPath()
-{
- TChar drive;
- TInt err = RFs::DriveToChar(RFs::GetSystemDrive(), drive); //RFs::GetSystemDriveChar not supported on S60 3.1
- Q_ASSERT(err == KErrNone); //RFs::GetSystemDrive() shall always return a convertible drive number on a valid OS configuration
- return QString(QChar(drive)).append(QLatin1String(":/"));
-}
-
-QString QFileSystemEngine::tempPath()
-{
- return rootPath().append(QLatin1String("system/temp"));
-}
-
-//static
-bool QFileSystemEngine::setCurrentPath(const QFileSystemEntry &entry)
-{
- QFileSystemMetaData meta;
- QFileSystemEntry absname = absoluteName(entry);
- fillMetaData(absname, meta, QFileSystemMetaData::ExistsAttribute | QFileSystemMetaData::DirectoryType);
- if(!(meta.exists() && meta.isDirectory()))
- return false;
-
- RFs& fs = qt_s60GetRFs();
- QString abspath = absname.nativeFilePath();
- if(!abspath.endsWith(QLatin1Char('\\')))
- abspath.append(QLatin1Char('\\'));
- TInt r = fs.SetSessionPath(qt_QString2TPtrC(abspath));
- //SetSessionPath succeeds for non existent directory, which is why it's checked above
- if (r == KErrNone) {
- __ASSERT_COMPILE(sizeof(wchar_t) == sizeof(unsigned short));
- //attempt to set open C to the same path
- r = ::wchdir(reinterpret_cast<const wchar_t *>(absname.filePath().utf16()));
- if (r < 0)
- qWarning("failed to sync path to open C");
- return true;
- }
- return false;
-}
-
-//static
-QFileSystemEntry QFileSystemEngine::currentPath()
-{
- TFileName fn;
- QFileSystemEntry ret;
- TInt r = qt_s60GetRFs().SessionPath(fn);
- if(r == KErrNone) {
- //remove terminating slash from non root paths (session path is clean, absolute and always ends in a \)
- if(fn.Length() > 3 && fn[fn.Length() - 1] == '\\')
- fn.SetLength(fn.Length() - 1);
- ret = QFileSystemEntry(qt_TDesC2QString(fn), QFileSystemEntry::FromNativePath());
- }
- return ret;
-}
-
-QT_END_NAMESPACE
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index 9778b526ac..901aaf8f91 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 10ba95e97f..d724429f6b 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -160,6 +160,31 @@ typedef DWORD (WINAPI *PtrGetEffectiveRightsFromAclW)(PACL, PTRUSTEE_W, OUT PACC
static PtrGetEffectiveRightsFromAclW ptrGetEffectiveRightsFromAclW = 0;
static TRUSTEE_W currentUserTrusteeW;
static TRUSTEE_W worldTrusteeW;
+static PSID currentUserSID = 0;
+static PSID worldSID = 0;
+
+/*
+ Deletes the allocated SIDs during global static cleanup
+*/
+class SidCleanup
+{
+public:
+ ~SidCleanup();
+};
+
+SidCleanup::~SidCleanup()
+{
+ qFree(currentUserSID);
+ currentUserSID = 0;
+
+ // worldSID was allocated with AllocateAndInitializeSid so it needs to be freed with FreeSid
+ if (worldSID) {
+ ::FreeSid(worldSID);
+ worldSID = 0;
+ }
+}
+
+Q_GLOBAL_STATIC(SidCleanup, initSidCleanup)
typedef BOOL (WINAPI *PtrGetUserProfileDirectoryW)(HANDLE, LPWSTR, LPDWORD);
static PtrGetUserProfileDirectoryW ptrGetUserProfileDirectoryW = 0;
@@ -199,25 +224,35 @@ static void resolveLibs()
// Create TRUSTEE for current user
HANDLE hnd = ::GetCurrentProcess();
HANDLE token = 0;
+ initSidCleanup();
if (::OpenProcessToken(hnd, TOKEN_QUERY, &token)) {
- TOKEN_USER tu;
- DWORD retsize;
- if (::GetTokenInformation(token, TokenUser, &tu, sizeof(tu), &retsize))
- ptrBuildTrusteeWithSidW(&currentUserTrusteeW, tu.User.Sid);
+ DWORD retsize = 0;
+ // GetTokenInformation requires a buffer big enough for the TOKEN_USER struct and
+ // the SID struct. Since the SID struct can have variable number of subauthorities
+ // tacked at the end, its size is variable. Obtain the required size by first
+ // doing a dummy GetTokenInformation call.
+ ::GetTokenInformation(token, TokenUser, 0, 0, &retsize);
+ if (retsize) {
+ void *tokenBuffer = qMalloc(retsize);
+ if (::GetTokenInformation(token, TokenUser, tokenBuffer, retsize, &retsize)) {
+ PSID tokenSid = reinterpret_cast<PTOKEN_USER>(tokenBuffer)->User.Sid;
+ DWORD sidLen = ::GetLengthSid(tokenSid);
+ currentUserSID = reinterpret_cast<PSID>(qMalloc(sidLen));
+ if (::CopySid(sidLen, currentUserSID, tokenSid))
+ ptrBuildTrusteeWithSidW(&currentUserTrusteeW, currentUserSID);
+ }
+ qFree(tokenBuffer);
+ }
::CloseHandle(token);
}
typedef BOOL (WINAPI *PtrAllocateAndInitializeSid)(PSID_IDENTIFIER_AUTHORITY, BYTE, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, PSID*);
PtrAllocateAndInitializeSid ptrAllocateAndInitializeSid = (PtrAllocateAndInitializeSid)GetProcAddress(advapiHnd, "AllocateAndInitializeSid");
- typedef PVOID (WINAPI *PtrFreeSid)(PSID);
- PtrFreeSid ptrFreeSid = (PtrFreeSid)GetProcAddress(advapiHnd, "FreeSid");
- if (ptrAllocateAndInitializeSid && ptrFreeSid) {
+ if (ptrAllocateAndInitializeSid) {
// Create TRUSTEE for Everyone (World)
SID_IDENTIFIER_AUTHORITY worldAuth = { SECURITY_WORLD_SID_AUTHORITY };
- PSID pWorld = 0;
- if (ptrAllocateAndInitializeSid(&worldAuth, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, &pWorld))
- ptrBuildTrusteeWithSidW(&worldTrusteeW, pWorld);
- ptrFreeSid(pWorld);
+ if (ptrAllocateAndInitializeSid(&worldAuth, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, &worldSID))
+ ptrBuildTrusteeWithSidW(&worldTrusteeW, worldSID);
}
}
HINSTANCE userenvHnd = QSystemLibrary::load(L"userenv");
@@ -278,7 +313,7 @@ static QString readSymLink(const QFileSystemEntry &link)
0);
if (handle != INVALID_HANDLE_VALUE) {
DWORD bufsize = MAXIMUM_REPARSE_DATA_BUFFER_SIZE;
- REPARSE_DATA_BUFFER *rdb = (REPARSE_DATA_BUFFER*)qMalloc(bufsize);
+ REPARSE_DATA_BUFFER *rdb = (REPARSE_DATA_BUFFER*)malloc(bufsize);
DWORD retsize = 0;
if (::DeviceIoControl(handle, FSCTL_GET_REPARSE_POINT, 0, 0, rdb, bufsize, &retsize, 0)) {
if (rdb->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) {
@@ -296,7 +331,7 @@ static QString readSymLink(const QFileSystemEntry &link)
if (result.size() > 4 && result.at(0) == QLatin1Char('\\') && result.at(2) == QLatin1Char('?') && result.at(3) == QLatin1Char('\\'))
result = result.mid(4);
}
- qFree(rdb);
+ free(rdb);
CloseHandle(handle);
#if !defined(QT_NO_LIBRARY)
diff --git a/src/corelib/io/qfilesystementry.cpp b/src/corelib/io/qfilesystementry.cpp
index 2f37542f66..11b73dd745 100644
--- a/src/corelib/io/qfilesystementry.cpp
+++ b/src/corelib/io/qfilesystementry.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystementry_p.h b/src/corelib/io/qfilesystementry_p.h
index 8d524c087e..61902f77d0 100644
--- a/src/corelib/io/qfilesystementry_p.h
+++ b/src/corelib/io/qfilesystementry_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemiterator_p.h b/src/corelib/io/qfilesystemiterator_p.h
index 6f2d1e1c6e..7df5988459 100644
--- a/src/corelib/io/qfilesystemiterator_p.h
+++ b/src/corelib/io/qfilesystemiterator_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemiterator_symbian.cpp b/src/corelib/io/qfilesystemiterator_symbian.cpp
deleted file mode 100644
index 4347f6acba..0000000000
--- a/src/corelib/io/qfilesystemiterator_symbian.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qfilesystemiterator_p.h"
-#include "qfilesystemengine_p.h"
-#include <QtCore/private/qcore_symbian_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &path, QDir::Filters filters,
- const QStringList &nameFilters, QDirIterator::IteratorFlags iteratorFlags)
- : lastError(KErrNone), entryIndex(-1)
-{
- RFs& fs = qt_s60GetRFs();
-
- nativePath = path.nativeFilePath();
- if (!nativePath.endsWith(QLatin1Char('\\')))
- nativePath.append(QLatin1Char('\\'));
-
- QString absPath = QFileSystemEngine::absoluteName(path).nativeFilePath();
-
- if (!absPath.endsWith(QLatin1Char('\\')))
- absPath.append(QLatin1Char('\\'));
-
- int pathLen = absPath.length();
- if (pathLen > KMaxFileName) {
- lastError = KErrBadName;
- return;
- }
-
- //set up server side filtering to reduce IPCs
- //RDir won't accept all valid name filters e.g. "*. bar"
- if (nameFilters.count() == 1 && !(filters & QDir::AllDirs) && iteratorFlags
- == QDirIterator::NoIteratorFlags && pathLen + nameFilters[0].length()
- <= KMaxFileName) {
- //server side supports one mask - skip this for recursive mode or if only files should be filtered
- absPath.append(nameFilters[0]);
- }
-
- TUint symbianMask = 0;
- if ((filters & QDir::Dirs) || (filters & QDir::AllDirs) || (iteratorFlags
- & QDirIterator::Subdirectories))
- symbianMask |= KEntryAttDir; //include directories
- if (filters & QDir::Hidden)
- symbianMask |= KEntryAttHidden;
- if (filters & QDir::System)
- symbianMask |= KEntryAttSystem;
- if (((filters & QDir::Files) == 0) && symbianMask == KEntryAttDir)
- symbianMask |= KEntryAttMatchExclusive; //exclude non-directories
- else if (symbianMask == 0) {
- if ((filters & QDir::PermissionMask) == QDir::Writable)
- symbianMask = KEntryAttMatchExclude | KEntryAttReadOnly;
- }
-
- lastError = dirHandle.Open(fs, qt_QString2TPtrC(absPath), symbianMask);
-}
-
-QFileSystemIterator::~QFileSystemIterator()
-{
- dirHandle.Close();
-}
-
-bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaData &metaData)
-{
- //1st time, lastError is result of dirHandle.Open(), entries.Count() is 0 and entryIndex is -1 so initial read is triggered
- //subsequent times, read is triggered each time we reach the end of the entry list
- //final time, lastError is KErrEof so we don't need to read anymore.
- ++entryIndex;
- if (lastError == KErrNone && entryIndex >= entries.Count()) {
- lastError = dirHandle.Read(entries);
- entryIndex = 0;
- }
-
- //each call to advance() gets the next entry from the entry list.
- //from the final (or only) read call, KErrEof is returned together with a full buffer so we still need to go through the list
- if ((lastError == KErrNone || lastError == KErrEof) && entryIndex < entries.Count()) {
- Q_ASSERT(entryIndex >= 0);
- const TEntry &entry(entries[entryIndex]);
- fileEntry = QFileSystemEntry(nativePath + qt_TDesC2QString(entry.iName), QFileSystemEntry::FromNativePath());
- metaData.fillFromTEntry(entry);
- return true;
- }
-
- //TODO: error reporting, to allow user to distinguish empty directory from error condition.
-
- return false;
-}
-
-QT_END_NAMESPACE
diff --git a/src/corelib/io/qfilesystemiterator_unix.cpp b/src/corelib/io/qfilesystemiterator_unix.cpp
index 6987660ea3..d0eb04a145 100644
--- a/src/corelib/io/qfilesystemiterator_unix.cpp
+++ b/src/corelib/io/qfilesystemiterator_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemiterator_win.cpp b/src/corelib/io/qfilesystemiterator_win.cpp
index 5fff4f82c6..1f5cf356a0 100644
--- a/src/corelib/io/qfilesystemiterator_win.cpp
+++ b/src/corelib/io/qfilesystemiterator_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h
index 64749e3889..6ed5cec954 100644
--- a/src/corelib/io/qfilesystemmetadata_p.h
+++ b/src/corelib/io/qfilesystemmetadata_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index 9739067c06..4abb4f3cc1 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -48,234 +48,45 @@
#include <qdebug.h>
#include <qdir.h>
#include <qfileinfo.h>
-#include <qmutex.h>
#include <qset.h>
#include <qtimer.h>
+
+#include "qfilesystemwatcher_polling_p.h"
#if defined(Q_OS_WIN)
# include "qfilesystemwatcher_win_p.h"
#elif defined(Q_OS_LINUX)
# include "qfilesystemwatcher_inotify_p.h"
-# include "qfilesystemwatcher_dnotify_p.h"
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC)
-# if (defined Q_OS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
-# include "qfilesystemwatcher_fsevents_p.h"
-# endif //MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
# include "qfilesystemwatcher_kqueue_p.h"
-#elif defined(Q_OS_SYMBIAN)
-# include "qfilesystemwatcher_symbian_p.h"
#endif
QT_BEGIN_NAMESPACE
-enum { PollingInterval = 1000 };
-
-class QPollingFileSystemWatcherEngine : public QFileSystemWatcherEngine
-{
- Q_OBJECT
-
- class FileInfo
- {
- uint ownerId;
- uint groupId;
- QFile::Permissions permissions;
- QDateTime lastModified;
- QStringList entries;
-
- public:
- FileInfo(const QFileInfo &fileInfo)
- : ownerId(fileInfo.ownerId()),
- groupId(fileInfo.groupId()),
- permissions(fileInfo.permissions()),
- lastModified(fileInfo.lastModified())
- {
- if (fileInfo.isDir()) {
- entries = fileInfo.absoluteDir().entryList(QDir::AllEntries);
- }
- }
- FileInfo &operator=(const QFileInfo &fileInfo)
- {
- *this = FileInfo(fileInfo);
- return *this;
- }
-
- bool operator!=(const QFileInfo &fileInfo) const
- {
- if (fileInfo.isDir() && entries != fileInfo.absoluteDir().entryList(QDir::AllEntries))
- return true;
- return (ownerId != fileInfo.ownerId()
- || groupId != fileInfo.groupId()
- || permissions != fileInfo.permissions()
- || lastModified != fileInfo.lastModified());
- }
- };
-
- mutable QMutex mutex;
- QHash<QString, FileInfo> files, directories;
-
-public:
- QPollingFileSystemWatcherEngine();
-
- void run();
-
- QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories);
- QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories);
-
- void stop();
-
-private Q_SLOTS:
- void timeout();
-};
-
-QPollingFileSystemWatcherEngine::QPollingFileSystemWatcherEngine()
-{
-#ifndef QT_NO_THREAD
- moveToThread(this);
-#endif
-}
-
-void QPollingFileSystemWatcherEngine::run()
-{
- QTimer timer;
- connect(&timer, SIGNAL(timeout()), SLOT(timeout()));
- timer.start(PollingInterval);
- (void) exec();
-}
-
-QStringList QPollingFileSystemWatcherEngine::addPaths(const QStringList &paths,
- QStringList *files,
- QStringList *directories)
-{
- QMutexLocker locker(&mutex);
- QStringList p = paths;
- QMutableListIterator<QString> it(p);
- while (it.hasNext()) {
- QString path = it.next();
- QFileInfo fi(path);
- if (!fi.exists())
- continue;
- if (fi.isDir()) {
- if (!directories->contains(path))
- directories->append(path);
- if (!path.endsWith(QLatin1Char('/')))
- fi = QFileInfo(path + QLatin1Char('/'));
- this->directories.insert(path, fi);
- } else {
- if (!files->contains(path))
- files->append(path);
- this->files.insert(path, fi);
- }
- it.remove();
- }
- start();
- return p;
-}
-
-QStringList QPollingFileSystemWatcherEngine::removePaths(const QStringList &paths,
- QStringList *files,
- QStringList *directories)
-{
- QMutexLocker locker(&mutex);
- QStringList p = paths;
- QMutableListIterator<QString> it(p);
- while (it.hasNext()) {
- QString path = it.next();
- if (this->directories.remove(path)) {
- directories->removeAll(path);
- it.remove();
- } else if (this->files.remove(path)) {
- files->removeAll(path);
- it.remove();
- }
- }
- if (this->files.isEmpty() && this->directories.isEmpty()) {
- locker.unlock();
- stop();
- wait();
- }
- return p;
-}
-
-void QPollingFileSystemWatcherEngine::stop()
-{
- quit();
-}
-
-void QPollingFileSystemWatcherEngine::timeout()
-{
- QMutexLocker locker(&mutex);
- QMutableHashIterator<QString, FileInfo> fit(files);
- while (fit.hasNext()) {
- QHash<QString, FileInfo>::iterator x = fit.next();
- QString path = x.key();
- QFileInfo fi(path);
- if (!fi.exists()) {
- fit.remove();
- emit fileChanged(path, true);
- } else if (x.value() != fi) {
- x.value() = fi;
- emit fileChanged(path, false);
- }
- }
- QMutableHashIterator<QString, FileInfo> dit(directories);
- while (dit.hasNext()) {
- QHash<QString, FileInfo>::iterator x = dit.next();
- QString path = x.key();
- QFileInfo fi(path);
- if (!path.endsWith(QLatin1Char('/')))
- fi = QFileInfo(path + QLatin1Char('/'));
- if (!fi.exists()) {
- dit.remove();
- emit directoryChanged(path, true);
- } else if (x.value() != fi) {
- fi.refresh();
- if (!fi.exists()) {
- dit.remove();
- emit directoryChanged(path, true);
- } else {
- x.value() = fi;
- emit directoryChanged(path, false);
- }
- }
-
- }
-}
-
-
-
-
-QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine()
+QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine(QObject *parent)
{
#if defined(Q_OS_WIN)
- return new QWindowsFileSystemWatcherEngine;
+ return new QWindowsFileSystemWatcherEngine(parent);
#elif defined(Q_OS_LINUX)
- QFileSystemWatcherEngine *eng = QInotifyFileSystemWatcherEngine::create();
- if(!eng)
- eng = QDnotifyFileSystemWatcherEngine::create();
- return eng;
+ // there is a chance that inotify may fail on Linux pre-2.6.13 (August
+ // 2005), so we can't just new inotify directly.
+ return QInotifyFileSystemWatcherEngine::create(parent);
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC)
-# if 0 && defined(Q_OS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5)
- return QFSEventsFileSystemWatcherEngine::create();
- else
-# endif
- return QKqueueFileSystemWatcherEngine::create();
-#elif defined(Q_OS_SYMBIAN)
- return new QSymbianFileSystemWatcherEngine;
+ return QKqueueFileSystemWatcherEngine::create(parent);
#else
return 0;
#endif
}
QFileSystemWatcherPrivate::QFileSystemWatcherPrivate()
- : native(0), poller(0), forced(0)
+ : native(0), poller(0)
{
}
void QFileSystemWatcherPrivate::init()
{
Q_Q(QFileSystemWatcher);
- native = createNativeEngine();
+ native = createNativeEngine(q);
if (native) {
QObject::connect(native,
SIGNAL(fileChanged(QString,bool)),
@@ -288,42 +99,13 @@ void QFileSystemWatcherPrivate::init()
}
}
-void QFileSystemWatcherPrivate::initForcedEngine(const QString &forceName)
-{
- if(forced)
- return;
-
- Q_Q(QFileSystemWatcher);
-
-#if defined(Q_OS_LINUX)
- if(forceName == QLatin1String("inotify")) {
- forced = QInotifyFileSystemWatcherEngine::create();
- } else if(forceName == QLatin1String("dnotify")) {
- forced = QDnotifyFileSystemWatcherEngine::create();
- }
-#else
- Q_UNUSED(forceName);
-#endif
-
- if(forced) {
- QObject::connect(forced,
- SIGNAL(fileChanged(QString,bool)),
- q,
- SLOT(_q_fileChanged(QString,bool)));
- QObject::connect(forced,
- SIGNAL(directoryChanged(QString,bool)),
- q,
- SLOT(_q_directoryChanged(QString,bool)));
- }
-}
-
void QFileSystemWatcherPrivate::initPollerEngine()
{
if(poller)
return;
Q_Q(QFileSystemWatcher);
- poller = new QPollingFileSystemWatcherEngine; // that was a mouthful
+ poller = new QPollingFileSystemWatcherEngine(q); // that was a mouthful
QObject::connect(poller,
SIGNAL(fileChanged(QString,bool)),
q,
@@ -434,27 +216,7 @@ QFileSystemWatcher::QFileSystemWatcher(const QStringList &paths, QObject *parent
Destroys the file system watcher.
*/
QFileSystemWatcher::~QFileSystemWatcher()
-{
- Q_D(QFileSystemWatcher);
- if (d->native) {
- d->native->stop();
- d->native->wait();
- delete d->native;
- d->native = 0;
- }
- if (d->poller) {
- d->poller->stop();
- d->poller->wait();
- delete d->poller;
- d->poller = 0;
- }
- if (d->forced) {
- d->forced->stop();
- d->forced->wait();
- delete d->forced;
- d->forced = 0;
- }
-}
+{ }
/*!
Adds \a path to the file system watcher if \a path exists. The
@@ -466,20 +228,28 @@ QFileSystemWatcher::~QFileSystemWatcher()
otherwise the fileChanged() signal is emitted when \a path is
modified, renamed or removed.
- \note There is a system dependent limit to the number of files and
- directories that can be monitored simultaneously. If this limit
- has been reached, \a path will not be added to the file system
- watcher, and a warning message will be printed to \e{stderr}.
+ If the watch was successful, true is returned.
+
+ Reasons for a watch failure are generally system-dependent, but
+ may include the resource not existing, access failures, or the
+ total watch count limit, if the platform has one.
+
+ \note There may be a system dependent limit to the number of
+ files and directories that can be monitored simultaneously.
+ If this limit is been reached, \a path will not be monitored,
+ and false is returned.
\sa addPaths(), removePath()
*/
-void QFileSystemWatcher::addPath(const QString &path)
+bool QFileSystemWatcher::addPath(const QString &path)
{
if (path.isEmpty()) {
qWarning("QFileSystemWatcher::addPath: path is empty");
- return;
+ return true;
}
- addPaths(QStringList(path));
+
+ QStringList paths = addPaths(QStringList(path));
+ return paths.isEmpty();
}
/*!
@@ -492,23 +262,37 @@ void QFileSystemWatcher::addPath(const QString &path)
otherwise the fileChanged() signal is emitted when the path is
modified, renamed, or removed.
- \note There is a system dependent limit to the number of files and
- directories that can be monitored simultaneously. If this limit
- has been reached, the excess \a paths will not be added to the
- file system watcher, and a warning message will be printed to
- \e{stderr} for each path that could not be added.
+ The return value is a list of paths that could not be watched.
+
+ Reasons for a watch failure are generally system-dependent, but
+ may include the resource not existing, access failures, or the
+ total watch count limit, if the platform has one.
+
+ \note There may be a system dependent limit to the number of
+ files and directories that can be monitored simultaneously.
+ If this limit has been reached, the excess \a paths will not
+ be monitored, and they will be added to the returned QStringList.
\sa addPath(), removePaths()
*/
-void QFileSystemWatcher::addPaths(const QStringList &paths)
+QStringList QFileSystemWatcher::addPaths(const QStringList &paths)
{
Q_D(QFileSystemWatcher);
- if (paths.isEmpty()) {
+
+ QStringList p = paths;
+ QMutableListIterator<QString> it(p);
+
+ while (it.hasNext()) {
+ const QString &path = it.next();
+ if (path.isEmpty())
+ it.remove();
+ }
+
+ if (p.isEmpty()) {
qWarning("QFileSystemWatcher::addPaths: list is empty");
- return;
+ return QStringList();
}
- QStringList p = paths;
QFileSystemWatcherEngine *engine = 0;
if(!objectName().startsWith(QLatin1String("_qt_autotest_force_engine_"))) {
@@ -530,54 +314,71 @@ void QFileSystemWatcher::addPaths(const QStringList &paths)
} else if(forceName == QLatin1String("native")) {
qDebug() << "QFileSystemWatcher: skipping polling engine, using only native engine";
engine = d->native;
- } else {
- qDebug() << "QFileSystemWatcher: skipping polling and native engine, using only explicit" << forceName << "engine";
- d_func()->initForcedEngine(forceName);
- engine = d->forced;
}
}
if(engine)
p = engine->addPaths(p, &d->files, &d->directories);
- if (!p.isEmpty())
- qWarning("QFileSystemWatcher: failed to add paths: %s",
- qPrintable(p.join(QLatin1String(", "))));
+ return p;
}
/*!
Removes the specified \a path from the file system watcher.
+ If the watch is successfully removed, true is returned.
+
+ Reasons for watch removal failing are generally system-dependent,
+ but may be due to the path having already been deleted, for example.
+
\sa removePaths(), addPath()
*/
-void QFileSystemWatcher::removePath(const QString &path)
+bool QFileSystemWatcher::removePath(const QString &path)
{
if (path.isEmpty()) {
qWarning("QFileSystemWatcher::removePath: path is empty");
- return;
+ return true;
}
- removePaths(QStringList(path));
+
+ QStringList paths = removePaths(QStringList(path));
+ return paths.isEmpty();
}
/*!
Removes the specified \a paths from the file system watcher.
+ The return value is a list of paths which were not able to be
+ unwatched successfully.
+
+ Reasons for watch removal failing are generally system-dependent,
+ but may be due to the path having already been deleted, for example.
+
\sa removePath(), addPaths()
*/
-void QFileSystemWatcher::removePaths(const QStringList &paths)
+QStringList QFileSystemWatcher::removePaths(const QStringList &paths)
{
- if (paths.isEmpty()) {
- qWarning("QFileSystemWatcher::removePaths: list is empty");
- return;
- }
Q_D(QFileSystemWatcher);
+
QStringList p = paths;
+ QMutableListIterator<QString> it(p);
+
+ while (it.hasNext()) {
+ const QString &path = it.next();
+ if (path.isEmpty())
+ it.remove();
+ }
+
+ if (p.isEmpty()) {
+ qWarning("QFileSystemWatcher::removePaths: list is empty");
+ return QStringList();
+ }
+
if (d->native)
p = d->native->removePaths(p, &d->files, &d->directories);
if (d->poller)
p = d->poller->removePaths(p, &d->files, &d->directories);
- if (d->forced)
- p = d->forced->removePaths(p, &d->files, &d->directories);
+
+ return p;
}
/*!
@@ -634,7 +435,5 @@ QT_END_NAMESPACE
#include "moc_qfilesystemwatcher.cpp"
-#include "qfilesystemwatcher.moc"
-
#endif // QT_NO_FILESYSTEMWATCHER
diff --git a/src/corelib/io/qfilesystemwatcher.h b/src/corelib/io/qfilesystemwatcher.h
index 763c8de0d6..7b7dbe98c5 100644
--- a/src/corelib/io/qfilesystemwatcher.h
+++ b/src/corelib/io/qfilesystemwatcher.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -64,10 +64,10 @@ public:
QFileSystemWatcher(const QStringList &paths, QObject *parent = 0);
~QFileSystemWatcher();
- void addPath(const QString &file);
- void addPaths(const QStringList &files);
- void removePath(const QString &file);
- void removePaths(const QStringList &files);
+ bool addPath(const QString &file);
+ QStringList addPaths(const QStringList &files);
+ bool removePath(const QString &file);
+ QStringList removePaths(const QStringList &files);
QStringList files() const;
QStringList directories() const;
diff --git a/src/corelib/io/qfilesystemwatcher_dnotify.cpp b/src/corelib/io/qfilesystemwatcher_dnotify.cpp
deleted file mode 100644
index 46c3b46467..0000000000
--- a/src/corelib/io/qfilesystemwatcher_dnotify.cpp
+++ /dev/null
@@ -1,461 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qplatformdefs.h"
-#include "qfilesystemwatcher.h"
-#include "qfilesystemwatcher_dnotify_p.h"
-
-#ifndef QT_NO_FILESYSTEMWATCHER
-
-#include <qsocketnotifier.h>
-#include <qcoreapplication.h>
-#include <qfileinfo.h>
-#include <qtimer.h>
-#include <qwaitcondition.h>
-#include <qmutex.h>
-#include <dirent.h>
-#include <qdir.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <signal.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <time.h>
-
-#include "private/qcore_unix_p.h"
-
-#ifdef QT_LINUXBASE
-
-/* LSB doesn't standardize these */
-#define F_NOTIFY 1026
-#define DN_ACCESS 0x00000001
-#define DN_MODIFY 0x00000002
-#define DN_CREATE 0x00000004
-#define DN_DELETE 0x00000008
-#define DN_RENAME 0x00000010
-#define DN_ATTRIB 0x00000020
-#define DN_MULTISHOT 0x80000000
-
-#endif
-
-QT_BEGIN_NAMESPACE
-
-static int qfswd_fileChanged_pipe[2];
-static void (*qfswd_old_sigio_handler)(int) = 0;
-static void (*qfswd_old_sigio_action)(int, siginfo_t *, void *) = 0;
-static void qfswd_sigio_monitor(int signum, siginfo_t *i, void *v)
-{
- qt_safe_write(qfswd_fileChanged_pipe[1], reinterpret_cast<char*>(&i->si_fd), sizeof(int));
-
- if (qfswd_old_sigio_handler && qfswd_old_sigio_handler != SIG_IGN)
- qfswd_old_sigio_handler(signum);
- if (qfswd_old_sigio_action)
- qfswd_old_sigio_action(signum, i, v);
-}
-
-class QDnotifySignalThread : public QThread
-{
-Q_OBJECT
-public:
- QDnotifySignalThread();
- virtual ~QDnotifySignalThread();
-
- void startNotify();
-
- virtual void run();
-
-signals:
- void fdChanged(int);
-
-protected:
- virtual bool event(QEvent *);
-
-private slots:
- void readFromDnotify();
-
-private:
- QMutex mutex;
- QWaitCondition wait;
- bool isExecing;
-};
-
-Q_GLOBAL_STATIC(QDnotifySignalThread, dnotifySignal)
-
-QDnotifySignalThread::QDnotifySignalThread()
-: isExecing(false)
-{
- moveToThread(this);
-
- qt_safe_pipe(qfswd_fileChanged_pipe, O_NONBLOCK);
-
- struct sigaction oldAction;
- struct sigaction action;
- memset(&action, 0, sizeof(action));
- action.sa_sigaction = qfswd_sigio_monitor;
- action.sa_flags = SA_SIGINFO;
- ::sigaction(SIGIO, &action, &oldAction);
- if (!(oldAction.sa_flags & SA_SIGINFO))
- qfswd_old_sigio_handler = oldAction.sa_handler;
- else
- qfswd_old_sigio_action = oldAction.sa_sigaction;
-}
-
-QDnotifySignalThread::~QDnotifySignalThread()
-{
- if(isRunning()) {
- quit();
- QThread::wait();
- }
-}
-
-bool QDnotifySignalThread::event(QEvent *e)
-{
- if(e->type() == QEvent::User) {
- QMutexLocker locker(&mutex);
- isExecing = true;
- wait.wakeAll();
- return true;
- } else {
- return QThread::event(e);
- }
-}
-
-void QDnotifySignalThread::startNotify()
-{
- // Note: All this fancy waiting for the thread to enter its event
- // loop is to avoid nasty messages at app shutdown when the
- // QDnotifySignalThread singleton is deleted
- start();
- mutex.lock();
- while(!isExecing)
- wait.wait(&mutex);
- mutex.unlock();
-}
-
-void QDnotifySignalThread::run()
-{
- QSocketNotifier sn(qfswd_fileChanged_pipe[0], QSocketNotifier::Read, this);
- connect(&sn, SIGNAL(activated(int)), SLOT(readFromDnotify()));
-
- QCoreApplication::instance()->postEvent(this, new QEvent(QEvent::User));
- (void) exec();
-}
-
-void QDnotifySignalThread::readFromDnotify()
-{
- int fd;
- int readrv = qt_safe_read(qfswd_fileChanged_pipe[0], reinterpret_cast<char*>(&fd), sizeof(int));
- // Only expect EAGAIN or EINTR. Other errors are assumed to be impossible.
- if(readrv != -1) {
- Q_ASSERT(readrv == sizeof(int));
- Q_UNUSED(readrv);
-
- if(0 == fd)
- quit();
- else
- emit fdChanged(fd);
- }
-}
-
-QDnotifyFileSystemWatcherEngine::QDnotifyFileSystemWatcherEngine()
-{
- QObject::connect(dnotifySignal(), SIGNAL(fdChanged(int)),
- this, SLOT(refresh(int)), Qt::DirectConnection);
-}
-
-QDnotifyFileSystemWatcherEngine::~QDnotifyFileSystemWatcherEngine()
-{
- QMutexLocker locker(&mutex);
-
- for(QHash<int, Directory>::ConstIterator iter = fdToDirectory.constBegin();
- iter != fdToDirectory.constEnd();
- ++iter) {
- qt_safe_close(iter->fd);
- if(iter->parentFd)
- qt_safe_close(iter->parentFd);
- }
-}
-
-QDnotifyFileSystemWatcherEngine *QDnotifyFileSystemWatcherEngine::create()
-{
- return new QDnotifyFileSystemWatcherEngine();
-}
-
-void QDnotifyFileSystemWatcherEngine::run()
-{
- qFatal("QDnotifyFileSystemWatcherEngine thread should not be run");
-}
-
-QStringList QDnotifyFileSystemWatcherEngine::addPaths(const QStringList &paths, QStringList *files, QStringList *directories)
-{
- QMutexLocker locker(&mutex);
-
- QStringList p = paths;
- QMutableListIterator<QString> it(p);
-
- while (it.hasNext()) {
- QString path = it.next();
-
- QFileInfo fi(path);
-
- if(!fi.exists()) {
- continue;
- }
-
- bool isDir = fi.isDir();
-
- if (isDir && directories->contains(path)) {
- continue; // Skip monitored directories
- } else if(!isDir && files->contains(path)) {
- continue; // Skip monitored files
- }
-
- if(!isDir)
- path = fi.canonicalPath();
-
- // Locate the directory entry (creating if needed)
- int fd = pathToFD[path];
-
- if(fd == 0) {
-
- QT_DIR *d = QT_OPENDIR(path.toUtf8().constData());
- if(!d) continue; // Could not open directory
- QT_DIR *parent = 0;
-
- QDir parentDir(path);
- if(!parentDir.isRoot()) {
- parentDir.cdUp();
- parent = QT_OPENDIR(parentDir.path().toUtf8().constData());
- if(!parent) {
- QT_CLOSEDIR(d);
- continue;
- }
- }
-
- fd = qt_safe_dup(::dirfd(d));
- int parentFd = parent ? qt_safe_dup(::dirfd(parent)) : 0;
-
- QT_CLOSEDIR(d);
- if(parent) QT_CLOSEDIR(parent);
-
- Q_ASSERT(fd);
- if(::fcntl(fd, F_SETSIG, SIGIO) ||
- ::fcntl(fd, F_NOTIFY, DN_MODIFY | DN_CREATE | DN_DELETE |
- DN_RENAME | DN_ATTRIB | DN_MULTISHOT) ||
- (parent && ::fcntl(parentFd, F_SETSIG, SIGIO)) ||
- (parent && ::fcntl(parentFd, F_NOTIFY, DN_DELETE | DN_RENAME |
- DN_MULTISHOT))) {
- continue; // Could not set appropriate flags
- }
-
- Directory dir;
- dir.path = path;
- dir.fd = fd;
- dir.parentFd = parentFd;
-
- fdToDirectory.insert(fd, dir);
- pathToFD.insert(path, fd);
- if(parentFd)
- parentToFD.insert(parentFd, fd);
- }
-
- Directory &directory = fdToDirectory[fd];
-
- if(isDir) {
- directory.isMonitored = true;
- } else {
- Directory::File file;
- file.path = fi.filePath();
- file.lastWrite = fi.lastModified();
- directory.files.append(file);
- pathToFD.insert(fi.filePath(), fd);
- }
-
- it.remove();
-
- if(isDir) {
- directories->append(path);
- } else {
- files->append(fi.filePath());
- }
- }
-
- dnotifySignal()->startNotify();
-
- return p;
-}
-
-QStringList QDnotifyFileSystemWatcherEngine::removePaths(const QStringList &paths, QStringList *files, QStringList *directories)
-{
- QMutexLocker locker(&mutex);
-
- QStringList p = paths;
- QMutableListIterator<QString> it(p);
- while (it.hasNext()) {
-
- QString path = it.next();
- int fd = pathToFD.take(path);
-
- if(!fd)
- continue;
-
- Directory &directory = fdToDirectory[fd];
- bool isDir = false;
- if(directory.path == path) {
- isDir = true;
- directory.isMonitored = false;
- } else {
- for(int ii = 0; ii < directory.files.count(); ++ii) {
- if(directory.files.at(ii).path == path) {
- directory.files.removeAt(ii);
- break;
- }
- }
- }
-
- if(!directory.isMonitored && directory.files.isEmpty()) {
- // No longer needed
- qt_safe_close(directory.fd);
- pathToFD.remove(directory.path);
- fdToDirectory.remove(fd);
- }
-
- if(isDir) {
- directories->removeAll(path);
- } else {
- files->removeAll(path);
- }
-
- it.remove();
- }
-
- return p;
-}
-
-void QDnotifyFileSystemWatcherEngine::refresh(int fd)
-{
- QMutexLocker locker(&mutex);
-
- bool wasParent = false;
- QHash<int, Directory>::Iterator iter = fdToDirectory.find(fd);
- if(iter == fdToDirectory.end()) {
- QHash<int, int>::Iterator pIter = parentToFD.find(fd);
- if(pIter == parentToFD.end())
- return;
-
- iter = fdToDirectory.find(*pIter);
- if (iter == fdToDirectory.end())
- return;
- wasParent = true;
- }
-
- Directory &directory = *iter;
-
- if(!wasParent) {
- for(int ii = 0; ii < directory.files.count(); ++ii) {
- Directory::File &file = directory.files[ii];
- if(file.updateInfo()) {
- // Emit signal
- QString filePath = file.path;
- bool removed = !QFileInfo(filePath).exists();
-
- if(removed) {
- directory.files.removeAt(ii);
- --ii;
- }
-
- emit fileChanged(filePath, removed);
- }
- }
- }
-
- if(directory.isMonitored) {
- // Emit signal
- bool removed = !QFileInfo(directory.path).exists();
- QString path = directory.path;
-
- if(removed)
- directory.isMonitored = false;
-
- emit directoryChanged(path, removed);
- }
-
- if(!directory.isMonitored && directory.files.isEmpty()) {
- qt_safe_close(directory.fd);
- if(directory.parentFd) {
- qt_safe_close(directory.parentFd);
- parentToFD.remove(directory.parentFd);
- }
- fdToDirectory.erase(iter);
- }
-}
-
-void QDnotifyFileSystemWatcherEngine::stop()
-{
-}
-
-bool QDnotifyFileSystemWatcherEngine::Directory::File::updateInfo()
-{
- QFileInfo fi(path);
- QDateTime nLastWrite = fi.lastModified();
- uint nOwnerId = fi.ownerId();
- uint nGroupId = fi.groupId();
- QFile::Permissions nPermissions = fi.permissions();
-
- if(nLastWrite != lastWrite ||
- nOwnerId != ownerId ||
- nGroupId != groupId ||
- nPermissions != permissions) {
- ownerId = nOwnerId;
- groupId = nGroupId;
- permissions = nPermissions;
- lastWrite = nLastWrite;
- return true;
- } else {
- return false;
- }
-}
-
-QT_END_NAMESPACE
-
-#include "qfilesystemwatcher_dnotify.moc"
-
-#endif // QT_NO_FILESYSTEMWATCHER
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.cpp b/src/corelib/io/qfilesystemwatcher_fsevents.cpp
deleted file mode 100644
index 95da897974..0000000000
--- a/src/corelib/io/qfilesystemwatcher_fsevents.cpp
+++ /dev/null
@@ -1,492 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#define _DARWIN_USE_64_BIT_INODE
-#include <qplatformdefs.h>
-
-#include "qfilesystemwatcher.h"
-#include "qfilesystemwatcher_fsevents_p.h"
-
-#ifndef QT_NO_FILESYSTEMWATCHER
-
-#include <qdebug.h>
-#include <qfile.h>
-#include <qdatetime.h>
-#include <qfileinfo.h>
-#include <qvarlengtharray.h>
-
-#include <mach/mach.h>
-#include <sys/types.h>
-#include <CoreFoundation/CFRunLoop.h>
-#include <CoreFoundation/CFUUID.h>
-#include <CoreServices/CoreServices.h>
-#include <AvailabilityMacros.h>
-#include <private/qcore_mac_p.h>
-
-QT_BEGIN_NAMESPACE
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-// Static operator overloading so for the sake of some convieniece.
-// They only live in this compilation unit to avoid polluting Qt in general.
-static bool operator==(const struct ::timespec &left, const struct ::timespec &right)
-{
- return left.tv_sec == right.tv_sec
- && left.tv_nsec == right.tv_nsec;
-}
-
-static bool operator==(const struct ::stat &left, const struct ::stat &right)
-{
- return left.st_dev == right.st_dev
- && left.st_mode == right.st_mode
- && left.st_size == right.st_size
- && left.st_ino == right.st_ino
- && left.st_uid == right.st_uid
- && left.st_gid == right.st_gid
- && left.st_mtimespec == right.st_mtimespec
- && left.st_ctimespec == right.st_ctimespec
- && left.st_flags == right.st_flags;
-}
-
-static bool operator!=(const struct ::stat &left, const struct ::stat &right)
-{
- return !(operator==(left, right));
-}
-
-
-static void addPathToHash(PathHash &pathHash, const QString &key, const QFileInfo &fileInfo,
- const QString &path)
-{
- PathInfoList &list = pathHash[key];
- list.push_back(PathInfo(path,
- fileInfo.canonicalFilePath().normalized(QString::NormalizationForm_D).toUtf8()));
- pathHash.insert(key, list);
-}
-
-static void removePathFromHash(PathHash &pathHash, const QString &key, const QString &path)
-{
- PathInfoList &list = pathHash[key];
- // We make the assumption that the list contains unique paths
- PathInfoList::iterator End = list.end();
- PathInfoList::iterator it = list.begin();
- while (it != End) {
- if (it->originalPath == path) {
- list.erase(it);
- break;
- }
- ++it;
- }
- if (list.isEmpty())
- pathHash.remove(key);
-}
-
-static void stopFSStream(FSEventStreamRef stream)
-{
- if (stream) {
- FSEventStreamStop(stream);
- FSEventStreamInvalidate(stream);
- }
-}
-
-static QString createFSStreamPath(const QString &absolutePath)
-{
- // The path returned has a trailing slash, so ensure that here.
- QString string = absolutePath;
- string.reserve(string.size() + 1);
- string.append(QLatin1Char('/'));
- return string;
-}
-
-static void cleanupFSStream(FSEventStreamRef stream)
-{
- if (stream)
- FSEventStreamRelease(stream);
-}
-
-const FSEventStreamCreateFlags QtFSEventFlags = (kFSEventStreamCreateFlagUseCFTypes | kFSEventStreamCreateFlagNoDefer /* | kFSEventStreamCreateFlagWatchRoot*/);
-
-const CFTimeInterval Latency = 0.033; // This will do updates 30 times a second which is probably more than you need.
-#endif
-
-QFSEventsFileSystemWatcherEngine::QFSEventsFileSystemWatcherEngine()
- : fsStream(0), pathsToWatch(0), threadsRunLoop(0)
-{
-}
-
-QFSEventsFileSystemWatcherEngine::~QFSEventsFileSystemWatcherEngine()
-{
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- // I assume that at this point, QFileSystemWatcher has already called stop
- // on me, so I don't need to invalidate or stop my stream, simply
- // release it.
- cleanupFSStream(fsStream);
- if (pathsToWatch)
- CFRelease(pathsToWatch);
-#endif
-}
-
-QFSEventsFileSystemWatcherEngine *QFSEventsFileSystemWatcherEngine::create()
-{
- return new QFSEventsFileSystemWatcherEngine();
-}
-
-QStringList QFSEventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
- QStringList *files,
- QStringList *directories)
-{
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- stop();
- wait();
- QMutexLocker locker(&mutex);
- QStringList failedToAdd;
- // if we have a running FSStreamEvent, we have to kill it, we'll re-add the stream soon.
- FSEventStreamEventId idToCheck;
- if (fsStream) {
- idToCheck = FSEventStreamGetLatestEventId(fsStream);
- cleanupFSStream(fsStream);
- } else {
- idToCheck = kFSEventStreamEventIdSinceNow;
- }
-
- // Brain-dead approach, but works. FSEvents actually can already read sub-trees, but since it's
- // work to figure out if we are doing a double register, we just register it twice as FSEvents
- // seems smart enough to only deliver one event. We also duplicate directory entries in here
- // (e.g., if you watch five files in the same directory, you get that directory included in the
- // array 5 times). This stupidity also makes remove work correctly though. I'll freely admit
- // that we could make this a bit smarter. If you do, check the auto-tests, they should catch at
- // least a couple of the issues.
- QCFType<CFMutableArrayRef> tmpArray = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
- for (int i = 0; i < paths.size(); ++i) {
- const QString &path = paths.at(i);
-
- QFileInfo fileInfo(path);
- if (!fileInfo.exists()) {
- failedToAdd.append(path);
- continue;
- }
-
- if (fileInfo.isDir()) {
- if (directories->contains(path)) {
- failedToAdd.append(path);
- continue;
- } else {
- directories->append(path);
- // Full file path for dirs.
- QCFString cfpath(createFSStreamPath(fileInfo.canonicalFilePath()));
- addPathToHash(dirPathInfoHash, cfpath, fileInfo, path);
- CFArrayAppendValue(tmpArray, cfpath);
- }
- } else {
- if (files->contains(path)) {
- failedToAdd.append(path);
- continue;
- } else {
- // Just the absolute path (minus it's filename) for files.
- QCFString cfpath(createFSStreamPath(fileInfo.canonicalPath()));
- files->append(path);
- addPathToHash(filePathInfoHash, cfpath, fileInfo, path);
- CFArrayAppendValue(tmpArray, cfpath);
- }
- }
- }
-
- if (!pathsToWatch && failedToAdd.size() == paths.size()) {
- return failedToAdd;
- }
-
- if (CFArrayGetCount(tmpArray) > 0) {
- if (pathsToWatch) {
- CFArrayAppendArray(tmpArray, pathsToWatch, CFRangeMake(0, CFArrayGetCount(pathsToWatch)));
- CFRelease(pathsToWatch);
- }
- pathsToWatch = CFArrayCreateCopy(kCFAllocatorDefault, tmpArray);
- }
-
- FSEventStreamContext context = { 0, this, 0, 0, 0 };
- fsStream = FSEventStreamCreate(kCFAllocatorDefault,
- QFSEventsFileSystemWatcherEngine::fseventsCallback,
- &context, pathsToWatch,
- idToCheck, Latency, QtFSEventFlags);
- warmUpFSEvents();
-
- return failedToAdd;
-#else
- Q_UNUSED(paths);
- Q_UNUSED(files);
- Q_UNUSED(directories);
- return QStringList();
-#endif
-}
-
-void QFSEventsFileSystemWatcherEngine::warmUpFSEvents()
-{
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- // This function assumes that the mutex has already been grabbed before calling it.
- // It exits with the mutex still locked (Q_ASSERT(mutex.isLocked()) ;-).
- start();
- waitCondition.wait(&mutex);
-#endif
-}
-
-QStringList QFSEventsFileSystemWatcherEngine::removePaths(const QStringList &paths,
- QStringList *files,
- QStringList *directories)
-{
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- stop();
- wait();
- QMutexLocker locker(&mutex);
- // short circuit for smarties that call remove before add and we have nothing.
- if (pathsToWatch == 0)
- return paths;
- QStringList failedToRemove;
- // if we have a running FSStreamEvent, we have to stop it, we'll re-add the stream soon.
- FSEventStreamEventId idToCheck;
- if (fsStream) {
- idToCheck = FSEventStreamGetLatestEventId(fsStream);
- cleanupFSStream(fsStream);
- fsStream = 0;
- } else {
- idToCheck = kFSEventStreamEventIdSinceNow;
- }
-
- CFIndex itemCount = CFArrayGetCount(pathsToWatch);
- QCFType<CFMutableArrayRef> tmpArray = CFArrayCreateMutableCopy(kCFAllocatorDefault, itemCount,
- pathsToWatch);
- CFRelease(pathsToWatch);
- pathsToWatch = 0;
- for (int i = 0; i < paths.size(); ++i) {
- // Get the itemCount at the beginning to avoid any overruns during the iteration.
- itemCount = CFArrayGetCount(tmpArray);
- const QString &path = paths.at(i);
- QFileInfo fi(path);
- QCFString cfpath(createFSStreamPath(fi.canonicalPath()));
-
- CFIndex index = CFArrayGetFirstIndexOfValue(tmpArray, CFRangeMake(0, itemCount), cfpath);
- if (index != -1) {
- CFArrayRemoveValueAtIndex(tmpArray, index);
- files->removeAll(path);
- removePathFromHash(filePathInfoHash, cfpath, path);
- } else {
- // Could be a directory we are watching instead.
- QCFString cfdirpath(createFSStreamPath(fi.canonicalFilePath()));
- index = CFArrayGetFirstIndexOfValue(tmpArray, CFRangeMake(0, itemCount), cfdirpath);
- if (index != -1) {
- CFArrayRemoveValueAtIndex(tmpArray, index);
- directories->removeAll(path);
- removePathFromHash(dirPathInfoHash, cfpath, path);
- } else {
- failedToRemove.append(path);
- }
- }
- }
- itemCount = CFArrayGetCount(tmpArray);
- if (itemCount != 0) {
- pathsToWatch = CFArrayCreateCopy(kCFAllocatorDefault, tmpArray);
-
- FSEventStreamContext context = { 0, this, 0, 0, 0 };
- fsStream = FSEventStreamCreate(kCFAllocatorDefault,
- QFSEventsFileSystemWatcherEngine::fseventsCallback,
- &context, pathsToWatch, idToCheck, Latency, QtFSEventFlags);
- warmUpFSEvents();
- }
- return failedToRemove;
-#else
- Q_UNUSED(paths);
- Q_UNUSED(files);
- Q_UNUSED(directories);
- return QStringList();
-#endif
-}
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-void QFSEventsFileSystemWatcherEngine::updateList(PathInfoList &list, bool directory, bool emitSignals)
-{
- PathInfoList::iterator End = list.end();
- PathInfoList::iterator it = list.begin();
- while (it != End) {
- struct ::stat newInfo;
- if (::stat(it->absolutePath, &newInfo) == 0) {
- if (emitSignals) {
- if (newInfo != it->savedInfo) {
- it->savedInfo = newInfo;
- if (directory)
- emit directoryChanged(it->originalPath, false);
- else
- emit fileChanged(it->originalPath, false);
- }
- } else {
- it->savedInfo = newInfo;
- }
- } else {
- if (errno == ENOENT) {
- if (emitSignals) {
- if (directory)
- emit directoryChanged(it->originalPath, true);
- else
- emit fileChanged(it->originalPath, true);
- }
- it = list.erase(it);
- continue;
- } else {
- qWarning("%s:%d:QFSEventsFileSystemWatcherEngine: stat error on %s:%s",
- __FILE__, __LINE__, qPrintable(it->originalPath), strerror(errno));
-
- }
- }
- ++it;
- }
-}
-
-void QFSEventsFileSystemWatcherEngine::updateHash(PathHash &pathHash)
-{
- PathHash::iterator HashEnd = pathHash.end();
- PathHash::iterator it = pathHash.begin();
- const bool IsDirectory = (&pathHash == &dirPathInfoHash);
- while (it != HashEnd) {
- updateList(it.value(), IsDirectory, false);
- if (it.value().isEmpty())
- it = pathHash.erase(it);
- else
- ++it;
- }
-}
-#endif
-
-void QFSEventsFileSystemWatcherEngine::fseventsCallback(ConstFSEventStreamRef ,
- void *clientCallBackInfo, size_t numEvents,
- void *eventPaths,
- const FSEventStreamEventFlags eventFlags[],
- const FSEventStreamEventId [])
-{
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- QFSEventsFileSystemWatcherEngine *watcher = static_cast<QFSEventsFileSystemWatcherEngine *>(clientCallBackInfo);
- QMutexLocker locker(&watcher->mutex);
- CFArrayRef paths = static_cast<CFArrayRef>(eventPaths);
- for (size_t i = 0; i < numEvents; ++i) {
- const QString path = QCFString::toQString(
- static_cast<CFStringRef>(CFArrayGetValueAtIndex(paths, i)));
- const FSEventStreamEventFlags pathFlags = eventFlags[i];
- // There are several flags that may be passed, but we really don't care about them ATM.
- // Here they are and why we don't care.
- // kFSEventStreamEventFlagHistoryDone--(very unlikely to be gotten, but even then, not much changes).
- // kFSEventStreamEventFlagMustScanSubDirs--Likely means the data is very much out of date, we
- // aren't coalescing our directories, so again not so much of an issue
- // kFSEventStreamEventFlagRootChanged | kFSEventStreamEventFlagMount | kFSEventStreamEventFlagUnmount--
- // These three flags indicate something has changed, but the stat will likely show this, so
- // there's not really much to worry about.
- // (btw, FSEvents is not the correct way of checking for mounts/unmounts,
- // there are real CarbonCore events for that.)
- Q_UNUSED(pathFlags);
- if (watcher->filePathInfoHash.contains(path))
- watcher->updateList(watcher->filePathInfoHash[path], false, true);
-
- if (watcher->dirPathInfoHash.contains(path))
- watcher->updateList(watcher->dirPathInfoHash[path], true, true);
- }
-#else
- Q_UNUSED(clientCallBackInfo);
- Q_UNUSED(numEvents);
- Q_UNUSED(eventPaths);
- Q_UNUSED(eventFlags);
-#endif
-}
-
-void QFSEventsFileSystemWatcherEngine::stop()
-{
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- QMutexLocker locker(&mutex);
- stopFSStream(fsStream);
- if (threadsRunLoop) {
- CFRunLoopStop(threadsRunLoop);
- waitForStop.wait(&mutex);
- }
-#endif
-}
-
-void QFSEventsFileSystemWatcherEngine::updateFiles()
-{
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- QMutexLocker locker(&mutex);
- updateHash(filePathInfoHash);
- updateHash(dirPathInfoHash);
- if (filePathInfoHash.isEmpty() && dirPathInfoHash.isEmpty()) {
- // Everything disappeared before we got to start, don't bother.
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- // Code duplicated from stop(), with the exception that we
- // don't wait on waitForStop here. Doing this will lead to
- // a deadlock since this function is called from the worker
- // thread. (waitForStop.wakeAll() is only called from the
- // end of run()).
- stopFSStream(fsStream);
- if (threadsRunLoop)
- CFRunLoopStop(threadsRunLoop);
-#endif
- cleanupFSStream(fsStream);
- }
- waitCondition.wakeAll();
-#endif
-}
-
-void QFSEventsFileSystemWatcherEngine::run()
-{
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- threadsRunLoop = CFRunLoopGetCurrent();
- FSEventStreamScheduleWithRunLoop(fsStream, threadsRunLoop, kCFRunLoopDefaultMode);
- bool startedOK = FSEventStreamStart(fsStream);
- // It's recommended by Apple that you only update the files after you've started
- // the stream, because otherwise you might miss an update in between starting it.
- updateFiles();
-#ifdef QT_NO_DEBUG
- Q_UNUSED(startedOK);
-#else
- Q_ASSERT(startedOK);
-#endif
- // If for some reason we called stop up above (and invalidated our stream), this call will return
- // immediately.
- CFRunLoopRun();
- threadsRunLoop = 0;
- QMutexLocker locker(&mutex);
- waitForStop.wakeAll();
-#endif
-}
-
-QT_END_NAMESPACE
-#endif //QT_NO_FILESYSTEMWATCHER
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents_p.h b/src/corelib/io/qfilesystemwatcher_fsevents_p.h
deleted file mode 100644
index 3830002c0a..0000000000
--- a/src/corelib/io/qfilesystemwatcher_fsevents_p.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef FILEWATCHER_FSEVENTS_P_H
-#define FILEWATCHER_FSEVENTS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qfilesystemwatcher_p.h"
-
-#ifndef QT_NO_FILESYSTEMWATCHER
-
-#include <QtCore/qmutex.h>
-#include <QtCore/qwaitcondition.h>
-#include <QtCore/qthread.h>
-#include <QtCore/qhash.h>
-#include <QtCore/qlinkedlist.h>
-#include <private/qcore_mac_p.h>
-#include <sys/stat.h>
-
-typedef struct __FSEventStream *FSEventStreamRef;
-typedef const struct __FSEventStream *ConstFSEventStreamRef;
-typedef const struct __CFArray *CFArrayRef;
-typedef UInt32 FSEventStreamEventFlags;
-typedef uint64_t FSEventStreamEventId;
-
-QT_BEGIN_NAMESPACE
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-// Yes, I use a stat element here. QFileInfo requires too much knowledge about implementation
-// details to be used as a long-standing record. Since I'm going to have to store this information, I can
-// do the stat myself too.
-struct PathInfo {
- PathInfo(const QString &path, const QByteArray &absPath)
- : originalPath(path), absolutePath(absPath) {}
- QString originalPath; // The path we need to emit
- QByteArray absolutePath; // The path we need to stat.
- struct ::stat savedInfo; // All the info for the path so we can compare it.
-};
-typedef QLinkedList<PathInfo> PathInfoList;
-typedef QHash<QString, PathInfoList> PathHash;
-#endif
-
-class QFSEventsFileSystemWatcherEngine : public QFileSystemWatcherEngine
-{
- Q_OBJECT
-public:
- ~QFSEventsFileSystemWatcherEngine();
-
- static QFSEventsFileSystemWatcherEngine *create();
-
- QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories);
- QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories);
-
- void stop();
-
-private:
- QFSEventsFileSystemWatcherEngine();
- void warmUpFSEvents();
- void updateFiles();
-
- static void fseventsCallback(ConstFSEventStreamRef streamRef, void *clientCallBackInfo, size_t numEvents,
- void *eventPaths, const FSEventStreamEventFlags eventFlags[],
- const FSEventStreamEventId eventIds[]);
- void run();
- FSEventStreamRef fsStream;
- CFArrayRef pathsToWatch;
- CFRunLoopRef threadsRunLoop;
- QMutex mutex;
- QWaitCondition waitCondition;
- QWaitCondition waitForStop;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- PathHash filePathInfoHash;
- PathHash dirPathInfoHash;
- void updateHash(PathHash &pathHash);
- void updateList(PathInfoList &list, bool directory, bool emitSignals);
-#endif
-};
-
-#endif //QT_NO_FILESYSTEMWATCHER
-
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp
index ef302243da..ff732bc70e 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -210,7 +210,7 @@ QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
-QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create()
+QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create(QObject *parent)
{
register int fd = -1;
#ifdef IN_CLOEXEC
@@ -220,40 +220,32 @@ QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create()
fd = inotify_init();
if (fd == -1)
return 0;
- ::fcntl(fd, F_SETFD, FD_CLOEXEC);
}
- return new QInotifyFileSystemWatcherEngine(fd);
+ return new QInotifyFileSystemWatcherEngine(fd, parent);
}
-QInotifyFileSystemWatcherEngine::QInotifyFileSystemWatcherEngine(int fd)
- : inotifyFd(fd)
+QInotifyFileSystemWatcherEngine::QInotifyFileSystemWatcherEngine(int fd, QObject *parent)
+ : QFileSystemWatcherEngine(parent),
+ inotifyFd(fd),
+ notifier(fd, QSocketNotifier::Read, this)
{
fcntl(inotifyFd, F_SETFD, FD_CLOEXEC);
-
- moveToThread(this);
+ connect(&notifier, SIGNAL(activated(int)), SLOT(readFromInotify()));
}
QInotifyFileSystemWatcherEngine::~QInotifyFileSystemWatcherEngine()
{
+ notifier.setEnabled(false);
foreach (int id, pathToID)
inotify_rm_watch(inotifyFd, id < 0 ? -id : id);
::close(inotifyFd);
}
-void QInotifyFileSystemWatcherEngine::run()
-{
- QSocketNotifier sn(inotifyFd, QSocketNotifier::Read, this);
- connect(&sn, SIGNAL(activated(int)), SLOT(readFromInotify()));
- (void) exec();
-}
-
QStringList QInotifyFileSystemWatcherEngine::addPaths(const QStringList &paths,
QStringList *files,
QStringList *directories)
{
- QMutexLocker locker(&mutex);
-
QStringList p = paths;
QMutableListIterator<QString> it(p);
while (it.hasNext()) {
@@ -303,8 +295,6 @@ QStringList QInotifyFileSystemWatcherEngine::addPaths(const QStringList &paths,
idToPath.insert(id, path);
}
- start();
-
return p;
}
@@ -312,8 +302,6 @@ QStringList QInotifyFileSystemWatcherEngine::removePaths(const QStringList &path
QStringList *files,
QStringList *directories)
{
- QMutexLocker locker(&mutex);
-
QStringList p = paths;
QMutableListIterator<QString> it(p);
while (it.hasNext()) {
@@ -338,15 +326,8 @@ QStringList QInotifyFileSystemWatcherEngine::removePaths(const QStringList &path
return p;
}
-void QInotifyFileSystemWatcherEngine::stop()
-{
- quit();
-}
-
void QInotifyFileSystemWatcherEngine::readFromInotify()
{
- QMutexLocker locker(&mutex);
-
// qDebug() << "QInotifyFileSystemWatcherEngine::readFromInotify";
int buffSize = 0;
diff --git a/src/corelib/io/qfilesystemwatcher_inotify_p.h b/src/corelib/io/qfilesystemwatcher_inotify_p.h
index 0abd205237..8b3ce62c46 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify_p.h
+++ b/src/corelib/io/qfilesystemwatcher_inotify_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -57,8 +57,9 @@
#ifndef QT_NO_FILESYSTEMWATCHER
-#include <qhash.h>
-#include <qmutex.h>
+#include <QtCore/qhash.h>
+#include <QtCore/qmutex.h>
+#include <QtCore/qsocketnotifier.h>
QT_BEGIN_NAMESPACE
@@ -69,24 +70,20 @@ class QInotifyFileSystemWatcherEngine : public QFileSystemWatcherEngine
public:
~QInotifyFileSystemWatcherEngine();
- static QInotifyFileSystemWatcherEngine *create();
-
- void run();
+ static QInotifyFileSystemWatcherEngine *create(QObject *parent);
QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories);
QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories);
- void stop();
-
private Q_SLOTS:
void readFromInotify();
private:
- QInotifyFileSystemWatcherEngine(int fd);
+ QInotifyFileSystemWatcherEngine(int fd, QObject *parent);
int inotifyFd;
- QMutex mutex;
QHash<QString, int> pathToID;
QHash<int, QString> idToPath;
+ QSocketNotifier notifier;
};
diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp
index 387a7f7c4b..fd7bfa2b27 100644
--- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp
+++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -67,49 +67,28 @@ QT_BEGIN_NAMESPACE
# define DEBUG if(false)qDebug
#endif
-QKqueueFileSystemWatcherEngine *QKqueueFileSystemWatcherEngine::create()
+QKqueueFileSystemWatcherEngine *QKqueueFileSystemWatcherEngine::create(QObject *parent)
{
int kqfd = kqueue();
if (kqfd == -1)
return 0;
- return new QKqueueFileSystemWatcherEngine(kqfd);
+ return new QKqueueFileSystemWatcherEngine(kqfd, parent);
}
-QKqueueFileSystemWatcherEngine::QKqueueFileSystemWatcherEngine(int kqfd)
- : kqfd(kqfd)
+QKqueueFileSystemWatcherEngine::QKqueueFileSystemWatcherEngine(int kqfd, QObject *parent)
+ : QFileSystemWatcherEngine(parent),
+ kqfd(kqfd),
+ notifier(kqfd, QSocketNotifier::Read, this)
{
- fcntl(kqfd, F_SETFD, FD_CLOEXEC);
+ connect(&notifier, SIGNAL(activated(int)), SLOT(readFromKqueue()));
- if (pipe(kqpipe) == -1) {
- perror("QKqueueFileSystemWatcherEngine: cannot create pipe");
- kqpipe[0] = kqpipe[1] = -1;
- return;
- }
- fcntl(kqpipe[0], F_SETFD, FD_CLOEXEC);
- fcntl(kqpipe[1], F_SETFD, FD_CLOEXEC);
-
- struct kevent kev;
- EV_SET(&kev,
- kqpipe[0],
- EVFILT_READ,
- EV_ADD | EV_ENABLE,
- 0,
- 0,
- 0);
- if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) {
- perror("QKqueueFileSystemWatcherEngine: cannot watch pipe, kevent returned");
- return;
- }
+ fcntl(kqfd, F_SETFD, FD_CLOEXEC);
}
QKqueueFileSystemWatcherEngine::~QKqueueFileSystemWatcherEngine()
{
- stop();
- wait();
-
+ notifier.setEnabled(false);
close(kqfd);
- close(kqpipe[0]);
- close(kqpipe[1]);
foreach (int id, pathToID)
::close(id < 0 ? -id : id);
@@ -120,82 +99,73 @@ QStringList QKqueueFileSystemWatcherEngine::addPaths(const QStringList &paths,
QStringList *directories)
{
QStringList p = paths;
- {
- QMutexLocker locker(&mutex);
-
- QMutableListIterator<QString> it(p);
- while (it.hasNext()) {
- QString path = it.next();
- int fd;
+ QMutableListIterator<QString> it(p);
+ while (it.hasNext()) {
+ QString path = it.next();
+ int fd;
#if defined(O_EVTONLY)
- fd = qt_safe_open(QFile::encodeName(path), O_EVTONLY);
+ fd = qt_safe_open(QFile::encodeName(path), O_EVTONLY);
#else
- fd = qt_safe_open(QFile::encodeName(path), O_RDONLY);
+ fd = qt_safe_open(QFile::encodeName(path), O_RDONLY);
#endif
- if (fd == -1) {
- perror("QKqueueFileSystemWatcherEngine::addPaths: open");
- continue;
- }
- if (fd >= (int)FD_SETSIZE / 2 && fd < (int)FD_SETSIZE) {
- int fddup = fcntl(fd, F_DUPFD, FD_SETSIZE);
- if (fddup != -1) {
- ::close(fd);
- fd = fddup;
- }
+ if (fd == -1) {
+ perror("QKqueueFileSystemWatcherEngine::addPaths: open");
+ continue;
+ }
+ if (fd >= (int)FD_SETSIZE / 2 && fd < (int)FD_SETSIZE) {
+ int fddup = fcntl(fd, F_DUPFD, FD_SETSIZE);
+ if (fddup != -1) {
+ ::close(fd);
+ fd = fddup;
}
- fcntl(fd, F_SETFD, FD_CLOEXEC);
+ }
+ fcntl(fd, F_SETFD, FD_CLOEXEC);
- QT_STATBUF st;
- if (QT_FSTAT(fd, &st) == -1) {
- perror("QKqueueFileSystemWatcherEngine::addPaths: fstat");
+ QT_STATBUF st;
+ if (QT_FSTAT(fd, &st) == -1) {
+ perror("QKqueueFileSystemWatcherEngine::addPaths: fstat");
+ ::close(fd);
+ continue;
+ }
+ int id = (S_ISDIR(st.st_mode)) ? -fd : fd;
+ if (id < 0) {
+ if (directories->contains(path)) {
::close(fd);
continue;
}
- int id = (S_ISDIR(st.st_mode)) ? -fd : fd;
- if (id < 0) {
- if (directories->contains(path)) {
- ::close(fd);
- continue;
- }
- } else {
- if (files->contains(path)) {
- ::close(fd);
- continue;
- }
- }
-
- struct kevent kev;
- EV_SET(&kev,
- fd,
- EVFILT_VNODE,
- EV_ADD | EV_ENABLE | EV_CLEAR,
- NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE,
- 0,
- 0);
- if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) {
- perror("QKqueueFileSystemWatcherEngine::addPaths: kevent");
+ } else {
+ if (files->contains(path)) {
::close(fd);
continue;
}
+ }
- it.remove();
- if (id < 0) {
- DEBUG() << "QKqueueFileSystemWatcherEngine: added directory path" << path;
- directories->append(path);
- } else {
- DEBUG() << "QKqueueFileSystemWatcherEngine: added file path" << path;
- files->append(path);
- }
+ struct kevent kev;
+ EV_SET(&kev,
+ fd,
+ EVFILT_VNODE,
+ EV_ADD | EV_ENABLE | EV_CLEAR,
+ NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE,
+ 0,
+ 0);
+ if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) {
+ perror("QKqueueFileSystemWatcherEngine::addPaths: kevent");
+ ::close(fd);
+ continue;
+ }
- pathToID.insert(path, id);
- idToPath.insert(id, path);
+ it.remove();
+ if (id < 0) {
+ DEBUG() << "QKqueueFileSystemWatcherEngine: added directory path" << path;
+ directories->append(path);
+ } else {
+ DEBUG() << "QKqueueFileSystemWatcherEngine: added file path" << path;
+ files->append(path);
}
- }
- if (!isRunning())
- start();
- else
- write(kqpipe[1], "@", 1);
+ pathToID.insert(path, id);
+ idToPath.insert(id, path);
+ }
return p;
}
@@ -206,126 +176,86 @@ QStringList QKqueueFileSystemWatcherEngine::removePaths(const QStringList &paths
{
bool isEmpty;
QStringList p = paths;
- {
- QMutexLocker locker(&mutex);
- if (pathToID.isEmpty())
- return p;
-
- QMutableListIterator<QString> it(p);
- while (it.hasNext()) {
- QString path = it.next();
- int id = pathToID.take(path);
- QString x = idToPath.take(id);
- if (x.isEmpty() || x != path)
- continue;
+ if (pathToID.isEmpty())
+ return p;
- ::close(id < 0 ? -id : id);
+ QMutableListIterator<QString> it(p);
+ while (it.hasNext()) {
+ QString path = it.next();
+ int id = pathToID.take(path);
+ QString x = idToPath.take(id);
+ if (x.isEmpty() || x != path)
+ continue;
- it.remove();
- if (id < 0)
- directories->removeAll(path);
- else
- files->removeAll(path);
- }
- isEmpty = pathToID.isEmpty();
- }
+ ::close(id < 0 ? -id : id);
- if (isEmpty) {
- stop();
- wait();
- } else {
- write(kqpipe[1], "@", 1);
+ it.remove();
+ if (id < 0)
+ directories->removeAll(path);
+ else
+ files->removeAll(path);
}
+ isEmpty = pathToID.isEmpty();
return p;
}
-void QKqueueFileSystemWatcherEngine::stop()
-{
- write(kqpipe[1], "q", 1);
-}
-
-void QKqueueFileSystemWatcherEngine::run()
+void QKqueueFileSystemWatcherEngine::readFromKqueue()
{
forever {
+ DEBUG() << "QKqueueFileSystemWatcherEngine: polling for changes";
int r;
struct kevent kev;
- DEBUG() << "QKqueueFileSystemWatcherEngine: waiting for kevents...";
- EINTR_LOOP(r, kevent(kqfd, 0, 0, &kev, 1, 0));
+ struct timespec ts = { 0, 0 }; // 0 ts, because we want to poll
+ EINTR_LOOP(r, kevent(kqfd, 0, 0, &kev, 1, &ts));
if (r < 0) {
perror("QKqueueFileSystemWatcherEngine: error during kevent wait");
return;
+ } else if (r == 0) {
+ // polling returned no events, so stop
+ break;
} else {
int fd = kev.ident;
DEBUG() << "QKqueueFileSystemWatcherEngine: processing kevent" << kev.ident << kev.filter;
- if (fd == kqpipe[0]) {
- // read all pending data from the pipe
- QByteArray ba;
- ba.resize(kev.data);
- if (read(kqpipe[0], ba.data(), ba.size()) != ba.size()) {
- perror("QKqueueFileSystemWatcherEngine: error reading from pipe");
- return;
- }
- // read the command from the buffer (but break and return on 'q')
- char cmd = 0;
- for (int i = 0; i < ba.size(); ++i) {
- cmd = ba.constData()[i];
- if (cmd == 'q')
- break;
- }
- // handle the command
- switch (cmd) {
- case 'q':
- DEBUG() << "QKqueueFileSystemWatcherEngine: thread received 'q', exiting...";
- return;
- case '@':
- DEBUG() << "QKqueueFileSystemWatcherEngine: thread received '@', continuing...";
- break;
- default:
- DEBUG() << "QKqueueFileSystemWatcherEngine: thread received unknow message" << cmd;
- break;
- }
- } else {
- QMutexLocker locker(&mutex);
- int id = fd;
- QString path = idToPath.value(id);
+ int id = fd;
+ QString path = idToPath.value(id);
+ if (path.isEmpty()) {
+ // perhaps a directory?
+ id = -id;
+ path = idToPath.value(id);
if (path.isEmpty()) {
- // perhaps a directory?
- id = -id;
- path = idToPath.value(id);
- if (path.isEmpty()) {
- DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent for a file we're not watching";
- continue;
- }
- }
- if (kev.filter != EVFILT_VNODE) {
- DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent with the wrong filter";
+ DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent for a file we're not watching";
continue;
}
+ }
+ if (kev.filter != EVFILT_VNODE) {
+ DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent with the wrong filter";
+ continue;
+ }
- if ((kev.fflags & (NOTE_DELETE | NOTE_REVOKE | NOTE_RENAME)) != 0) {
- DEBUG() << path << "removed, removing watch also";
+ if ((kev.fflags & (NOTE_DELETE | NOTE_REVOKE | NOTE_RENAME)) != 0) {
+ DEBUG() << path << "removed, removing watch also";
- pathToID.remove(path);
- idToPath.remove(id);
- ::close(fd);
+ pathToID.remove(path);
+ idToPath.remove(id);
+ ::close(fd);
- if (id < 0)
- emit directoryChanged(path, true);
- else
- emit fileChanged(path, true);
- } else {
- DEBUG() << path << "changed";
+ if (id < 0)
+ emit directoryChanged(path, true);
+ else
+ emit fileChanged(path, true);
+ } else {
+ DEBUG() << path << "changed";
- if (id < 0)
- emit directoryChanged(path, false);
- else
- emit fileChanged(path, false);
- }
+ if (id < 0)
+ emit directoryChanged(path, false);
+ else
+ emit fileChanged(path, false);
}
}
+
}
}
diff --git a/src/corelib/io/qfilesystemwatcher_kqueue_p.h b/src/corelib/io/qfilesystemwatcher_kqueue_p.h
index fd9d820e7d..9bd9378c0c 100644
--- a/src/corelib/io/qfilesystemwatcher_kqueue_p.h
+++ b/src/corelib/io/qfilesystemwatcher_kqueue_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -59,6 +59,7 @@
#include <QtCore/qmutex.h>
#include <QtCore/qthread.h>
#include <QtCore/qvector.h>
+#include <QtCore/qsocketnotifier.h>
#ifndef QT_NO_FILESYSTEMWATCHER
struct kevent;
@@ -71,24 +72,22 @@ class QKqueueFileSystemWatcherEngine : public QFileSystemWatcherEngine
public:
~QKqueueFileSystemWatcherEngine();
- static QKqueueFileSystemWatcherEngine *create();
+ static QKqueueFileSystemWatcherEngine *create(QObject *parent);
QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories);
QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories);
- void stop();
+private Q_SLOTS:
+ void readFromKqueue();
private:
- QKqueueFileSystemWatcherEngine(int kqfd);
-
- void run();
+ QKqueueFileSystemWatcherEngine(int kqfd, QObject *parent);
int kqfd;
- int kqpipe[2];
- QMutex mutex;
QHash<QString, int> pathToID;
QHash<int, QString> idToPath;
+ QSocketNotifier notifier;
};
QT_END_NAMESPACE
diff --git a/src/corelib/io/qfilesystemwatcher_p.h b/src/corelib/io/qfilesystemwatcher_p.h
index e136273b36..9f403b308f 100644
--- a/src/corelib/io/qfilesystemwatcher_p.h
+++ b/src/corelib/io/qfilesystemwatcher_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -60,19 +60,17 @@
#include <private/qobject_p.h>
#include <QtCore/qstringlist.h>
-#include <QtCore/qthread.h>
QT_BEGIN_NAMESPACE
-class QFileSystemWatcherEngine : public QThread
+class QFileSystemWatcherEngine : public QObject
{
Q_OBJECT
protected:
- inline QFileSystemWatcherEngine(bool move = true)
+ inline QFileSystemWatcherEngine(QObject *parent)
+ : QObject(parent)
{
- if (move)
- moveToThread(this);
}
public:
@@ -88,8 +86,6 @@ public:
QStringList *files,
QStringList *directories) = 0;
- virtual void stop() = 0;
-
Q_SIGNALS:
void fileChanged(const QString &path, bool removed);
void directoryChanged(const QString &path, bool removed);
@@ -99,15 +95,14 @@ class QFileSystemWatcherPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QFileSystemWatcher)
- static QFileSystemWatcherEngine *createNativeEngine();
+ static QFileSystemWatcherEngine *createNativeEngine(QObject *parent);
public:
QFileSystemWatcherPrivate();
void init();
void initPollerEngine();
- void initForcedEngine(const QString &);
- QFileSystemWatcherEngine *native, *poller, *forced;
+ QFileSystemWatcherEngine *native, *poller;
QStringList files, directories;
// private slots
diff --git a/src/corelib/io/qfilesystemwatcher_polling.cpp b/src/corelib/io/qfilesystemwatcher_polling.cpp
new file mode 100644
index 0000000000..23dca140d6
--- /dev/null
+++ b/src/corelib/io/qfilesystemwatcher_polling.cpp
@@ -0,0 +1,151 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qfilesystemwatcher_polling_p.h"
+#include <QtCore/qtimer.h>
+
+QT_BEGIN_NAMESPACE
+
+QPollingFileSystemWatcherEngine::QPollingFileSystemWatcherEngine(QObject *parent)
+ : QFileSystemWatcherEngine(parent),
+ timer(this)
+{
+ connect(&timer, SIGNAL(timeout()), SLOT(timeout()));
+}
+
+QStringList QPollingFileSystemWatcherEngine::addPaths(const QStringList &paths,
+ QStringList *files,
+ QStringList *directories)
+{
+ QStringList p = paths;
+ QMutableListIterator<QString> it(p);
+ while (it.hasNext()) {
+ QString path = it.next();
+ QFileInfo fi(path);
+ if (!fi.exists())
+ continue;
+ if (fi.isDir()) {
+ if (!directories->contains(path))
+ directories->append(path);
+ if (!path.endsWith(QLatin1Char('/')))
+ fi = QFileInfo(path + QLatin1Char('/'));
+ this->directories.insert(path, fi);
+ } else {
+ if (!files->contains(path))
+ files->append(path);
+ this->files.insert(path, fi);
+ }
+ it.remove();
+ }
+
+ if ((!this->files.isEmpty() ||
+ !this->directories.isEmpty()) &&
+ !timer.isActive()) {
+ timer.start(PollingInterval);
+ }
+
+ return p;
+}
+
+QStringList QPollingFileSystemWatcherEngine::removePaths(const QStringList &paths,
+ QStringList *files,
+ QStringList *directories)
+{
+ QStringList p = paths;
+ QMutableListIterator<QString> it(p);
+ while (it.hasNext()) {
+ QString path = it.next();
+ if (this->directories.remove(path)) {
+ directories->removeAll(path);
+ it.remove();
+ } else if (this->files.remove(path)) {
+ files->removeAll(path);
+ it.remove();
+ }
+ }
+
+ if (this->files.isEmpty() &&
+ this->directories.isEmpty()) {
+ timer.stop();
+ }
+
+ return p;
+}
+
+void QPollingFileSystemWatcherEngine::timeout()
+{
+ QMutableHashIterator<QString, FileInfo> fit(files);
+ while (fit.hasNext()) {
+ QHash<QString, FileInfo>::iterator x = fit.next();
+ QString path = x.key();
+ QFileInfo fi(path);
+ if (!fi.exists()) {
+ fit.remove();
+ emit fileChanged(path, true);
+ } else if (x.value() != fi) {
+ x.value() = fi;
+ emit fileChanged(path, false);
+ }
+ }
+ QMutableHashIterator<QString, FileInfo> dit(directories);
+ while (dit.hasNext()) {
+ QHash<QString, FileInfo>::iterator x = dit.next();
+ QString path = x.key();
+ QFileInfo fi(path);
+ if (!path.endsWith(QLatin1Char('/')))
+ fi = QFileInfo(path + QLatin1Char('/'));
+ if (!fi.exists()) {
+ dit.remove();
+ emit directoryChanged(path, true);
+ } else if (x.value() != fi) {
+ fi.refresh();
+ if (!fi.exists()) {
+ dit.remove();
+ emit directoryChanged(path, true);
+ } else {
+ x.value() = fi;
+ emit directoryChanged(path, false);
+ }
+ }
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/corelib/io/qfilesystemwatcher_dnotify_p.h b/src/corelib/io/qfilesystemwatcher_polling_p.h
index f759e87d89..3b3272a890 100644
--- a/src/corelib/io/qfilesystemwatcher_dnotify_p.h
+++ b/src/corelib/io/qfilesystemwatcher_polling_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QFILESYSTEMWATCHER_DNOTIFY_P_H
-#define QFILESYSTEMWATCHER_DNOTIFY_P_H
+#ifndef QFILESYSTEMWATCHER_POLLING_P_H
+#define QFILESYSTEMWATCHER_POLLING_P_H
//
// W A R N I N G
@@ -53,79 +53,74 @@
// We mean it.
//
-#include "qfilesystemwatcher_p.h"
-
-#ifndef QT_NO_FILESYSTEMWATCHER
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qmutex.h>
+#include <QtCore/qdatetime.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qtimer.h>
-#include <qmutex.h>
-#include <qhash.h>
-#include <qdatetime.h>
-#include <qfile.h>
+#include "qfilesystemwatcher_p.h"
QT_BEGIN_NAMESPACE
-class QDnotifyFileSystemWatcherEngine : public QFileSystemWatcherEngine
+enum { PollingInterval = 1000 };
+
+class QPollingFileSystemWatcherEngine : public QFileSystemWatcherEngine
{
Q_OBJECT
-public:
- virtual ~QDnotifyFileSystemWatcherEngine();
+ class FileInfo
+ {
+ uint ownerId;
+ uint groupId;
+ QFile::Permissions permissions;
+ QDateTime lastModified;
+ QStringList entries;
+
+ public:
+ FileInfo(const QFileInfo &fileInfo)
+ : ownerId(fileInfo.ownerId()),
+ groupId(fileInfo.groupId()),
+ permissions(fileInfo.permissions()),
+ lastModified(fileInfo.lastModified())
+ {
+ if (fileInfo.isDir()) {
+ entries = fileInfo.absoluteDir().entryList(QDir::AllEntries);
+ }
+ }
+ FileInfo &operator=(const QFileInfo &fileInfo)
+ {
+ *this = FileInfo(fileInfo);
+ return *this;
+ }
+
+ bool operator!=(const QFileInfo &fileInfo) const
+ {
+ if (fileInfo.isDir() && entries != fileInfo.absoluteDir().entryList(QDir::AllEntries))
+ return true;
+ return (ownerId != fileInfo.ownerId()
+ || groupId != fileInfo.groupId()
+ || permissions != fileInfo.permissions()
+ || lastModified != fileInfo.lastModified());
+ }
+ };
- static QDnotifyFileSystemWatcherEngine *create();
+ QHash<QString, FileInfo> files, directories;
- void run();
+public:
+ QPollingFileSystemWatcherEngine(QObject *parent);
QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories);
QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories);
- void stop();
-
private Q_SLOTS:
- void refresh(int);
+ void timeout();
private:
- struct Directory {
- Directory() : fd(0), parentFd(0), isMonitored(false) {}
- Directory(const Directory &o) : path(o.path),
- fd(o.fd),
- parentFd(o.parentFd),
- isMonitored(o.isMonitored),
- files(o.files) {}
- QString path;
- int fd;
- int parentFd;
- bool isMonitored;
-
- struct File {
- File() : ownerId(0u), groupId(0u), permissions(0u) { }
- File(const File &o) : path(o.path),
- ownerId(o.ownerId),
- groupId(o.groupId),
- permissions(o.permissions),
- lastWrite(o.lastWrite) {}
- QString path;
-
- bool updateInfo();
-
- uint ownerId;
- uint groupId;
- QFile::Permissions permissions;
- QDateTime lastWrite;
- };
-
- QList<File> files;
- };
-
- QDnotifyFileSystemWatcherEngine();
-
- QMutex mutex;
- QHash<QString, int> pathToFD;
- QHash<int, Directory> fdToDirectory;
- QHash<int, int> parentToFD;
+ QTimer timer;
};
+QT_END_NAMESPACE
+#endif // QFILESYSTEMWATCHER_POLLING_P_H
-QT_END_NAMESPACE
-#endif // QT_NO_FILESYSTEMWATCHER
-#endif // QFILESYSTEMWATCHER_DNOTIFY_P_H
diff --git a/src/corelib/io/qfilesystemwatcher_symbian.cpp b/src/corelib/io/qfilesystemwatcher_symbian.cpp
deleted file mode 100644
index 6e5e91114c..0000000000
--- a/src/corelib/io/qfilesystemwatcher_symbian.cpp
+++ /dev/null
@@ -1,273 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qfilesystemwatcher.h"
-#include "qfilesystemwatcher_symbian_p.h"
-#include "qfileinfo.h"
-#include "qdebug.h"
-#include "private/qcore_symbian_p.h"
-#include <QDir>
-
-#ifndef QT_NO_FILESYSTEMWATCHER
-
-
-QT_BEGIN_NAMESPACE
-
-QNotifyChangeEvent::QNotifyChangeEvent(RFs &fs, const TDesC &file,
- QSymbianFileSystemWatcherEngine *e, bool aIsDir,
- TInt aPriority) :
- CActive(aPriority),
- isDir(aIsDir),
- fsSession(fs),
- watchedPath(file),
- engine(e),
- failureCount(0)
-{
- if (isDir) {
- fsSession.NotifyChange(ENotifyEntry, iStatus, file);
- } else {
- fsSession.NotifyChange(ENotifyAll, iStatus, file);
- }
- CActiveScheduler::Add(this);
- SetActive();
-}
-
-QNotifyChangeEvent::~QNotifyChangeEvent()
-{
- Cancel();
-}
-
-void QNotifyChangeEvent::RunL()
-{
- if(iStatus.Int() == KErrNone) {
- failureCount = 0;
- } else {
- qWarning("QNotifyChangeEvent::RunL() - Failed to order change notifications: %d", iStatus.Int());
- failureCount++;
- }
-
- // Re-request failed notification once, but if it won't start working,
- // we can't do much besides just not request any more notifications.
- if (failureCount < 2) {
- if (isDir) {
- fsSession.NotifyChange(ENotifyEntry, iStatus, watchedPath);
- } else {
- fsSession.NotifyChange(ENotifyAll, iStatus, watchedPath);
- }
- SetActive();
-
- if (!failureCount) {
- int err;
- QT_TRYCATCH_ERROR(err, engine->emitPathChanged(this));
- if (err != KErrNone)
- qWarning("QNotifyChangeEvent::RunL() - emitPathChanged threw exception (Converted error code: %d)", err);
- }
- }
-}
-
-void QNotifyChangeEvent::DoCancel()
-{
- fsSession.NotifyChangeCancel(iStatus);
-}
-
-QSymbianFileSystemWatcherEngine::QSymbianFileSystemWatcherEngine() :
- watcherStarted(false)
-{
- moveToThread(this);
-}
-
-QSymbianFileSystemWatcherEngine::~QSymbianFileSystemWatcherEngine()
-{
- stop();
-}
-
-QStringList QSymbianFileSystemWatcherEngine::addPaths(const QStringList &paths, QStringList *files,
- QStringList *directories)
-{
- QMutexLocker locker(&mutex);
- QStringList p = paths;
-
- startWatcher();
-
- QMutableListIterator<QString> it(p);
- while (it.hasNext()) {
- QString path = it.next();
- QFileInfo fi(path);
- if (!fi.exists())
- continue;
-
- bool isDir = fi.isDir();
- if (isDir) {
- if (directories->contains(path))
- continue;
- } else {
- if (files->contains(path))
- continue;
- }
-
- // Use absolute filepath as relative paths seem to have some issues.
- QString filePath = fi.absoluteFilePath();
- if (isDir && filePath.at(filePath.size() - 1) != QChar(L'/')) {
- filePath += QChar(L'/');
- }
-
- currentAddEvent = NULL;
- QMetaObject::invokeMethod(this,
- "addNativeListener",
- Qt::QueuedConnection,
- Q_ARG(QString, filePath));
-
- syncCondition.wait(&mutex);
- if (currentAddEvent) {
- currentAddEvent->isDir = isDir;
-
- activeObjectToPath.insert(currentAddEvent, path);
- it.remove();
-
- if (isDir)
- directories->append(path);
- else
- files->append(path);
- }
- }
-
- return p;
-}
-
-QStringList QSymbianFileSystemWatcherEngine::removePaths(const QStringList &paths,
- QStringList *files,
- QStringList *directories)
-{
- QMutexLocker locker(&mutex);
-
- QStringList p = paths;
- QMutableListIterator<QString> it(p);
- while (it.hasNext()) {
- QString path = it.next();
-
- currentRemoveEvent = activeObjectToPath.key(path);
- if (!currentRemoveEvent)
- continue;
- activeObjectToPath.remove(currentRemoveEvent);
-
- QMetaObject::invokeMethod(this,
- "removeNativeListener",
- Qt::QueuedConnection);
-
- syncCondition.wait(&mutex);
-
- it.remove();
-
- files->removeAll(path);
- directories->removeAll(path);
- }
-
- return p;
-}
-
-void QSymbianFileSystemWatcherEngine::emitPathChanged(QNotifyChangeEvent *e)
-{
- QMutexLocker locker(&mutex);
-
- QString path = activeObjectToPath.value(e);
- QFileInfo fi(path);
-
- if (e->isDir)
- emit directoryChanged(path, !fi.exists());
- else
- emit fileChanged(path, !fi.exists());
-}
-
-void QSymbianFileSystemWatcherEngine::stop()
-{
- quit();
- wait();
-}
-
-// This method must be called inside mutex
-void QSymbianFileSystemWatcherEngine::startWatcher()
-{
- if (!watcherStarted) {
- setStackSize(0x5000);
- start();
- syncCondition.wait(&mutex);
- watcherStarted = true;
- }
-}
-
-
-void QSymbianFileSystemWatcherEngine::run()
-{
- mutex.lock();
- syncCondition.wakeOne();
- mutex.unlock();
-
- exec();
-
- foreach(QNotifyChangeEvent *e, activeObjectToPath.keys()) {
- e->Cancel();
- delete e;
- }
-
- activeObjectToPath.clear();
-}
-
-void QSymbianFileSystemWatcherEngine::addNativeListener(const QString &directoryPath)
-{
- QMutexLocker locker(&mutex);
- QString nativeDir(QDir::toNativeSeparators(directoryPath));
- TPtrC ptr(qt_QString2TPtrC(nativeDir));
- currentAddEvent = new QNotifyChangeEvent(qt_s60GetRFs(), ptr, this, directoryPath.endsWith(QChar(L'/'), Qt::CaseSensitive));
- syncCondition.wakeOne();
-}
-
-void QSymbianFileSystemWatcherEngine::removeNativeListener()
-{
- QMutexLocker locker(&mutex);
- currentRemoveEvent->Cancel();
- delete currentRemoveEvent;
- currentRemoveEvent = NULL;
- syncCondition.wakeOne();
-}
-
-
-QT_END_NAMESPACE
-#endif // QT_NO_FILESYSTEMWATCHER
diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp
index 4e94623844..e82a9a5b56 100644
--- a/src/corelib/io/qfilesystemwatcher_win.cpp
+++ b/src/corelib/io/qfilesystemwatcher_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -50,25 +50,12 @@
#include <qset.h>
#include <qdatetime.h>
#include <qdir.h>
+#include <qtextstream.h>
QT_BEGIN_NAMESPACE
-void QWindowsFileSystemWatcherEngine::stop()
-{
- foreach(QWindowsFileSystemWatcherEngineThread *thread, threads)
- thread->stop();
-}
-
-QWindowsFileSystemWatcherEngine::QWindowsFileSystemWatcherEngine()
- : QFileSystemWatcherEngine(false)
-{
-}
-
QWindowsFileSystemWatcherEngine::~QWindowsFileSystemWatcherEngine()
{
- if (threads.isEmpty())
- return;
-
foreach(QWindowsFileSystemWatcherEngineThread *thread, threads) {
thread->stop();
thread->wait();
@@ -310,7 +297,6 @@ QWindowsFileSystemWatcherEngineThread::QWindowsFileSystemWatcherEngineThread()
handles.reserve(MAXIMUM_WAIT_OBJECTS);
handles.append(h);
}
- moveToThread(this);
}
@@ -326,6 +312,17 @@ QWindowsFileSystemWatcherEngineThread::~QWindowsFileSystemWatcherEngineThread()
}
}
+static inline QString msgFindNextFailed(const QHash<QString, QWindowsFileSystemWatcherEngine::PathInfo> &pathInfos)
+{
+ QString result;
+ QTextStream str(&result);
+ str << "QFileSystemWatcher: FindNextChangeNotification failed for";
+ foreach (const QWindowsFileSystemWatcherEngine::PathInfo &pathInfo, pathInfos)
+ str << " \"" << QDir::toNativeSeparators(pathInfo.absolutePath) << '"';
+ str << ' ';
+ return result;
+}
+
void QWindowsFileSystemWatcherEngineThread::run()
{
QMutexLocker locker(&mutex);
@@ -356,11 +353,11 @@ void QWindowsFileSystemWatcherEngineThread::run()
// for some reason, so we must check if the handle exist in the handles vector
if (handles.contains(handle)) {
// qDebug()<<"thread"<<this<<"Acknowledged handle:"<<at<<handle;
+ QHash<QString, QWindowsFileSystemWatcherEngine::PathInfo> &h = pathInfoForHandle[handle];
if (!FindNextChangeNotification(handle)) {
- qErrnoWarning("QFileSystemWatcher: FindNextChangeNotification failed!!");
+ const DWORD error = GetLastError();
+ qErrnoWarning(error, "%s", qPrintable(msgFindNextFailed(h)));
}
-
- QHash<QString, QWindowsFileSystemWatcherEngine::PathInfo> &h = pathInfoForHandle[handle];
QMutableHashIterator<QString, QWindowsFileSystemWatcherEngine::PathInfo> it(h);
while (it.hasNext()) {
QHash<QString, QWindowsFileSystemWatcherEngine::PathInfo>::iterator x = it.next();
diff --git a/src/corelib/io/qfilesystemwatcher_win_p.h b/src/corelib/io/qfilesystemwatcher_win_p.h
index 3e9938a490..8e6b779b93 100644
--- a/src/corelib/io/qfilesystemwatcher_win_p.h
+++ b/src/corelib/io/qfilesystemwatcher_win_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -60,6 +60,7 @@
#include <qt_windows.h>
#include <QtCore/qdatetime.h>
+#include <QtCore/qthread.h>
#include <QtCore/qfile.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qhash.h>
@@ -78,15 +79,14 @@ class QWindowsFileSystemWatcherEngine : public QFileSystemWatcherEngine
{
Q_OBJECT
public:
- QWindowsFileSystemWatcherEngine();
+ inline QWindowsFileSystemWatcherEngine(QObject *parent)
+ : QFileSystemWatcherEngine(parent)
+ { }
~QWindowsFileSystemWatcherEngine();
QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories);
QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories);
- void stop();
-
-
class Handle
{
public:
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index 0d23a27909..a49ea84603 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfsfileengine.h b/src/corelib/io/qfsfileengine.h
index 2e0b1eb923..0ed883a4a7 100644
--- a/src/corelib/io/qfsfileengine.h
+++ b/src/corelib/io/qfsfileengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfsfileengine_iterator.cpp b/src/corelib/io/qfsfileengine_iterator.cpp
index 323ab58335..2d162f6a7d 100644
--- a/src/corelib/io/qfsfileengine_iterator.cpp
+++ b/src/corelib/io/qfsfileengine_iterator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfsfileengine_iterator_p.h b/src/corelib/io/qfsfileengine_iterator_p.h
index deccb01bfb..782930a52c 100644
--- a/src/corelib/io/qfsfileengine_iterator_p.h
+++ b/src/corelib/io/qfsfileengine_iterator_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h
index 89c08aeca7..158c6f3a23 100644
--- a/src/corelib/io/qfsfileengine_p.h
+++ b/src/corelib/io/qfsfileengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 681e55dff7..b09518865e 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index f2b3e5f534..5dc96ea8a2 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -550,7 +550,7 @@ QString QFSFileEngine::currentPath(const QString &fileName)
return ret;
#else
Q_UNUSED(fileName);
- return QFileSystemEngine::currentPath();
+ return QFileSystemEngine::currentPath().filePath();
#endif
}
@@ -661,6 +661,7 @@ bool QFSFileEngine::link(const QString &newName)
#endif // QT_NO_LIBRARY
#else
QString linkName = newName;
+ linkName.replace(QLatin1Char('/'), QLatin1Char('\\'));
if (!linkName.endsWith(QLatin1String(".lnk")))
linkName += QLatin1String(".lnk");
QString orgName = fileName(AbsoluteName).replace(QLatin1Char('/'), QLatin1Char('\\'));
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 8e1b2d5d0c..ef530f379f 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qiodevice.h b/src/corelib/io/qiodevice.h
index 7d4afca850..4b34ad4f69 100644
--- a/src/corelib/io/qiodevice.h
+++ b/src/corelib/io/qiodevice.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h
index 3ccad6254a..2515fe5705 100644
--- a/src/corelib/io/qiodevice_p.h
+++ b/src/corelib/io/qiodevice_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qnoncontiguousbytedevice.cpp b/src/corelib/io/qnoncontiguousbytedevice.cpp
index 113ba4b4bb..ba711493c6 100644
--- a/src/corelib/io/qnoncontiguousbytedevice.cpp
+++ b/src/corelib/io/qnoncontiguousbytedevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qnoncontiguousbytedevice_p.h b/src/corelib/io/qnoncontiguousbytedevice_p.h
index c7c94243b9..ded605681e 100644
--- a/src/corelib/io/qnoncontiguousbytedevice_p.h
+++ b/src/corelib/io/qnoncontiguousbytedevice_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index d2aee16c45..8f76e0e4b9 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -471,7 +471,7 @@ void QProcessPrivate::Channel::clear()
read the standard output by calling read(), readLine(), and
getChar(). Because it inherits QIODevice, QProcess can also be
used as an input source for QXmlReader, or for generating data to
- be uploaded using QFtp.
+ be uploaded using QNetworkAccessManager.
\note On Windows CE and Symbian, reading and writing to a process
is not supported.
@@ -617,6 +617,14 @@ void QProcessPrivate::Channel::clear()
writes to its standard output and standard error will be written
to the standard output and standard error of the main process.
+ \note Windows intentionally suppresses output from GUI-only
+ applications to inherited consoles.
+ This does \e not apply to output redirected to files or pipes.
+ To forward the output of GUI-only applications on the console
+ nonetheless, you must use SeparateChannels and do the forwarding
+ yourself by reading the output and writing it to the appropriate
+ output channels.
+
\sa setProcessChannelMode()
*/
@@ -2271,7 +2279,7 @@ QT_END_INCLUDE_NAMESPACE
However, note that repeated calls to this function will recreate the
list of environment variables, which is a non-trivial operation.
- \note For new code, it is recommended to use QProcessEvironment::systemEnvironment()
+ \note For new code, it is recommended to use QProcessEnvironment::systemEnvironment()
\sa QProcessEnvironment::systemEnvironment(), environment(), setEnvironment()
*/
diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h
index b2a5a4cbff..96a1edefd8 100644
--- a/src/corelib/io/qprocess.h
+++ b/src/corelib/io/qprocess.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index 5bebff089e..7e0fecc320 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp
deleted file mode 100644
index 9fd0c3aa65..0000000000
--- a/src/corelib/io/qprocess_symbian.cpp
+++ /dev/null
@@ -1,1072 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//#define QPROCESS_DEBUG
-
-#ifdef QPROCESS_DEBUG
-#include "qdebug.h"
-#define QPROCESS_DEBUG_PRINT(args...) qDebug(args);
-#else
-#define QPROCESS_DEBUG_PRINT(args...)
-#endif
-
-#ifndef QT_NO_PROCESS
-
-#define QPROCESS_ASSERT(check, panicReason, args...) \
- if (!(check)) { \
- qWarning(args); \
- User::Panic(KQProcessPanic, panicReason); \
- }
-
-#include <exception>
-#include <e32base.h>
-#include <e32std.h>
-#include <stdio.h>
-#include "qplatformdefs.h"
-
-#include "qdir.h"
-#include "qstring.h"
-#include "qprocess.h"
-#include "qprocess_p.h"
-#include "private/qeventdispatcher_symbian_p.h"
-
-#include <private/qthread_p.h>
-#include <qmutex.h>
-#include <qmap.h>
-#include <qsocketnotifier.h>
-
-#include <errno.h>
-
-
-QT_BEGIN_NAMESPACE
-
-_LIT(KQProcessManagerThreadName, "QProcManThread");
-_LIT(KQProcessPanic, "QPROCESS");
-enum TQProcessPanic {
- EProcessManagerMediatorRunError = 1,
- EProcessManagerMediatorInactive = 2,
- EProcessManagerMediatorNotPending = 3,
- EProcessManagerMediatorInvalidCmd = 4,
- EProcessManagerMediatorCreationFailed = 5,
- EProcessManagerMediatorThreadOpenFailed = 6,
- EProcessManagerMediatorNullObserver = 7,
- EProcessActiveRunError = 10,
- EProcessActiveNullParameter = 11,
- EProcessManagerMutexCreationFail = 20,
- EProcessManagerThreadCreationFail = 21,
- EProcessManagerSchedulerCreationFail = 22,
- EProcessManagerNullParam = 23
-};
-
-// Forward declarations
-class QProcessManager;
-
-
-// Active object to listen for child process death
-class QProcessActive : public CActive
-{
-public:
- static QProcessActive *construct(QProcess *process,
- RProcess **proc,
- int serial,
- int deathPipe);
-
- virtual ~QProcessActive();
-
- void start();
- void stop();
-
- bool error();
-
-protected:
-
- // Inherited from CActive
- void RunL();
- TInt RunError(TInt aError);
- void DoCancel();
-
- QProcessActive();
-
-private:
-
- QProcess *process;
- RProcess **pproc;
- int serial;
- int deathPipe;
- bool errorValue;
-};
-
-// Active object to communicate synchronously with process manager thread
-class QProcessManagerMediator : public CActive
-{
-public:
- static QProcessManagerMediator *construct();
-
- virtual ~QProcessManagerMediator();
-
- bool add(QProcessActive *processObserver);
- void remove(QProcessActive *processObserver);
- void terminate();
-
-protected:
-
- enum Commands {
- ENoCommand,
- EAdd,
- ERemove,
- ETerminate
- };
-
- // Inherited from CActive
- void RunL();
- TInt RunError(TInt aError);
- void DoCancel();
-
- QProcessManagerMediator();
-
- bool notify(QProcessActive *processObserver, Commands command);
-
-private:
- QProcessActive *currentObserver;
- Commands currentCommand;
-
- RThread processManagerThread;
-};
-
-// Process manager manages child process death listeners.
-//
-// Note: Because QProcess can be used outside event loop, we cannot be guaranteed
-// an active scheduler exists for us to add our process death listener objects.
-// We can't just install active scheduler on the calling thread, as that would block it
-// if we want to actually use it, so a separate manager thread is required.
-class QProcessManager
-{
-public:
- QProcessManager();
- ~QProcessManager();
-
- void startThread();
-
- TInt run(void *param);
- bool add(QProcess *process);
- void remove(QProcess *process);
-
- inline void setMediator(QProcessManagerMediator *newMediator) {
- mediator = newMediator;
- };
-
-private:
- inline void lock() {
- managerMutex.Wait();
- };
- inline void unlock() {
- managerMutex.Signal();
- };
-
- QMap<int, QProcessActive *> children;
- QProcessManagerMediator *mediator;
- RMutex managerMutex;
- bool threadStarted;
- RThread managerThread;
-};
-
-static bool qt_rprocess_running(RProcess *proc)
-{
- if (proc && proc->Handle()) {
- TExitType et = proc->ExitType();
- if (et == EExitPending)
- return true;
- }
-
- return false;
-}
-
-static void qt_create_symbian_commandline(
- const QStringList &arguments, const QString &nativeArguments, QString &commandLine)
-{
- for (int i = 0; i < arguments.size(); ++i) {
- QString tmp = arguments.at(i);
- // in the case of \" already being in the string the \ must also be escaped
- tmp.replace(QLatin1String("\\\""), QLatin1String("\\\\\""));
- // escape a single " because the arguments will be parsed
- tmp.replace(QLatin1String("\""), QLatin1String("\\\""));
- if (tmp.isEmpty() || tmp.contains(QLatin1Char(' ')) || tmp.contains(QLatin1Char('\t'))) {
- // The argument must not end with a \ since this would be interpreted
- // as escaping the quote -- rather put the \ behind the quote: e.g.
- // rather use "foo"\ than "foo\"
- QString endQuote(QLatin1String("\""));
- int i = tmp.length();
- while (i > 0 && tmp.at(i - 1) == QLatin1Char('\\')) {
- --i;
- endQuote += QLatin1String("\\");
- }
- commandLine += QLatin1String("\"") + tmp.left(i) + endQuote + QLatin1Char(' ');
- } else {
- commandLine += tmp + QLatin1Char(' ');
- }
- }
-
- if (!nativeArguments.isEmpty())
- commandLine += nativeArguments;
- else if (!commandLine.isEmpty()) // Chop the extra trailing space if any arguments were appended
- commandLine.chop(1);
-}
-
-static TInt qt_create_symbian_process(RProcess **proc,
- const QString &programName, const QStringList &arguments, const QString &nativeArguments)
-{
- RProcess *newProc = NULL;
- newProc = new RProcess();
-
- if (!newProc)
- return KErrNoMemory;
-
- QString commandLine;
- qt_create_symbian_commandline(arguments, nativeArguments, commandLine);
-
- TPtrC program_ptr(reinterpret_cast<const TText*>(programName.constData()));
- TPtrC cmdline_ptr(reinterpret_cast<const TText*>(commandLine.constData()));
-
- TInt err = newProc->Create(program_ptr, cmdline_ptr);
-
- if (err == KErrNotFound) {
- // Strip path from program name and try again (i.e. try from default location "\sys\bin")
- int index = programName.lastIndexOf(QDir::separator());
- int index2 = programName.lastIndexOf(QChar(QLatin1Char('/')));
- index = qMax(index, index2);
-
- if (index != -1 && programName.length() >= index) {
- QString strippedName;
- strippedName = programName.mid(index + 1);
- QPROCESS_DEBUG_PRINT("qt_create_symbian_process() Executable '%s' not found, trying stripped version '%s'",
- qPrintable(programName), qPrintable(strippedName));
-
- TPtrC stripped_ptr(reinterpret_cast<const TText*>(strippedName.constData()));
- err = newProc->Create(stripped_ptr, cmdline_ptr);
-
- if (err != KErrNone) {
- QPROCESS_DEBUG_PRINT("qt_create_symbian_process() Unable to create process '%s': %d",
- qPrintable(strippedName), err);
- }
- }
- }
-
- if (err == KErrNone)
- *proc = newProc;
- else
- delete newProc;
-
- return err;
-}
-
-static qint64 qt_native_read(int fd, char *data, qint64 maxlen)
-{
- qint64 ret = 0;
- do {
- ret = ::read(fd, data, maxlen);
- } while (ret == -1 && errno == EINTR);
-
- QPROCESS_DEBUG_PRINT("qt_native_read(): fd: %d, result: %d, errno = %d", fd, (int)ret, errno);
-
- return ret;
-}
-
-static qint64 qt_native_write(int fd, const char *data, qint64 len)
-{
- qint64 ret = 0;
- do {
- ret = ::write(fd, data, len);
- } while (ret == -1 && errno == EINTR);
-
- QPROCESS_DEBUG_PRINT("qt_native_write(): fd: %d, result: %d, errno = %d", fd, (int)ret, errno);
-
- return ret;
-}
-
-static void qt_native_close(int fd)
-{
- int ret;
- do {
- ret = ::close(fd);
- } while (ret == -1 && errno == EINTR);
-}
-
-static void qt_create_pipe(int *pipe)
-{
- if (pipe[0] != -1)
- qt_native_close(pipe[0]);
- if (pipe[1] != -1)
- qt_native_close(pipe[1]);
- if (::pipe(pipe) != 0) {
- qWarning("QProcessPrivate::createPipe: Cannot create pipe %p: %s",
- pipe, qPrintable(qt_error_string(errno)));
- } else {
- QPROCESS_DEBUG_PRINT("qt_create_pipe(): Created pipe %d - %d", pipe[0], pipe[1]);
- }
-}
-
-// Called from ProcessManagerThread
-QProcessActive *QProcessActive::construct(QProcess *process,
- RProcess **proc,
- int serial,
- int deathPipe)
-{
- QPROCESS_ASSERT((process || proc || *proc),
- EProcessActiveNullParameter,
- "QProcessActive::construct(): process (0x%x), proc (0x%x) or *proc == NULL, not creating an instance", process, proc)
-
- QProcessActive *newInstance = new QProcessActive();
-
- if (!newInstance) {
- QPROCESS_DEBUG_PRINT("QProcessActive::construct(): Failed to create new instance");
- } else {
- newInstance->process = process;
- newInstance->pproc = proc;
- newInstance->serial = serial;
- newInstance->deathPipe = deathPipe;
- newInstance->errorValue = false;
- }
-
- return newInstance;
-}
-
-// Called from ProcessManagerThread
-QProcessActive::QProcessActive()
- : CActive(CActive::EPriorityStandard)
-{
- // Nothing to do
-}
-
-// Called from main thread
-QProcessActive::~QProcessActive()
-{
- process = NULL;
- pproc = NULL;
-}
-
-// Called from ProcessManagerThread
-void QProcessActive::start()
-{
- if (qt_rprocess_running(*pproc)) {
- CActiveScheduler::Add(this);
- (*pproc)->Logon(iStatus);
- SetActive();
- QPROCESS_DEBUG_PRINT("QProcessActive::start(): Started monitoring for process exit.");
- } else {
- QPROCESS_DEBUG_PRINT("QProcessActive::start(): Process doesn't exist or is already dead");
- // Assume process has already died
- qt_native_write(deathPipe, "", 1);
- errorValue = true;
- }
-}
-
-// Called from ProcessManagerThread
-void QProcessActive::stop()
-{
- QPROCESS_DEBUG_PRINT("QProcessActive::stop()");
-
- // Remove this from scheduler (also cancels the request)
- Deque();
-}
-
-bool QProcessActive::error()
-{
- return errorValue;
-}
-
-// Called from ProcessManagerThread
-void QProcessActive::RunL()
-{
- // If this method gets executed, the monitored process has died
-
- // Notify main thread
- qt_native_write(deathPipe, "", 1);
- QPROCESS_DEBUG_PRINT("QProcessActive::RunL() sending death notice to %d", deathPipe);
-}
-
-// Called from ProcessManagerThread
-TInt QProcessActive::RunError(TInt aError)
-{
- Q_UNUSED(aError);
- // Handle RunL leave (should never happen)
- QPROCESS_ASSERT(0, EProcessActiveRunError, "QProcessActive::RunError(): Should never get here!")
- return 0;
-}
-
-// Called from ProcessManagerThread
-void QProcessActive::DoCancel()
-{
- QPROCESS_DEBUG_PRINT("QProcessActive::DoCancel()");
-
- if (qt_rprocess_running(*pproc)) {
- (*pproc)->LogonCancel(iStatus);
- QPROCESS_DEBUG_PRINT("QProcessActive::DoCancel(): Stopped monitoring for process exit.");
- } else {
- QPROCESS_DEBUG_PRINT("QProcessActive::DoCancel(): Process doesn't exist");
- }
-}
-
-
-// Called from ProcessManagerThread
-QProcessManagerMediator *QProcessManagerMediator::construct()
-{
- QProcessManagerMediator *newInstance = new QProcessManagerMediator;
- TInt err(KErrNone);
-
- newInstance->currentCommand = ENoCommand;
- newInstance->currentObserver = NULL;
-
- if (newInstance) {
- err = newInstance->processManagerThread.Open(newInstance->processManagerThread.Id());
- QPROCESS_ASSERT((err == KErrNone),
- EProcessManagerMediatorThreadOpenFailed,
- "QProcessManagerMediator::construct(): Failed to open processManagerThread (err:%d)", err)
- } else {
- QPROCESS_ASSERT(0,
- EProcessManagerMediatorCreationFailed,
- "QProcessManagerMediator::construct(): Failed to open construct mediator")
- }
-
- // Activate mediator
- CActiveScheduler::Add(newInstance);
- newInstance->iStatus = KRequestPending;
- newInstance->SetActive();
- QPROCESS_DEBUG_PRINT("QProcessManagerMediator::construct(): new instance successfully created and activated");
-
- return newInstance;
-}
-
-// Called from ProcessManagerThread
-QProcessManagerMediator::QProcessManagerMediator()
- : CActive(CActive::EPriorityStandard)
-{
- // Nothing to do
-}
-
-// Called from main thread
-QProcessManagerMediator::~QProcessManagerMediator()
-{
- processManagerThread.Close();
- currentCommand = ENoCommand;
- currentObserver = NULL;
-}
-
-// Called from main thread
-bool QProcessManagerMediator::add(QProcessActive *processObserver)
-{
- QPROCESS_DEBUG_PRINT("QProcessManagerMediator::add()");
- return notify(processObserver, EAdd);
-}
-
-// Called from main thread
-void QProcessManagerMediator::remove(QProcessActive *processObserver)
-{
- QPROCESS_DEBUG_PRINT("QProcessManagerMediator::remove()");
- notify(processObserver, ERemove);
-}
-
-// Called from main thread
-void QProcessManagerMediator::terminate()
-{
- QPROCESS_DEBUG_PRINT("QProcessManagerMediator::terminate()");
- notify(NULL, ETerminate);
-}
-
-// Called from main thread
-bool QProcessManagerMediator::notify(QProcessActive *processObserver, Commands command)
-{
- bool success(true);
-
- QPROCESS_DEBUG_PRINT("QProcessManagerMediator::Notify(): Command: %d, processObserver: 0x%x", command, processObserver);
-
- QPROCESS_ASSERT((command == ETerminate || processObserver),
- EProcessManagerMediatorNullObserver,
- "QProcessManagerMediator::Notify(): NULL processObserver not allowed for command: %d", command)
-
- QPROCESS_ASSERT(IsActive(),
- EProcessManagerMediatorInactive,
- "QProcessManagerMediator::Notify(): Mediator is not active!")
-
- QPROCESS_ASSERT(iStatus == KRequestPending,
- EProcessManagerMediatorNotPending,
- "QProcessManagerMediator::Notify(): Mediator request not pending!")
-
- currentObserver = processObserver;
- currentCommand = command;
-
- // Sync with process manager thread
- TRequestStatus pmStatus;
- processManagerThread.Rendezvous(pmStatus);
-
- // Complete request -> RunL will run in the process manager thread
- TRequestStatus *status = &iStatus;
- processManagerThread.RequestComplete(status, command);
-
- QPROCESS_DEBUG_PRINT("QProcessManagerMediator::Notify(): Waiting process manager to complete...");
- User::WaitForRequest(pmStatus);
- QPROCESS_DEBUG_PRINT("QProcessManagerMediator::Notify(): Wait over");
-
- if (currentObserver) {
- success = !(currentObserver->error());
- QPROCESS_DEBUG_PRINT("QProcessManagerMediator::Notify(): success = %d", success);
- }
-
- currentObserver = NULL;
- currentCommand = ENoCommand;
-
- return success;
-}
-
-// Called from ProcessManagerThread
-void QProcessManagerMediator::RunL()
-{
- QPROCESS_DEBUG_PRINT("QProcessManagerMediator::RunL(): currentCommand: %d, iStatus: %d", currentCommand, iStatus.Int());
- switch (currentCommand) {
- case EAdd:
- currentObserver->start();
- break;
- case ERemove:
- currentObserver->stop();
- break;
- case ETerminate:
- Deque();
- CActiveScheduler::Stop();
- return;
- default:
- QPROCESS_ASSERT(0,
- EProcessManagerMediatorInvalidCmd,
- "QProcessManagerMediator::RunL(): Invalid command!")
- break;
- }
-
- iStatus = KRequestPending;
- SetActive();
-
- // Notify main thread that we are done
- RThread::Rendezvous(KErrNone);
-}
-
-// Called from ProcessManagerThread
-TInt QProcessManagerMediator::RunError(TInt aError)
-{
- Q_UNUSED(aError);
- // Handle RunL leave (should never happen)
- QPROCESS_ASSERT(0,
- EProcessManagerMediatorRunError,
- "QProcessManagerMediator::RunError(): Should never get here!")
- return 0;
-}
-
-// Called from ProcessManagerThread
-void QProcessManagerMediator::DoCancel()
-{
- QPROCESS_DEBUG_PRINT("QProcessManagerMediator::DoCancel()");
- TRequestStatus *status = &iStatus;
- processManagerThread.RequestComplete(status, KErrCancel);
-}
-
-Q_GLOBAL_STATIC(QProcessManager, processManager)
-
-TInt processManagerThreadFunction(TAny *param)
-{
- QPROCESS_ASSERT(param,
- EProcessManagerNullParam,
- "processManagerThreadFunction(): NULL param")
-
- QProcessManager *manager = reinterpret_cast<QProcessManager*>(param);
-
- CActiveScheduler *scheduler = new CQtActiveScheduler();
-
- QPROCESS_ASSERT(scheduler,
- EProcessManagerSchedulerCreationFail,
- "processManagerThreadFunction(): Scheduler creation failed")
-
- CActiveScheduler::Install(scheduler);
-
- //Creating mediator also adds it to scheduler and activates it. Failure will panic.
- manager->setMediator(QProcessManagerMediator::construct());
- RThread::Rendezvous(KErrNone);
-
- CActiveScheduler::Start();
-
- CActiveScheduler::Install(NULL);
- delete scheduler;
-
- return KErrNone;
-}
-
-QProcessManager::QProcessManager()
- : mediator(NULL), threadStarted(false)
-{
- TInt err = managerMutex.CreateLocal();
-
- QPROCESS_ASSERT(err == KErrNone,
- EProcessManagerMutexCreationFail,
- "QProcessManager::QProcessManager(): Failed to create new managerMutex (err: %d)", err)
-}
-
-QProcessManager::~QProcessManager()
-{
- QPROCESS_DEBUG_PRINT("QProcessManager::~QProcessManager()");
-
- // Check if manager thread is still alive. If this destructor is ran as part of global
- // static cleanup, manager thread will most likely be terminated by kernel at this point,
- // so trying to delete QProcessActives and QProcessMediators will panic as they
- // will still be active. They can also no longer be canceled as the thread is already gone.
- // In case manager thread has already died, we simply do nothing and let the deletion of
- // the main heap at process exit take care of stray objects.
-
- if (managerThread.Handle() && managerThread.ExitType() == EExitPending) {
- // Cancel death listening for all child processes
- if (mediator) {
- QMap<int, QProcessActive *>::Iterator it = children.begin();
- while (it != children.end()) {
- // Remove all monitors
- QProcessActive *active = it.value();
- mediator->remove(active);
-
- QPROCESS_DEBUG_PRINT("QProcessManager::~QProcessManager() removed listening for a process");
- ++it;
- }
-
- // Terminate process manager thread.
- mediator->terminate();
- delete mediator;
- }
-
- qDeleteAll(children.values());
- children.clear();
- }
-
- managerThread.Close();
- managerMutex.Close();
-}
-
-void QProcessManager::startThread()
-{
- lock();
-
- if (!threadStarted) {
- TInt err = managerThread.Create(KQProcessManagerThreadName,
- processManagerThreadFunction,
- 0x5000,
- (RAllocator*)NULL,
- (TAny*)this,
- EOwnerProcess);
-
- QPROCESS_ASSERT(err == KErrNone,
- EProcessManagerThreadCreationFail,
- "QProcessManager::startThread(): Failed to create new managerThread (err:%d)", err)
-
- threadStarted = true;
-
- // Manager thread must start running before we continue, so sync with rendezvous
- TRequestStatus status;
- managerThread.Rendezvous(status);
- managerThread.Resume();
- User::WaitForRequest(status);
- }
-
- unlock();
-}
-
-static QBasicAtomicInt idCounter = Q_BASIC_ATOMIC_INITIALIZER(1);
-
-bool QProcessManager::add(QProcess *process)
-{
- QPROCESS_ASSERT(process,
- EProcessManagerNullParam,
- "QProcessManager::add(): Failed to add QProcessActive to ProcessManager - NULL process")
-
- lock();
-
- int serial = idCounter.fetchAndAddRelaxed(1);
- process->d_func()->serial = serial;
-
- QPROCESS_DEBUG_PRINT("QProcessManager::add(): serial: %d, deathPipe: %d - %d, symbianProcess: 0x%x", serial, process->d_func()->deathPipe[0], process->d_func()->deathPipe[1], process->d_func()->symbianProcess);
-
- QProcessActive *newActive =
- QProcessActive::construct(process,
- &(process->d_func()->symbianProcess),
- serial,
- process->d_func()->deathPipe[1]);
-
- if (newActive) {
- if (mediator->add(newActive)) {
- children.insert(serial, newActive);
- unlock();
- return true;
- } else {
- QPROCESS_DEBUG_PRINT("QProcessManager::add(): Failed to add QProcessActive to ProcessManager");
- delete newActive;
- }
- }
-
- unlock();
-
- return false;
-}
-
-void QProcessManager::remove(QProcess *process)
-{
- QPROCESS_ASSERT(process,
- EProcessManagerNullParam,
- "QProcessManager::remove(): Failed to remove QProcessActive from ProcessManager - NULL process")
-
- lock();
-
- int serial = process->d_func()->serial;
- QProcessActive *active = children.value(serial);
- if (!active) {
- unlock();
- return;
- }
-
- mediator->remove(active);
-
- children.remove(serial);
- delete active;
-
- unlock();
-}
-
-void QProcessPrivate::destroyPipe(int *pipe)
-{
- if (pipe[1] != -1) {
- qt_native_close(pipe[1]);
- pipe[1] = -1;
- }
- if (pipe[0] != -1) {
- qt_native_close(pipe[0]);
- pipe[0] = -1;
- }
-}
-
-bool QProcessPrivate::createChannel(Channel &channel)
-{
- Q_UNUSED(channel);
- // No channels used
- return false;
-}
-
-void QProcessPrivate::startProcess()
-{
- Q_Q(QProcess);
-
- QPROCESS_DEBUG_PRINT("QProcessPrivate::startProcess()");
-
- // Start the process (platform dependent)
- q->setProcessState(QProcess::Starting);
-
- processManager()->startThread();
-
- qt_create_pipe(deathPipe);
- if (threadData->eventDispatcher) {
- deathNotifier = new QSocketNotifier(deathPipe[0],
- QSocketNotifier::Read, q);
- QObject::connect(deathNotifier, SIGNAL(activated(int)),
- q, SLOT(_q_processDied()));
- }
-
- TInt err = qt_create_symbian_process(&symbianProcess, program, arguments, nativeArguments);
-
- if (err == KErrNone) {
- pid = symbianProcess->Id().Id();
-
- ::fcntl(deathPipe[0], F_SETFL, ::fcntl(deathPipe[0], F_GETFL) | O_NONBLOCK);
-
- if (!processManager()->add(q)) {
- qWarning("QProcessPrivate::startProcess(): Failed to start monitoring for process death.");
- err = KErrNoMemory;
- }
- }
-
- if (err != KErrNone) {
- // Cleanup, report error and return
- QPROCESS_DEBUG_PRINT("QProcessPrivate::startProcess() Process open failed, err: %d, '%s'", err, qPrintable(program));
- q->setProcessState(QProcess::NotRunning);
- processError = QProcess::FailedToStart;
- q->setErrorString(QLatin1String(QT_TRANSLATE_NOOP(QProcess, "Resource error (qt_create_symbian_process failure)")));
- emit q->error(processError);
- cleanup();
- return;
- }
-
- processLaunched = true;
-
- symbianProcess->Resume();
-
- QPROCESS_DEBUG_PRINT("QProcessPrivate::startProcess(): this: 0x%x, pid: %ld", this, pid);
-
- // Notify child start
- _q_startupNotification();
-
-}
-
-bool QProcessPrivate::processStarted()
-{
- QPROCESS_DEBUG_PRINT("QProcessPrivate::processStarted() == %s", processLaunched ? "true" : "false");
-
- // Since we cannot get information whether process has actually been launched
- // or not in Symbian, we need to fake it. Assume process is started if launch was
- // successful.
-
- return processLaunched;
-}
-
-qint64 QProcessPrivate::bytesAvailableFromStdout() const
-{
- // In Symbian, stdout is not supported
- return 0;
-}
-
-qint64 QProcessPrivate::bytesAvailableFromStderr() const
-{
- // In Symbian, stderr is not supported
- return 0;
-}
-
-qint64 QProcessPrivate::readFromStdout(char *data, qint64 maxlen)
-{
- Q_UNUSED(data);
- Q_UNUSED(maxlen);
- // In Symbian, stdout is not supported
- return 0;
-}
-
-qint64 QProcessPrivate::readFromStderr(char *data, qint64 maxlen)
-{
- Q_UNUSED(data);
- Q_UNUSED(maxlen);
- // In Symbian, stderr is not supported
- return 0;
-}
-
-qint64 QProcessPrivate::writeToStdin(const char *data, qint64 maxlen)
-{
- Q_UNUSED(data);
- Q_UNUSED(maxlen);
- // In Symbian, stdin is not supported
- return 0;
-}
-
-void QProcessPrivate::terminateProcess()
-{
- // Needs PowerMgmt capability if process has been started; will panic kern-exec 46 otherwise.
- // Always works if process is not yet started.
- if (qt_rprocess_running(symbianProcess)) {
- symbianProcess->Terminate(0);
- } else {
- QPROCESS_DEBUG_PRINT("QProcessPrivate::terminateProcess(), Process not running");
- }
-}
-
-void QProcessPrivate::killProcess()
-{
- // Needs PowerMgmt capability if process has been started; will panic kern-exec 46 otherwise.
- // Always works if process is not yet started.
- if (qt_rprocess_running(symbianProcess)) {
- symbianProcess->Kill(0);
- } else {
- QPROCESS_DEBUG_PRINT("QProcessPrivate::killProcess(), Process not running");
- }
-}
-
-bool QProcessPrivate::waitForStarted(int msecs)
-{
- Q_UNUSED(msecs);
- // Since we can get no actual feedback from process beyond its death,
- // assume that started has already been emitted if process has been launched
- return processLaunched;
-}
-
-bool QProcessPrivate::waitForReadyRead(int msecs)
-{
- // Functionality not supported in Symbian
- Q_UNUSED(msecs);
- return false;
-}
-
-bool QProcessPrivate::waitForBytesWritten(int msecs)
-{
- // Functionality not supported in Symbian
- Q_UNUSED(msecs);
- return false;
-}
-
-bool QProcessPrivate::waitForFinished(int msecs)
-{
- Q_Q(QProcess);
- QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished(%d)", msecs);
-
- TRequestStatus timerStatus = KErrNone;
- TRequestStatus logonStatus = KErrNone;
- bool timeoutOccurred = false;
-
- // Logon to process to observe its death
- if (qt_rprocess_running(symbianProcess)) {
- symbianProcess->Logon(logonStatus);
-
- if (msecs < 0) {
- // If timeout is negative, there is no timeout
- QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Waiting (just logon)...");
- User::WaitForRequest(logonStatus);
- QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Wait completed");
- } else {
- // Create timer
- RTimer timer;
- timer.CreateLocal();
- TTimeIntervalMicroSeconds32 interval(msecs*1000);
- timer.After(timerStatus, interval);
-
- QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Waiting (logon + timer)...");
- User::WaitForRequest(logonStatus, timerStatus);
- QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Wait completed");
-
- if (logonStatus != KRequestPending) {
- timer.Cancel();
- User::WaitForRequest(timerStatus);
- } else {
- timeoutOccurred = true;
- symbianProcess->LogonCancel(logonStatus);
- User::WaitForRequest(logonStatus);
- }
- timer.Close();
- }
- } else {
- QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished(), qt_rprocess_running returned false");
- }
-
- if (timeoutOccurred) {
- processError = QProcess::Timedout;
- q->setErrorString(QLatin1String(QT_TRANSLATE_NOOP(QProcess, "Process operation timed out")));
- return false;
- }
-
- _q_processDied();
-
- return true;
-}
-
-bool QProcessPrivate::waitForWrite(int msecs)
-{
- // Functionality not supported in Symbian
- Q_UNUSED(msecs);
- return false;
-}
-
-// Deceptively named function. Exit code is actually got in waitForDeadChild().
-void QProcessPrivate::findExitCode()
-{
- Q_Q(QProcess);
- processManager()->remove(q);
-}
-
-bool QProcessPrivate::waitForDeadChild()
-{
- Q_Q(QProcess);
-
- // read a byte from the death pipe
- char c;
- qt_native_read(deathPipe[0], &c, 1);
-
- if (symbianProcess && symbianProcess->Handle()) {
- TExitType et = symbianProcess->ExitType();
- QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForDeadChild() symbianProcess->ExitType: %d", et);
- if (et != EExitPending) {
- processManager()->remove(q);
- exitCode = symbianProcess->ExitReason();
- crashed = (et == EExitPanic);
-#if defined QPROCESS_DEBUG
- TExitCategoryName catName = symbianProcess->ExitCategory();
- qDebug() << "QProcessPrivate::waitForDeadChild() dead with exitCode"
- << exitCode << ", crashed:" << crashed
- << ", category:" << QString((const QChar *)catName.Ptr());
-#endif
- } else {
- QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForDeadChild() not dead!");
- }
- }
-
- return true;
-}
-
-void QProcessPrivate::_q_notified()
-{
- // Nothing to do in Symbian
-}
-
-bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid)
-{
- QPROCESS_DEBUG_PRINT("QProcessPrivate::startDetached()");
- Q_UNUSED(workingDirectory);
-
- RProcess *newProc = NULL;
-
- TInt err = qt_create_symbian_process(&newProc, program, arguments, QString());
-
- if (err == KErrNone) {
- if (pid)
- *pid = newProc->Id().Id();
-
- newProc->Resume();
- newProc->Close();
- delete newProc;
- return true;
- }
-
- return false;
-}
-
-
-void QProcessPrivate::initializeProcessManager()
-{
- (void) processManager();
-}
-
-QProcessEnvironment QProcessEnvironment::systemEnvironment()
-{
- return QProcessEnvironment();
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_PROCESS
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index 5fc69ed2cd..f01df3c078 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index d47e55dee4..8c6444d173 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -72,7 +72,6 @@ static void qt_create_pipe(Q_PIPE *pipe, bool in)
// read handles to avoid non-closable handles (this is done by the
// DuplicateHandle() call).
-#if !defined(Q_OS_WINCE)
SECURITY_ATTRIBUTES secAtt = { sizeof( SECURITY_ATTRIBUTES ), NULL, TRUE };
HANDLE tmpHandle;
@@ -91,10 +90,15 @@ static void qt_create_pipe(Q_PIPE *pipe, bool in)
}
CloseHandle(tmpHandle);
-#else
- Q_UNUSED(pipe);
- Q_UNUSED(in);
-#endif
+}
+
+static void duplicateStdWriteChannel(Q_PIPE *pipe, DWORD nStdHandle)
+{
+ pipe[0] = INVALID_Q_PIPE;
+ HANDLE hStdWriteChannel = GetStdHandle(nStdHandle);
+ HANDLE hCurrentProcess = GetCurrentProcess();
+ DuplicateHandle(hCurrentProcess, hStdWriteChannel, hCurrentProcess,
+ &pipe[1], 0, TRUE, DUPLICATE_SAME_ACCESS);
}
/*
@@ -113,8 +117,11 @@ bool QProcessPrivate::createChannel(Channel &channel)
if (channel.type == Channel::Normal) {
// we're piping this channel to our own process
- qt_create_pipe(channel.pipe, &channel == &stdinChannel);
-
+ const bool isStdInChannel = (&channel == &stdinChannel);
+ if (isStdInChannel || processChannelMode != QProcess::ForwardedChannels)
+ qt_create_pipe(channel.pipe, isStdInChannel);
+ else
+ duplicateStdWriteChannel(channel.pipe, (&channel == &stdoutChannel) ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE);
return true;
} else if (channel.type == Channel::Redirect) {
// we're redirecting the channel to/from a file
@@ -277,7 +284,6 @@ static QString qt_create_commandline(const QString &program, const QStringList &
QProcessEnvironment QProcessEnvironment::systemEnvironment()
{
QProcessEnvironment env;
-#if !defined(Q_OS_WINCE)
// Calls to setenv() affect the low-level environment as well.
// This is not the case the other way round.
if (wchar_t *envStrings = GetEnvironmentStringsW()) {
@@ -293,11 +299,9 @@ QProcessEnvironment QProcessEnvironment::systemEnvironment()
}
FreeEnvironmentStringsW(envStrings);
}
-#endif
return env;
}
-#if !defined(Q_OS_WINCE)
static QByteArray qt_create_environment(const QProcessEnvironmentPrivate::Hash &environment)
{
QByteArray envlist;
@@ -357,7 +361,6 @@ static QByteArray qt_create_environment(const QProcessEnvironmentPrivate::Hash &
}
return envlist;
}
-#endif
void QProcessPrivate::startProcess()
{
@@ -381,14 +384,10 @@ void QProcessPrivate::startProcess()
!createChannel(stderrChannel))
return;
-#if defined(Q_OS_WINCE)
- QString args = qt_create_commandline(QString(), arguments);
-#else
QString args = qt_create_commandline(program, arguments);
QByteArray envlist;
if (environment.d.constData())
envlist = qt_create_environment(environment.d.constData()->hash);
-#endif
if (!nativeArguments.isEmpty()) {
if (!args.isEmpty())
args += QLatin1Char(' ');
@@ -402,15 +401,6 @@ void QProcessPrivate::startProcess()
qDebug(" pass environment : %s", environment.isEmpty() ? "no" : "yes");
#endif
-#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);
-#else
DWORD dwCreationFlags = CREATE_NO_WINDOW;
dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT;
STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0,
@@ -443,7 +433,6 @@ void QProcessPrivate::startProcess()
CloseHandle(stderrChannel.pipe[1]);
stderrChannel.pipe[1] = INVALID_Q_PIPE;
}
-#endif // Q_OS_WINCE
if (!success) {
cleanup();
@@ -484,24 +473,10 @@ qint64 QProcessPrivate::bytesAvailableFromStdout() const
return 0;
DWORD bytesAvail = 0;
-#if !defined(Q_OS_WINCE)
PeekNamedPipe(stdoutChannel.pipe[0], 0, 0, 0, &bytesAvail, 0);
#if defined QPROCESS_DEBUG
qDebug("QProcessPrivate::bytesAvailableFromStdout() == %d", bytesAvail);
#endif
- if (processChannelMode == QProcess::ForwardedChannels && bytesAvail > 0) {
- QByteArray buf(bytesAvail, 0);
- DWORD bytesRead = 0;
- if (ReadFile(stdoutChannel.pipe[0], buf.data(), buf.size(), &bytesRead, 0) && bytesRead > 0) {
- HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
- if (hStdout) {
- DWORD bytesWritten = 0;
- WriteFile(hStdout, buf.data(), bytesRead, &bytesWritten, 0);
- }
- }
- bytesAvail = 0;
- }
-#endif
return bytesAvail;
}
@@ -511,24 +486,10 @@ qint64 QProcessPrivate::bytesAvailableFromStderr() const
return 0;
DWORD bytesAvail = 0;
-#if !defined(Q_OS_WINCE)
PeekNamedPipe(stderrChannel.pipe[0], 0, 0, 0, &bytesAvail, 0);
#if defined QPROCESS_DEBUG
qDebug("QProcessPrivate::bytesAvailableFromStderr() == %d", bytesAvail);
#endif
- if (processChannelMode == QProcess::ForwardedChannels && bytesAvail > 0) {
- QByteArray buf(bytesAvail, 0);
- DWORD bytesRead = 0;
- if (ReadFile(stderrChannel.pipe[0], buf.data(), buf.size(), &bytesRead, 0) && bytesRead > 0) {
- HANDLE hStderr = GetStdHandle(STD_ERROR_HANDLE);
- if (hStderr) {
- DWORD bytesWritten = 0;
- WriteFile(hStderr, buf.data(), bytesRead, &bytesWritten, 0);
- }
- }
- bytesAvail = 0;
- }
-#endif
return bytesAvail;
}
@@ -596,13 +557,6 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
{
Q_Q(QProcess);
-#if defined(Q_OS_WINCE)
- processError = QProcess::ReadError;
- q->setErrorString(QProcess::tr("Error reading from process"));
- emit q->error(processError);
- return false;
-#endif
-
QIncrementalSleepTimer timer(msecs);
forever {
@@ -646,13 +600,6 @@ bool QProcessPrivate::waitForBytesWritten(int msecs)
{
Q_Q(QProcess);
-#if defined(Q_OS_WINCE)
- processError = QProcess::ReadError;
- q->setErrorString(QProcess::tr("Error reading from process"));
- emit q->error(processError);
- return false;
-#endif
-
QIncrementalSleepTimer timer(msecs);
forever {
@@ -786,13 +733,6 @@ qint64 QProcessPrivate::writeToStdin(const char *data, qint64 maxlen)
{
Q_Q(QProcess);
-#if defined(Q_OS_WINCE)
- processError = QProcess::WriteError;
- q->setErrorString(QProcess::tr("Error writing to process"));
- emit q->error(processError);
- return -1;
-#endif
-
if (!pipeWriter) {
pipeWriter = new QWindowsPipeWriter(stdinChannel.pipe[1], q);
pipeWriter->start();
@@ -832,36 +772,19 @@ void QProcessPrivate::_q_notified()
bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDir, qint64 *pid)
{
-#if defined(Q_OS_WINCE)
- Q_UNUSED(workingDir);
- QString args = qt_create_commandline(QString(), arguments);
-#else
QString args = qt_create_commandline(program, arguments);
-#endif
-
bool success = false;
-
PROCESS_INFORMATION pinfo;
-#if defined(Q_OS_WINCE)
- QString fullPathProgram = program;
- if (!QDir::isAbsolutePath(fullPathProgram))
- fullPathProgram.prepend(QDir::currentPath().append(QLatin1Char('/')));
- fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\'));
- success = CreateProcess((wchar_t*)fullPathProgram.utf16(),
- (wchar_t*)args.utf16(),
- 0, 0, false, CREATE_NEW_CONSOLE, 0, 0, 0, &pinfo);
-#else
- STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0,
- (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
- (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- };
- success = CreateProcess(0, (wchar_t*)args.utf16(),
- 0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE, 0,
- workingDir.isEmpty() ? 0 : (wchar_t*)workingDir.utf16(),
- &startupInfo, &pinfo);
-#endif // Q_OS_WINCE
+ STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0,
+ (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
+ (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ success = CreateProcess(0, (wchar_t*)args.utf16(),
+ 0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE, 0,
+ workingDir.isEmpty() ? 0 : (wchar_t*)workingDir.utf16(),
+ &startupInfo, &pinfo);
if (success) {
CloseHandle(pinfo.hThread);
diff --git a/src/corelib/io/qprocess_wince.cpp b/src/corelib/io/qprocess_wince.cpp
new file mode 100644
index 0000000000..16a34469e7
--- /dev/null
+++ b/src/corelib/io/qprocess_wince.cpp
@@ -0,0 +1,330 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qprocess.h"
+#include "qprocess_p.h"
+
+#include <qdir.h>
+#include <qfileinfo.h>
+#include <qregexp.h>
+#include <qtimer.h>
+#include <qwineventnotifier.h>
+#include <qdebug.h>
+
+#ifndef QT_NO_PROCESS
+
+QT_BEGIN_NAMESPACE
+
+//#define QPROCESS_DEBUG
+
+void QProcessPrivate::destroyPipe(Q_PIPE pipe[2])
+{
+ Q_UNUSED(pipe);
+}
+
+static QString qt_create_commandline(const QString &program, const QStringList &arguments)
+{
+ QString args;
+ if (!program.isEmpty()) {
+ QString programName = program;
+ if (!programName.startsWith(QLatin1Char('\"')) && !programName.endsWith(QLatin1Char('\"')) && programName.contains(QLatin1Char(' ')))
+ programName = QLatin1Char('\"') + programName + QLatin1Char('\"');
+ programName.replace(QLatin1Char('/'), QLatin1Char('\\'));
+
+ // add the prgram as the first arg ... it works better
+ args = programName + QLatin1Char(' ');
+ }
+
+ for (int i=0; i<arguments.size(); ++i) {
+ QString tmp = arguments.at(i);
+ // Quotes are escaped and their preceding backslashes are doubled.
+ tmp.replace(QRegExp(QLatin1String("(\\\\*)\"")), QLatin1String("\\1\\1\\\""));
+ if (tmp.isEmpty() || tmp.contains(QLatin1Char(' ')) || tmp.contains(QLatin1Char('\t'))) {
+ // The argument must not end with a \ since this would be interpreted
+ // as escaping the quote -- rather put the \ behind the quote: e.g.
+ // rather use "foo"\ than "foo\"
+ int i = tmp.length();
+ while (i > 0 && tmp.at(i - 1) == QLatin1Char('\\'))
+ --i;
+ tmp.insert(i, QLatin1Char('"'));
+ tmp.prepend(QLatin1Char('"'));
+ }
+ args += QLatin1Char(' ') + tmp;
+ }
+ return args;
+}
+
+QProcessEnvironment QProcessEnvironment::systemEnvironment()
+{
+ QProcessEnvironment env;
+ return env;
+}
+
+void QProcessPrivate::startProcess()
+{
+ Q_Q(QProcess);
+
+ bool success = false;
+
+ if (pid) {
+ CloseHandle(pid->hThread);
+ CloseHandle(pid->hProcess);
+ delete pid;
+ pid = 0;
+ }
+ pid = new PROCESS_INFORMATION;
+ memset(pid, 0, sizeof(PROCESS_INFORMATION));
+
+ q->setProcessState(QProcess::Starting);
+
+ QString args = qt_create_commandline(QString(), arguments);
+ if (!nativeArguments.isEmpty()) {
+ if (!args.isEmpty())
+ args += QLatin1Char(' ');
+ args += nativeArguments;
+ }
+
+#if defined QPROCESS_DEBUG
+ qDebug("Creating process");
+ qDebug(" program : [%s]", program.toLatin1().constData());
+ qDebug(" args : %s", args.toLatin1().constData());
+ qDebug(" pass environment : %s", environment.isEmpty() ? "no" : "yes");
+#endif
+
+ 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);
+
+ if (!success) {
+ cleanup();
+ processError = QProcess::FailedToStart;
+ emit q->error(processError);
+ q->setProcessState(QProcess::NotRunning);
+ return;
+ }
+
+ q->setProcessState(QProcess::Running);
+ // User can call kill()/terminate() from the stateChanged() slot
+ // so check before proceeding
+ if (!pid)
+ return;
+
+ if (threadData->eventDispatcher) {
+ processFinishedNotifier = new QWinEventNotifier(pid->hProcess, q);
+ QObject::connect(processFinishedNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_processDied()));
+ processFinishedNotifier->setEnabled(true);
+ }
+
+ // give the process a chance to start ...
+ Sleep(SLEEPMIN * 2);
+ _q_startupNotification();
+}
+
+bool QProcessPrivate::processStarted()
+{
+ return processState == QProcess::Running;
+}
+
+qint64 QProcessPrivate::bytesAvailableFromStdout() const
+{
+ return 0;
+}
+
+qint64 QProcessPrivate::bytesAvailableFromStderr() const
+{
+ return 0;
+}
+
+qint64 QProcessPrivate::readFromStdout(char *data, qint64 maxlen)
+{
+ return -1;
+}
+
+qint64 QProcessPrivate::readFromStderr(char *data, qint64 maxlen)
+{
+ return -1;
+}
+
+static BOOL QT_WIN_CALLBACK qt_terminateApp(HWND hwnd, LPARAM procId)
+{
+ DWORD currentProcId = 0;
+ GetWindowThreadProcessId(hwnd, &currentProcId);
+ if (currentProcId == (DWORD)procId)
+ PostMessage(hwnd, WM_CLOSE, 0, 0);
+
+ return TRUE;
+}
+
+void QProcessPrivate::terminateProcess()
+{
+ if (pid) {
+ EnumWindows(qt_terminateApp, (LPARAM)pid->dwProcessId);
+ PostThreadMessage(pid->dwThreadId, WM_CLOSE, 0, 0);
+ }
+}
+
+void QProcessPrivate::killProcess()
+{
+ if (pid)
+ TerminateProcess(pid->hProcess, 0xf291);
+}
+
+bool QProcessPrivate::waitForStarted(int)
+{
+ Q_Q(QProcess);
+
+ if (processStarted())
+ return true;
+
+ if (processError == QProcess::FailedToStart)
+ return false;
+
+ processError = QProcess::Timedout;
+ q->setErrorString(QProcess::tr("Process operation timed out"));
+ return false;
+}
+
+bool QProcessPrivate::waitForReadyRead(int msecs)
+{
+ return false;
+}
+
+bool QProcessPrivate::waitForBytesWritten(int msecs)
+{
+ return false;
+}
+
+bool QProcessPrivate::waitForFinished(int msecs)
+{
+ Q_Q(QProcess);
+#if defined QPROCESS_DEBUG
+ qDebug("QProcessPrivate::waitForFinished(%d)", msecs);
+#endif
+
+ QIncrementalSleepTimer timer(msecs);
+
+ forever {
+ if (!pid)
+ return true;
+
+ if (WaitForSingleObject(pid->hProcess, timer.nextSleepTime()) == WAIT_OBJECT_0) {
+ _q_processDied();
+ return true;
+ }
+
+ if (timer.hasTimedOut())
+ break;
+ }
+ processError = QProcess::Timedout;
+ q->setErrorString(QProcess::tr("Process operation timed out"));
+ return false;
+}
+
+void QProcessPrivate::findExitCode()
+{
+ DWORD theExitCode;
+ if (GetExitCodeProcess(pid->hProcess, &theExitCode)) {
+ exitCode = theExitCode;
+ //### for now we assume a crash if exit code is less than -1 or the magic number
+ crashed = (exitCode == 0xf291 || (int)exitCode < 0);
+ }
+}
+
+void QProcessPrivate::flushPipeWriter()
+{
+}
+
+qint64 QProcessPrivate::pipeWriterBytesToWrite() const
+{
+ return 0;
+}
+
+qint64 QProcessPrivate::writeToStdin(const char *data, qint64 maxlen)
+{
+ Q_UNUSED(data);
+ Q_UNUSED(maxlen);
+ return -1;
+}
+
+bool QProcessPrivate::waitForWrite(int msecs)
+{
+ Q_UNUSED(msecs);
+ return false;
+}
+
+void QProcessPrivate::_q_notified()
+{
+}
+
+bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDir, qint64 *pid)
+{
+ Q_UNUSED(workingDir);
+ QString args = qt_create_commandline(QString(), arguments);
+
+ bool success = false;
+
+ PROCESS_INFORMATION pinfo;
+
+ QString fullPathProgram = program;
+ if (!QDir::isAbsolutePath(fullPathProgram))
+ fullPathProgram.prepend(QDir::currentPath().append(QLatin1Char('/')));
+ fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\'));
+ success = CreateProcess((wchar_t*)fullPathProgram.utf16(),
+ (wchar_t*)args.utf16(),
+ 0, 0, false, CREATE_NEW_CONSOLE, 0, 0, 0, &pinfo);
+
+ if (success) {
+ CloseHandle(pinfo.hThread);
+ CloseHandle(pinfo.hProcess);
+ if (pid)
+ *pid = pinfo.dwProcessId;
+ }
+
+ return success;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_PROCESS
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index 6ad15788b0..0ae3f9e647 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1491,6 +1491,4 @@ bool QResourceFileEnginePrivate::unmap(uchar *ptr)
return true;
}
-Q_CORE_EXPORT void qInitResourceIO() { } // ### Qt 5: remove
-
QT_END_NAMESPACE
diff --git a/src/corelib/io/qresource.h b/src/corelib/io/qresource.h
index 1edc7a4f13..452e141e41 100644
--- a/src/corelib/io/qresource.h
+++ b/src/corelib/io/qresource.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qresource_iterator.cpp b/src/corelib/io/qresource_iterator.cpp
index e19bad1e03..3317ef5fff 100644
--- a/src/corelib/io/qresource_iterator.cpp
+++ b/src/corelib/io/qresource_iterator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qresource_iterator_p.h b/src/corelib/io/qresource_iterator_p.h
index 519f46199c..3603c64819 100644
--- a/src/corelib/io/qresource_iterator_p.h
+++ b/src/corelib/io/qresource_iterator_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qresource_p.h b/src/corelib/io/qresource_p.h
index 4beda142ed..f558319dc2 100644
--- a/src/corelib/io/qresource_p.h
+++ b/src/corelib/io/qresource_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 37bd8c460d..81dc5bb078 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qsettings.h b/src/corelib/io/qsettings.h
index b144a9af4c..65aeb89523 100644
--- a/src/corelib/io/qsettings.h
+++ b/src/corelib/io/qsettings.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp
index 11e0c3c103..6bb815c561 100644
--- a/src/corelib/io/qsettings_mac.cpp
+++ b/src/corelib/io/qsettings_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h
index 5d62c839a6..cf348122dc 100644
--- a/src/corelib/io/qsettings_p.h
+++ b/src/corelib/io/qsettings_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp
index bbc7dd1677..2cac379ec6 100644
--- a/src/corelib/io/qsettings_win.cpp
+++ b/src/corelib/io/qsettings_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp
index 43ae5c07ab..5accb61cc5 100644
--- a/src/corelib/io/qstandardpaths.cpp
+++ b/src/corelib/io/qstandardpaths.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -83,6 +83,8 @@ QT_BEGIN_NAMESPACE
returned for GenericDataLocation.
\value CacheLocation Returns a directory location where user-specific
non-essential (cached) data should be written.
+ \value GenericCacheLocation Returns a directory location where user-specific
+ non-essential (cached) data, shared across applications, should be written.
\value GenericDataLocation Returns a directory location where persistent
data shared across applications can be stored.
\value RuntimeLocation Returns a directory location where runtime communication
diff --git a/src/corelib/io/qstandardpaths.h b/src/corelib/io/qstandardpaths.h
index d91da9de2f..bae7b3f7b5 100644
--- a/src/corelib/io/qstandardpaths.h
+++ b/src/corelib/io/qstandardpaths.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -73,7 +73,8 @@ public:
GenericDataLocation,
RuntimeLocation,
ConfigLocation,
- DownloadLocation
+ DownloadLocation,
+ GenericCacheLocation
};
static QString writableLocation(StandardLocation type);
diff --git a/src/corelib/io/qstandardpaths_mac.cpp b/src/corelib/io/qstandardpaths_mac.cpp
index 84fc81494c..f37c21ed39 100644
--- a/src/corelib/io/qstandardpaths_mac.cpp
+++ b/src/corelib/io/qstandardpaths_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -82,6 +82,7 @@ OSType translateLocation(QStandardPaths::StandardLocation type)
case QStandardPaths::RuntimeLocation:
case QStandardPaths::DataLocation:
return kApplicationSupportFolderType;
+ case QStandardPaths::GenericCacheLocation:
case QStandardPaths::CacheLocation:
return kCachedDataFolderType;
default:
@@ -128,6 +129,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
return QDir::tempPath();
case GenericDataLocation:
case DataLocation:
+ case GenericCacheLocation:
case CacheLocation:
case RuntimeLocation:
return macLocation(type, kUserDomain);
@@ -140,7 +142,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
{
QStringList dirs;
- if (type == GenericDataLocation || type == DataLocation || type == CacheLocation) {
+ if (type == GenericDataLocation || type == DataLocation || type == GenericCacheLocation || type == CacheLocation) {
const QString path = macLocation(type, kOnAppropriateDisk);
if (!path.isEmpty())
dirs.append(path);
diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp
index b1c5869f71..5aef52eaba 100644
--- a/src/corelib/io/qstandardpaths_unix.cpp
+++ b/src/corelib/io/qstandardpaths_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -62,15 +62,18 @@ QString QStandardPaths::writableLocation(StandardLocation type)
case TempLocation:
return QDir::tempPath();
case CacheLocation:
+ case GenericCacheLocation:
{
// http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
QString xdgCacheHome = QFile::decodeName(qgetenv("XDG_CACHE_HOME"));
if (xdgCacheHome.isEmpty())
xdgCacheHome = QDir::homePath() + QLatin1String("/.cache");
- if (!QCoreApplication::organizationName().isEmpty())
- xdgCacheHome += QLatin1Char('/') + QCoreApplication::organizationName();
- if (!QCoreApplication::applicationName().isEmpty())
- xdgCacheHome += QLatin1Char('/') + QCoreApplication::applicationName();
+ if (type == QStandardPaths::CacheLocation) {
+ if (!QCoreApplication::organizationName().isEmpty())
+ xdgCacheHome += QLatin1Char('/') + QCoreApplication::organizationName();
+ if (!QCoreApplication::applicationName().isEmpty())
+ xdgCacheHome += QLatin1Char('/') + QCoreApplication::applicationName();
+ }
return xdgCacheHome;
}
case DataLocation:
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index e9093649f3..e3f86b7134 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -160,6 +160,9 @@ QString QStandardPaths::writableLocation(StandardLocation type)
// cache directory located in their AppData directory
return writableLocation(DataLocation) + QLatin1String("\\cache");
+ case GenericCacheLocation:
+ return writableLocation(GenericDataLocation) + QLatin1String("\\cache");
+
case RuntimeLocation:
case HomeLocation:
result = QDir::homePath();
diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp
index 78ec1774eb..15d3258a9a 100644
--- a/src/corelib/io/qtemporarydir.cpp
+++ b/src/corelib/io/qtemporarydir.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qtemporarydir.h b/src/corelib/io/qtemporarydir.h
index da0d1214c4..22c0a271e4 100644
--- a/src/corelib/io/qtemporarydir.h
+++ b/src/corelib/io/qtemporarydir.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index 677be45f65..eb645fabe8 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qtemporaryfile.h b/src/corelib/io/qtemporaryfile.h
index 282b897813..20956d2cf0 100644
--- a/src/corelib/io/qtemporaryfile.h
+++ b/src/corelib/io/qtemporaryfile.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 177f73def3..8c7f57fddf 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qtextstream.h b/src/corelib/io/qtextstream.h
index db038855a8..0531d4017d 100644
--- a/src/corelib/io/qtextstream.h
+++ b/src/corelib/io/qtextstream.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qtldurl.cpp b/src/corelib/io/qtldurl.cpp
index 7d06ca4b17..2c725f17fd 100644
--- a/src/corelib/io/qtldurl.cpp
+++ b/src/corelib/io/qtldurl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qtldurl_p.h b/src/corelib/io/qtldurl_p.h
index 77c0a15823..0a94f3015b 100644
--- a/src/corelib/io/qtldurl_p.h
+++ b/src/corelib/io/qtldurl_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index c921a89b30..53b4df4729 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index e62cd0a85b..75a88e8048 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp
new file mode 100644
index 0000000000..8da786ebd9
--- /dev/null
+++ b/src/corelib/io/qwindowspipereader.cpp
@@ -0,0 +1,315 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwindowspipereader_p.h"
+#include <qdebug.h>
+#include <qelapsedtimer.h>
+#include <qeventloop.h>
+#include <qtimer.h>
+#include <qwineventnotifier.h>
+
+QT_BEGIN_NAMESPACE
+
+QWindowsPipeReader::QWindowsPipeReader(QObject *parent)
+ : QObject(parent),
+ handle(INVALID_HANDLE_VALUE),
+ readBufferMaxSize(0),
+ actualReadBufferSize(0),
+ emitReadyReadTimer(new QTimer(this)),
+ pipeBroken(false)
+{
+ emitReadyReadTimer->setSingleShot(true);
+ connect(emitReadyReadTimer, SIGNAL(timeout()), SIGNAL(readyRead()));
+
+ ZeroMemory(&overlapped, sizeof(overlapped));
+ overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ dataReadNotifier = new QWinEventNotifier(overlapped.hEvent, this);
+ connect(dataReadNotifier, SIGNAL(activated(HANDLE)), SLOT(readEventSignalled()));
+}
+
+QWindowsPipeReader::~QWindowsPipeReader()
+{
+ CloseHandle(overlapped.hEvent);
+}
+
+/*!
+ Sets the handle to read from. The handle must be valid.
+ */
+void QWindowsPipeReader::setHandle(HANDLE hPipeReadEnd)
+{
+ readBuffer.clear();
+ actualReadBufferSize = 0;
+ handle = hPipeReadEnd;
+ pipeBroken = false;
+ dataReadNotifier->setEnabled(true);
+}
+
+/*!
+ Stops the asynchronous read sequence.
+ This function assumes that the file already has been closed.
+ It does not cancel any I/O operation.
+ */
+void QWindowsPipeReader::stop()
+{
+ dataReadNotifier->setEnabled(false);
+ readSequenceStarted = false;
+ handle = INVALID_HANDLE_VALUE;
+ ResetEvent(overlapped.hEvent);
+}
+
+/*!
+ Returns the number of bytes we've read so far.
+ */
+qint64 QWindowsPipeReader::bytesAvailable() const
+{
+ return actualReadBufferSize;
+}
+
+/*!
+ Stops the asynchronous read sequence.
+ */
+qint64 QWindowsPipeReader::read(char *data, qint64 maxlen)
+{
+ if (pipeBroken && actualReadBufferSize == 0)
+ return -1; // signal EOF
+
+ qint64 readSoFar;
+ // If startAsyncRead() has read data, copy it to its destination.
+ if (maxlen == 1 && actualReadBufferSize > 0) {
+ *data = readBuffer.getChar();
+ actualReadBufferSize--;
+ readSoFar = 1;
+ } else {
+ qint64 bytesToRead = qMin(qint64(actualReadBufferSize), maxlen);
+ readSoFar = 0;
+ while (readSoFar < bytesToRead) {
+ const char *ptr = readBuffer.readPointer();
+ int bytesToReadFromThisBlock = qMin(bytesToRead - readSoFar,
+ qint64(readBuffer.nextDataBlockSize()));
+ memcpy(data + readSoFar, ptr, bytesToReadFromThisBlock);
+ readSoFar += bytesToReadFromThisBlock;
+ readBuffer.free(bytesToReadFromThisBlock);
+ actualReadBufferSize -= bytesToReadFromThisBlock;
+ }
+ }
+
+ if (!pipeBroken) {
+ if (!actualReadBufferSize)
+ emitReadyReadTimer->stop();
+ if (!readSequenceStarted)
+ startAsyncRead();
+ }
+
+ return readSoFar;
+}
+
+bool QWindowsPipeReader::canReadLine() const
+{
+ return readBuffer.indexOf('\n', actualReadBufferSize) >= 0;
+}
+
+/*!
+ \internal
+ Will be called whenever the read operation completes.
+ Returns true, if readyRead() has been emitted.
+ */
+bool QWindowsPipeReader::readEventSignalled()
+{
+ if (!completeAsyncRead()) {
+ pipeBroken = true;
+ emit pipeClosed();
+ return false;
+ }
+ startAsyncRead();
+ emitReadyReadTimer->stop();
+ emit readyRead();
+ return true;
+}
+
+/*!
+ \internal
+ Reads data from the socket into the readbuffer
+ */
+void QWindowsPipeReader::startAsyncRead()
+{
+ do {
+ DWORD bytesToRead = checkPipeState();
+ if (pipeBroken)
+ return;
+
+ if (bytesToRead == 0) {
+ // There are no bytes in the pipe but we need to
+ // start the overlapped read with some buffer size.
+ bytesToRead = initialReadBufferSize;
+ }
+
+ if (readBufferMaxSize && bytesToRead > (readBufferMaxSize - readBuffer.size())) {
+ bytesToRead = readBufferMaxSize - readBuffer.size();
+ if (bytesToRead == 0) {
+ // Buffer is full. User must read data from the buffer
+ // before we can read more from the pipe.
+ return;
+ }
+ }
+
+ char *ptr = readBuffer.reserve(bytesToRead);
+
+ readSequenceStarted = true;
+ if (ReadFile(handle, ptr, bytesToRead, NULL, &overlapped)) {
+ completeAsyncRead();
+ } else {
+ switch (GetLastError()) {
+ case ERROR_IO_PENDING:
+ // This is not an error. We're getting notified, when data arrives.
+ return;
+ case ERROR_MORE_DATA:
+ // This is not an error. The synchronous read succeeded.
+ // We're connected to a message mode pipe and the message
+ // didn't fit into the pipe's system buffer.
+ completeAsyncRead();
+ break;
+ case ERROR_PIPE_NOT_CONNECTED:
+ {
+ // It may happen, that the other side closes the connection directly
+ // after writing data. Then we must set the appropriate socket state.
+ pipeBroken = true;
+ emit pipeClosed();
+ return;
+ }
+ default:
+ emit winError(GetLastError(), QLatin1String("QWindowsPipeReader::startAsyncRead"));
+ return;
+ }
+ }
+ } while (!readSequenceStarted);
+}
+
+/*!
+ \internal
+ Sets the correct size of the read buffer after a read operation.
+ Returns false, if an error occurred or the connection dropped.
+ */
+bool QWindowsPipeReader::completeAsyncRead()
+{
+ ResetEvent(overlapped.hEvent);
+ readSequenceStarted = false;
+
+ DWORD bytesRead;
+ if (!GetOverlappedResult(handle, &overlapped, &bytesRead, TRUE)) {
+ switch (GetLastError()) {
+ case ERROR_MORE_DATA:
+ // This is not an error. We're connected to a message mode
+ // pipe and the message didn't fit into the pipe's system
+ // buffer. We will read the remaining data in the next call.
+ break;
+ case ERROR_BROKEN_PIPE:
+ case ERROR_PIPE_NOT_CONNECTED:
+ return false;
+ default:
+ emit winError(GetLastError(), QLatin1String("QWindowsPipeReader::completeAsyncRead"));
+ return false;
+ }
+ }
+
+ actualReadBufferSize += bytesRead;
+ readBuffer.truncate(actualReadBufferSize);
+ if (!emitReadyReadTimer->isActive())
+ emitReadyReadTimer->start();
+ return true;
+}
+
+/*!
+ \internal
+ Returns the number of available bytes in the pipe.
+ Sets QWindowsPipeReader::pipeBroken to true if the connection is broken.
+ */
+DWORD QWindowsPipeReader::checkPipeState()
+{
+ DWORD bytes;
+ if (PeekNamedPipe(handle, NULL, 0, NULL, &bytes, NULL)) {
+ return bytes;
+ } else {
+ if (!pipeBroken) {
+ pipeBroken = true;
+ emit pipeClosed();
+ }
+ }
+ return 0;
+}
+
+/*!
+ Waits for the completion of the asynchronous read operation.
+ Returns true, if we've emitted the readyRead signal.
+ */
+bool QWindowsPipeReader::waitForReadyRead(int msecs)
+{
+ Q_ASSERT(readSequenceStarted);
+ DWORD result = WaitForSingleObject(overlapped.hEvent, msecs == -1 ? INFINITE : msecs);
+ switch (result) {
+ case WAIT_OBJECT_0:
+ return readEventSignalled();
+ case WAIT_TIMEOUT:
+ return false;
+ }
+
+ qWarning("QWindowsPipeReader::waitForReadyRead WaitForSingleObject failed with error code %d.", int(GetLastError()));
+ return false;
+}
+
+/*!
+ Waits until the pipe is closed.
+ */
+bool QWindowsPipeReader::waitForPipeClosed(int msecs)
+{
+ const int sleepTime = 10;
+ QElapsedTimer stopWatch;
+ stopWatch.start();
+ forever {
+ checkPipeState();
+ if (pipeBroken)
+ return true;
+ if (stopWatch.hasExpired(msecs - sleepTime))
+ return false;
+ Sleep(sleepTime);
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/corelib/io/qfilesystemwatcher_symbian_p.h b/src/corelib/io/qwindowspipereader_p.h
index 0b317a062f..e78d6b29ad 100644
--- a/src/corelib/io/qfilesystemwatcher_symbian_p.h
+++ b/src/corelib/io/qwindowspipereader_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QFILESYSTEMWATCHER_SYMBIAN_P_H
-#define QFILESYSTEMWATCHER_SYMBIAN_P_H
+#ifndef QWINDOWSPIPEREADER_P_H
+#define QWINDOWSPIPEREADER_P_H
//
// W A R N I N G
@@ -53,78 +53,70 @@
// We mean it.
//
-#include "qfilesystemwatcher_p.h"
+#include <qbytearray.h>
+#include <qobject.h>
+#include <qtimer.h>
+#include <qt_windows.h>
-#ifndef QT_NO_FILESYSTEMWATCHER
+#include <private/qringbuffer_p.h>
-#include "qhash.h"
-#include "qmutex.h"
-#include "qwaitcondition.h"
-
-#include <e32base.h>
-#include <f32file.h>
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QSymbianFileSystemWatcherEngine;
-
-class QNotifyChangeEvent : public CActive
-{
-public:
- QNotifyChangeEvent(RFs &fsSession, const TDesC &file, QSymbianFileSystemWatcherEngine *engine,
- bool aIsDir, TInt aPriority = EPriorityStandard);
- ~QNotifyChangeEvent();
-
- bool isDir;
+QT_MODULE(Core)
-private:
- void RunL();
- void DoCancel();
-
- RFs &fsSession;
- TPath watchedPath;
- QSymbianFileSystemWatcherEngine *engine;
-
- int failureCount;
-};
+class QWinEventNotifier;
-class QSymbianFileSystemWatcherEngine : public QFileSystemWatcherEngine
+class Q_CORE_EXPORT QWindowsPipeReader : public QObject
{
Q_OBJECT
-
public:
- QSymbianFileSystemWatcherEngine();
- ~QSymbianFileSystemWatcherEngine();
-
- QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories);
- QStringList removePaths(const QStringList &paths, QStringList *files,
- QStringList *directories);
+ explicit QWindowsPipeReader(QObject *parent = 0);
+ ~QWindowsPipeReader();
+ void setHandle(HANDLE hPipeReadEnd);
void stop();
-protected:
- void run();
+ void setMaxReadBufferSize(qint64 size) { readBufferMaxSize = size; }
+ qint64 maxReadBufferSize() const { return readBufferMaxSize; }
-public Q_SLOTS:
- void addNativeListener(const QString &directoryPath);
- void removeNativeListener();
+ bool isPipeClosed() const { return pipeBroken; }
+ qint64 bytesAvailable() const;
+ qint64 read(char *data, qint64 maxlen);
+ bool canReadLine() const;
+ bool waitForReadyRead(int msecs);
+ bool waitForPipeClosed(int msecs);
-private:
- friend class QNotifyChangeEvent;
- void emitPathChanged(QNotifyChangeEvent *e);
+ void startAsyncRead();
+ bool completeAsyncRead();
- void startWatcher();
+Q_SIGNALS:
+ void winError(ulong, const QString &);
+ void readyRead();
+ void pipeClosed();
- QHash<QNotifyChangeEvent*, QString> activeObjectToPath;
- QMutex mutex;
- QWaitCondition syncCondition;
- bool watcherStarted;
- QNotifyChangeEvent *currentAddEvent;
- QNotifyChangeEvent *currentRemoveEvent;
-};
+private Q_SLOTS:
+ bool readEventSignalled();
-#endif // QT_NO_FILESYSTEMWATCHER
+private:
+ DWORD checkPipeState();
+
+private:
+ HANDLE handle;
+ OVERLAPPED overlapped;
+ QWinEventNotifier *dataReadNotifier;
+ qint64 readBufferMaxSize;
+ QRingBuffer readBuffer;
+ int actualReadBufferSize;
+ bool readSequenceStarted;
+ QTimer *emitReadyReadTimer;
+ bool pipeBroken;
+ static const qint64 initialReadBufferSize = 4096;
+};
QT_END_NAMESPACE
-#endif // QFILESYSTEMWATCHER_WIN_P_H
+QT_END_HEADER
+
+#endif // QWINDOWSPIPEREADER_P_H
diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp
index cb802f1d91..a1765b4178 100644
--- a/src/corelib/io/qwindowspipewriter.cpp
+++ b/src/corelib/io/qwindowspipewriter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/io/qwindowspipewriter_p.h b/src/corelib/io/qwindowspipewriter_p.h
index dfcb77e17c..44a1d04b4e 100644
--- a/src/corelib/io/qwindowspipewriter_p.h
+++ b/src/corelib/io/qwindowspipewriter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/itemmodels/itemmodels.pri b/src/corelib/itemmodels/itemmodels.pri
new file mode 100644
index 0000000000..83ec4c5dbf
--- /dev/null
+++ b/src/corelib/itemmodels/itemmodels.pri
@@ -0,0 +1,20 @@
+# Qt itemmodels core module
+
+HEADERS += \
+ itemmodels/qabstractitemmodel.h \
+ itemmodels/qabstractitemmodel_p.h \
+ itemmodels/qabstractproxymodel.h \
+ itemmodels/qabstractproxymodel_p.h \
+ itemmodels/qitemselectionmodel.h \
+ itemmodels/qitemselectionmodel_p.h \
+ itemmodels/qidentityproxymodel.h \
+ itemmodels/qsortfilterproxymodel.h \
+ itemmodels/qstringlistmodel.h
+
+SOURCES += \
+ itemmodels/qabstractitemmodel.cpp \
+ itemmodels/qabstractproxymodel.cpp \
+ itemmodels/qitemselectionmodel.cpp \
+ itemmodels/qidentityproxymodel.cpp \
+ itemmodels/qsortfilterproxymodel.cpp \
+ itemmodels/qstringlistmodel.cpp
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index 99455371ae..dec1fe4cef 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1759,18 +1759,19 @@ QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const
Returns true if the data and action can be handled by the model; otherwise
returns false.
- Although the specified \a row, \a column and \a parent indicate the
- location of an item in the model where the operation ended, it is the
- responsibility of the view to provide a suitable location for where the
- data should be inserted.
+ The specified \a row, \a column and \a parent indicate the location of an
+ item in the model where the operation ended. It is the responsibility of
+ the model to complete the action at the correct location.
For instance, a drop action on an item in a QTreeView can result in new
items either being inserted as children of the item specified by \a row,
\a column, and \a parent, or as siblings of the item.
- When row and column are -1 it means that it is up to the model to decide
- where to place the data. This can occur in a tree when data is dropped on
- a parent. Models will usually append the data to the parent in this case.
+ When \a row and \a column are -1 it means that the dropped data should be
+ considered as dropped directly on \a parent. Usually this will mean
+ appending the data as child items of \a parent. If \a row and column are
+ greater than or equal zero, it means that the drop occurred just before the
+ specified \a row and \a column in the specified \a parent.
\sa supportedDropActions(), {Using drag and drop with item views}
*/
@@ -1830,7 +1831,6 @@ Qt::DropActions QAbstractItemModel::supportedDropActions() const
*/
Qt::DropActions QAbstractItemModel::supportedDragActions() const
{
- // ### Qt 5: make this virtual or these properties
Q_D(const QAbstractItemModel);
if (d->supportedDragActions != -1)
return d->supportedDragActions;
@@ -1838,17 +1838,22 @@ Qt::DropActions QAbstractItemModel::supportedDragActions() const
}
/*!
+ \internal
+ */
+void QAbstractItemModel::doSetSupportedDragActions(Qt::DropActions actions)
+{
+ Q_D(QAbstractItemModel);
+ d->supportedDragActions = actions;
+}
+
+/*!
\since 4.2
+ \obsolete
Sets the supported drag \a actions for the items in the model.
\sa supportedDragActions(), {Using drag and drop with item views}
*/
-void QAbstractItemModel::setSupportedDragActions(Qt::DropActions actions)
-{
- Q_D(QAbstractItemModel);
- d->supportedDragActions = actions;
-}
/*!
\note The base class implementation of this function does nothing and
@@ -2131,6 +2136,7 @@ QSize QAbstractItemModel::span(const QModelIndex &) const
/*!
\since 4.6
+ \obsolete
Sets the model's role names to \a roleNames.
@@ -2141,7 +2147,11 @@ QSize QAbstractItemModel::span(const QModelIndex &) const
\sa roleNames()
*/
-void QAbstractItemModel::setRoleNames(const QHash<int,QByteArray> &roleNames)
+
+/*!
+ \internal
+ */
+void QAbstractItemModel::doSetRoleNames(const QHash<int,QByteArray> &roleNames)
{
Q_D(QAbstractItemModel);
d->roleNames = roleNames;
@@ -2154,7 +2164,7 @@ void QAbstractItemModel::setRoleNames(const QHash<int,QByteArray> &roleNames)
\sa setRoleNames()
*/
-const QHash<int,QByteArray> &QAbstractItemModel::roleNames() const
+QHash<int,QByteArray> QAbstractItemModel::roleNames() const
{
Q_D(const QAbstractItemModel);
return d->roleNames;
diff --git a/src/corelib/kernel/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h
index 0aa8144602..46dd7880ce 100644
--- a/src/corelib/kernel/qabstractitemmodel.h
+++ b/src/corelib/itemmodels/qabstractitemmodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -198,8 +198,13 @@ public:
int row, int column, const QModelIndex &parent);
virtual Qt::DropActions supportedDropActions() const;
- Qt::DropActions supportedDragActions() const;
- void setSupportedDragActions(Qt::DropActions);
+ virtual Qt::DropActions supportedDragActions() const;
+#if QT_DEPRECATED_SINCE(5, 0)
+ void setSupportedDragActions(Qt::DropActions actions)
+ {
+ doSetSupportedDragActions(actions);
+ }
+#endif
virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex());
@@ -222,7 +227,7 @@ public:
Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const;
virtual QSize span(const QModelIndex &index) const;
- const QHash<int,QByteArray> &roleNames() const;
+ virtual QHash<int,QByteArray> roleNames() const;
#ifdef Q_NO_USING_KEYWORD
inline QObject *parent() const { return QObject::parent(); }
@@ -302,9 +307,17 @@ protected:
void changePersistentIndexList(const QModelIndexList &from, const QModelIndexList &to);
QModelIndexList persistentIndexList() const;
- void setRoleNames(const QHash<int,QByteArray> &roleNames);
+#if QT_DEPRECATED_SINCE(5,0)
+ QT_DEPRECATED void setRoleNames(const QHash<int,QByteArray> &theRoleNames)
+ {
+ doSetRoleNames(theRoleNames);
+ }
+#endif
private:
+ void doSetRoleNames(const QHash<int,QByteArray> &roleNames);
+ void doSetSupportedDragActions(Qt::DropActions actions);
+
Q_DECLARE_PRIVATE(QAbstractItemModel)
Q_DISABLE_COPY(QAbstractItemModel)
};
diff --git a/src/corelib/kernel/qabstractitemmodel_p.h b/src/corelib/itemmodels/qabstractitemmodel_p.h
index 86680dd0bc..3c5d8e5d20 100644
--- a/src/corelib/kernel/qabstractitemmodel_p.h
+++ b/src/corelib/itemmodels/qabstractitemmodel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qabstractproxymodel.cpp b/src/corelib/itemmodels/qabstractproxymodel.cpp
index 47810d6cc7..46678403db 100644
--- a/src/widgets/itemviews/qabstractproxymodel.cpp
+++ b/src/corelib/itemmodels/qabstractproxymodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
\brief The QAbstractProxyModel class provides a base class for proxy item
models that can do sorting, filtering or other data processing tasks.
\ingroup model-view
- \inmodule QtWidgets
+ \inmodule QtCore
This class defines the standard interface that proxy models must use to be
able to interoperate correctly with other model/view components. It is not
diff --git a/src/widgets/itemviews/qabstractproxymodel.h b/src/corelib/itemmodels/qabstractproxymodel.h
index a24755b556..000fc8d0ce 100644
--- a/src/widgets/itemviews/qabstractproxymodel.h
+++ b/src/corelib/itemmodels/qabstractproxymodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -48,14 +48,14 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
+QT_MODULE(Core)
#ifndef QT_NO_PROXYMODEL
class QAbstractProxyModelPrivate;
class QItemSelection;
-class Q_WIDGETS_EXPORT QAbstractProxyModel : public QAbstractItemModel
+class Q_CORE_EXPORT QAbstractProxyModel : public QAbstractItemModel
{
Q_OBJECT
diff --git a/src/widgets/itemviews/qabstractproxymodel_p.h b/src/corelib/itemmodels/qabstractproxymodel_p.h
index 9bd38d1cdc..7d6e49a235 100644
--- a/src/widgets/itemviews/qabstractproxymodel_p.h
+++ b/src/corelib/itemmodels/qabstractproxymodel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -60,7 +60,7 @@
QT_BEGIN_NAMESPACE
-class QAbstractProxyModelPrivate : public QAbstractItemModelPrivate
+class Q_CORE_EXPORT QAbstractProxyModelPrivate : public QAbstractItemModelPrivate
{
Q_DECLARE_PUBLIC(QAbstractProxyModel)
public:
diff --git a/src/widgets/itemviews/qidentityproxymodel.cpp b/src/corelib/itemmodels/qidentityproxymodel.cpp
index c891565794..6edb5df0fb 100644
--- a/src/widgets/itemviews/qidentityproxymodel.cpp
+++ b/src/corelib/itemmodels/qidentityproxymodel.cpp
@@ -90,7 +90,7 @@ class QIdentityProxyModelPrivate : public QAbstractProxyModelPrivate
\brief The QIdentityProxyModel class proxies its source model unmodified
\ingroup model-view
- \inmodule QtWidgets
+ \inmodule QtCore
QIdentityProxyModel can be used to forward the structure of a source model exactly, with no sorting, filtering or other transformation.
This is similar in concept to an identity matrix where A.I = A.
diff --git a/src/widgets/itemviews/qidentityproxymodel.h b/src/corelib/itemmodels/qidentityproxymodel.h
index 8a8422244f..9d3c085829 100644
--- a/src/widgets/itemviews/qidentityproxymodel.h
+++ b/src/corelib/itemmodels/qidentityproxymodel.h
@@ -43,7 +43,7 @@
#ifndef QIDENTITYPROXYMODEL_H
#define QIDENTITYPROXYMODEL_H
-#include <QtWidgets/qabstractproxymodel.h>
+#include <QtCore/qabstractproxymodel.h>
#ifndef QT_NO_IDENTITYPROXYMODEL
@@ -51,11 +51,11 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
+QT_MODULE(Core)
class QIdentityProxyModelPrivate;
-class Q_WIDGETS_EXPORT QIdentityProxyModel : public QAbstractProxyModel
+class Q_CORE_EXPORT QIdentityProxyModel : public QAbstractProxyModel
{
Q_OBJECT
public:
diff --git a/src/widgets/itemviews/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp
index 08470a4300..3321735498 100644
--- a/src/widgets/itemviews/qitemselectionmodel.cpp
+++ b/src/corelib/itemmodels/qitemselectionmodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
range of selected items in a model.
\ingroup model-view
- \inmodule QtWidgets
+ \inmodule QtCore
A QItemSelectionRange contains information about a range of
selected items in a model. A range of items is a contiguous array
@@ -331,7 +331,7 @@ QModelIndexList QItemSelectionRange::indexes() const
\brief The QItemSelection class manages information about selected items in a model.
\ingroup model-view
- \inmodule QtWidgets
+ \inmodule QtCore
A QItemSelection describes the items in a model that have been
selected by the user. A QItemSelection is basically a list of
@@ -921,7 +921,7 @@ void QItemSelectionModelPrivate::_q_layoutChanged()
\brief The QItemSelectionModel class keeps track of a view's selected items.
\ingroup model-view
- \inmodule QtWidgets
+ \inmodule QtCore
A QItemSelectionModel keeps track of the selected items in a view, or
in several views onto the same model. It also keeps track of the
diff --git a/src/widgets/itemviews/qitemselectionmodel.h b/src/corelib/itemmodels/qitemselectionmodel.h
index ea0528a590..3b3fa8d1e8 100644
--- a/src/widgets/itemviews/qitemselectionmodel.h
+++ b/src/corelib/itemmodels/qitemselectionmodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -51,11 +51,11 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
+QT_MODULE(Core)
#ifndef QT_NO_ITEMVIEWS
-class Q_WIDGETS_EXPORT QItemSelectionRange
+class Q_CORE_EXPORT QItemSelectionRange
{
public:
@@ -148,7 +148,7 @@ inline QItemSelectionRange::QItemSelectionRange(const QModelIndex &atopLeft,
class QItemSelection;
class QItemSelectionModelPrivate;
-class Q_WIDGETS_EXPORT QItemSelectionModel : public QObject
+class Q_CORE_EXPORT QItemSelectionModel : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QItemSelectionModel)
@@ -229,7 +229,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QItemSelectionModel::SelectionFlags)
// dummy implentation of qHash() necessary for instantiating QList<QItemSelectionRange>::toSet() with MSVC
inline uint qHash(const QItemSelectionRange &) { return 0; }
-class Q_WIDGETS_EXPORT QItemSelection : public QList<QItemSelectionRange>
+class Q_CORE_EXPORT QItemSelection : public QList<QItemSelectionRange>
{
public:
QItemSelection() {}
@@ -244,7 +244,7 @@ public:
};
#ifndef QT_NO_DEBUG_STREAM
-Q_WIDGETS_EXPORT QDebug operator<<(QDebug, const QItemSelectionRange &);
+Q_CORE_EXPORT QDebug operator<<(QDebug, const QItemSelectionRange &);
#endif
#endif // QT_NO_ITEMVIEWS
diff --git a/src/widgets/itemviews/qitemselectionmodel_p.h b/src/corelib/itemmodels/qitemselectionmodel_p.h
index 5eb9ecccda..919c4fab05 100644
--- a/src/widgets/itemviews/qitemselectionmodel_p.h
+++ b/src/corelib/itemmodels/qitemselectionmodel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index f29ad7bc57..3a63c923d3 100644
--- a/src/widgets/itemviews/qsortfilterproxymodel.cpp
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1345,7 +1345,7 @@ void QSortFilterProxyModelPrivate::_q_sourceRowsRemoved(
}
void QSortFilterProxyModelPrivate::_q_sourceRowsAboutToBeMoved(
- const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest)
+ const QModelIndex &sourceParent, int /* sourceStart */, int /* sourceEnd */, const QModelIndex &destParent, int /* dest */)
{
Q_Q(QSortFilterProxyModel);
// Because rows which are contiguous in the source model might not be contiguous
@@ -1367,7 +1367,7 @@ void QSortFilterProxyModelPrivate::_q_sourceRowsAboutToBeMoved(
}
void QSortFilterProxyModelPrivate::_q_sourceRowsMoved(
- const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest)
+ const QModelIndex &sourceParent, int /* sourceStart */, int /* sourceEnd */, const QModelIndex &destParent, int /* dest */)
{
Q_Q(QSortFilterProxyModel);
@@ -1449,7 +1449,7 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsRemoved(
}
void QSortFilterProxyModelPrivate::_q_sourceColumnsAboutToBeMoved(
- const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest)
+ const QModelIndex &sourceParent, int /* sourceStart */, int /* sourceEnd */, const QModelIndex &destParent, int /* dest */)
{
Q_Q(QSortFilterProxyModel);
@@ -1467,7 +1467,7 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsAboutToBeMoved(
}
void QSortFilterProxyModelPrivate::_q_sourceColumnsMoved(
- const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest)
+ const QModelIndex &sourceParent, int /* sourceStart */, int /* sourceEnd */, const QModelIndex &destParent, int /* dest */)
{
Q_Q(QSortFilterProxyModel);
@@ -1496,7 +1496,7 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsMoved(
filtering data passed between another model and a view.
\ingroup model-view
- \inmodule QtWidgets
+ \inmodule QtCore
QSortFilterProxyModel can be used for sorting items, filtering out items,
or both. The model transforms the structure of a source model by mapping
@@ -1528,7 +1528,7 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsMoved(
or vice versa, use mapToSource(), mapFromSource(), mapSelectionToSource(),
and mapSelectionFromSource().
- \note By default, the model does not dynamically re-sort and re-filter data
+ \note By default, the model dynamically re-sorts and re-filters data
whenever the original model changes. This behavior can be changed by
setting the \l{QSortFilterProxyModel::dynamicSortFilter}{dynamicSortFilter}
property.
@@ -1657,7 +1657,7 @@ QSortFilterProxyModel::QSortFilterProxyModel(QObject *parent)
d->sort_localeaware = false;
d->filter_column = 0;
d->filter_role = Qt::DisplayRole;
- d->dynamic_sortfilter = false;
+ d->dynamic_sortfilter = true;
connect(this, SIGNAL(modelReset()), this, SLOT(_q_clearMapping()));
}
@@ -2402,7 +2402,7 @@ void QSortFilterProxyModel::setFilterFixedString(const QString &pattern)
call \l{QSortFilterProxyModel::}{sort()} after adding items to the
QComboBox.
- The default value is false.
+ The default value is true.
*/
bool QSortFilterProxyModel::dynamicSortFilter() const
{
diff --git a/src/widgets/itemviews/qsortfilterproxymodel.h b/src/corelib/itemmodels/qsortfilterproxymodel.h
index bbeec1470c..c8cd581420 100644
--- a/src/widgets/itemviews/qsortfilterproxymodel.h
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,7 +42,7 @@
#ifndef QSORTFILTERPROXYMODEL_H
#define QSORTFILTERPROXYMODEL_H
-#include <QtWidgets/qabstractproxymodel.h>
+#include <QtCore/qabstractproxymodel.h>
#ifndef QT_NO_SORTFILTERPROXYMODEL
@@ -52,13 +52,13 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
+QT_MODULE(Core)
class QSortFilterProxyModelPrivate;
class QSortFilterProxyModelLessThan;
class QSortFilterProxyModelGreaterThan;
-class Q_WIDGETS_EXPORT QSortFilterProxyModel : public QAbstractProxyModel
+class Q_CORE_EXPORT QSortFilterProxyModel : public QAbstractProxyModel
{
friend class QSortFilterProxyModelLessThan;
friend class QSortFilterProxyModelGreaterThan;
diff --git a/src/widgets/itemviews/qstringlistmodel.cpp b/src/corelib/itemmodels/qstringlistmodel.cpp
index 9faaca0dd4..5e72977d20 100644
--- a/src/widgets/itemviews/qstringlistmodel.cpp
+++ b/src/corelib/itemmodels/qstringlistmodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -45,6 +45,8 @@
#include "qstringlistmodel.h"
+#include <QtCore/qvector.h>
+
#ifndef QT_NO_STRINGLISTMODEL
QT_BEGIN_NAMESPACE
@@ -54,7 +56,7 @@ QT_BEGIN_NAMESPACE
\brief The QStringListModel class provides a model that supplies strings to views.
\ingroup model-view
- \inmodule QtWidgets
+ \inmodule QtCore
QStringListModel is an editable model that can be used for simple
cases where you need to display a number of strings in a view
diff --git a/src/widgets/itemviews/qstringlistmodel.h b/src/corelib/itemmodels/qstringlistmodel.h
index 5efed8753e..c70072de9e 100644
--- a/src/widgets/itemviews/qstringlistmodel.h
+++ b/src/corelib/itemmodels/qstringlistmodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,18 +42,18 @@
#ifndef QSTRINGLISTMODEL_H
#define QSTRINGLISTMODEL_H
+#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qstringlist.h>
-#include <QtWidgets/qabstractitemview.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
+QT_MODULE(Core)
#ifndef QT_NO_STRINGLISTMODEL
-class Q_WIDGETS_EXPORT QStringListModel : public QAbstractListModel
+class Q_CORE_EXPORT QStringListModel : public QAbstractListModel
{
Q_OBJECT
public:
diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri
index 8b69d771b7..1139e3074a 100644
--- a/src/corelib/kernel/kernel.pri
+++ b/src/corelib/kernel/kernel.pri
@@ -2,8 +2,6 @@
HEADERS += \
kernel/qabstracteventdispatcher.h \
- kernel/qabstractitemmodel.h \
- kernel/qabstractitemmodel_p.h \
kernel/qbasictimer.h \
kernel/qeventloop.h\
kernel/qpointer.h \
@@ -42,7 +40,6 @@ HEADERS += \
SOURCES += \
kernel/qabstracteventdispatcher.cpp \
- kernel/qabstractitemmodel.cpp \
kernel/qbasictimer.cpp \
kernel/qeventloop.cpp \
kernel/qcoreapplication.cpp \
@@ -102,46 +99,31 @@ nacl {
kernel/qfunctions_nacl.h
}
-unix:!symbian {
- SOURCES += \
- kernel/qcore_unix.cpp \
- kernel/qcrashhandler.cpp \
- kernel/qsharedmemory_unix.cpp \
- kernel/qsystemsemaphore_unix.cpp
- HEADERS += \
- kernel/qcore_unix_p.h \
- kernel/qcrashhandler_p.h
-
- contains(QT_CONFIG, glib) {
- SOURCES += \
- kernel/qeventdispatcher_glib.cpp
- HEADERS += \
- kernel/qeventdispatcher_glib_p.h
- QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB
- LIBS_PRIVATE +=$$QT_LIBS_GLIB
- }
- SOURCES += \
- kernel/qeventdispatcher_unix.cpp
- HEADERS += \
- kernel/qeventdispatcher_unix_p.h
+unix|integrity {
+ SOURCES += \
+ kernel/qcore_unix.cpp \
+ kernel/qcrashhandler.cpp \
+ kernel/qsharedmemory_unix.cpp \
+ kernel/qsystemsemaphore_unix.cpp \
+ kernel/qeventdispatcher_unix.cpp \
+ kernel/qtimerinfo_unix.cpp
- contains(QT_CONFIG, clock-gettime):include($$QT_SOURCE_TREE/config.tests/unix/clock-gettime/clock-gettime.pri)
-}
+ HEADERS += \
+ kernel/qcore_unix_p.h \
+ kernel/qcrashhandler_p.h \
+ kernel/qeventdispatcher_unix_p.h \
+ kernel/qtimerinfo_unix_p.h
-symbian {
+ contains(QT_CONFIG, glib) {
SOURCES += \
- kernel/qcore_unix.cpp \
- kernel/qcrashhandler.cpp \
- kernel/qeventdispatcher_symbian.cpp \
- kernel/qcore_symbian_p.cpp \
- kernel/qsharedmemory_symbian.cpp \
- kernel/qsystemsemaphore_symbian.cpp
-
+ kernel/qeventdispatcher_glib.cpp
HEADERS += \
- kernel/qcore_unix_p.h \
- kernel/qcrashhandler_p.h \
- kernel/qeventdispatcher_symbian_p.h \
- kernel/qcore_symbian_p.h
+ kernel/qeventdispatcher_glib_p.h
+ QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB
+ LIBS_PRIVATE +=$$QT_LIBS_GLIB
+ }
+
+ contains(QT_CONFIG, clock-gettime):include($$QT_SOURCE_TREE/config.tests/unix/clock-gettime/clock-gettime.pri)
}
vxworks {
@@ -151,19 +133,3 @@ vxworks {
kernel/qfunctions_vxworks.h
}
-
-integrity {
- SOURCES += \
- kernel/qcore_unix.cpp \
- kernel/qcrashhandler.cpp \
- kernel/qsharedmemory_unix.cpp \
- kernel/qsystemsemaphore_unix.cpp \
- kernel/qeventdispatcher_unix.cpp
- HEADERS += \
- kernel/qcore_unix_p.h \
- kernel/qcrashhandler_p.h \
- kernel/qeventdispatcher_unix_p.h
-
- contains(QT_CONFIG, clock-gettime):include($$QT_SOURCE_TREE/config.tests/unix/clock-gettime/clock-gettime.pri)
-}
-
diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp
index b936ac4ed2..1d4bf3cf1f 100644
--- a/src/corelib/kernel/qabstracteventdispatcher.cpp
+++ b/src/corelib/kernel/qabstracteventdispatcher.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -96,7 +96,10 @@ int QAbstractEventDispatcherPrivate::allocateTimerId()
void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId)
{
- timerIdFreeList()->release(timerId);
+ // this function may be called by a global destructor after
+ // timerIdFreeList() has been destructed
+ if (QtTimerIdFreeList *fl = timerIdFreeList())
+ fl->release(timerId);
}
/*!
@@ -230,22 +233,39 @@ QAbstractEventDispatcher *QAbstractEventDispatcher::instance(QThread *thread)
*/
/*!
+ \obsolete
+
\fn int QAbstractEventDispatcher::registerTimer(int interval, QObject *object)
- Registers a timer with the specified \a interval for the given \a object.
+ Registers a timer with the specified \a interval for the given \a object
+ and returns the timer id.
+*/
+
+/*!
+ \obsolete
+
+ \fn void QAbstractEventDispatcher::registerTimer(int timerId, int interval, QObject *object)
+
+ Register a timer with the specified \a timerId and \a interval for the
+ given \a object.
+*/
+
+/*!
+ Registers a timer with the specified \a interval and \a timerType for the
+ given \a object and returns the timer id.
*/
-int QAbstractEventDispatcher::registerTimer(int interval, QObject *object)
+int QAbstractEventDispatcher::registerTimer(int interval, Qt::TimerType timerType, QObject *object)
{
int id = QAbstractEventDispatcherPrivate::allocateTimerId();
- registerTimer(id, interval, object);
+ registerTimer(id, interval, timerType, object);
return id;
}
/*!
- \fn void QAbstractEventDispatcher::registerTimer(int timerId, int interval, QObject *object)
+ \fn void QAbstractEventDispatcher::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object)
- Register a timer with the specified \a timerId and \a interval for
- the given \a object.
+ Register a timer with the specified \a timerId, \a interval, and \a
+ timerType for the given \a object.
*/
/*!
@@ -269,8 +289,10 @@ int QAbstractEventDispatcher::registerTimer(int interval, QObject *object)
/*!
\fn QList<TimerInfo> QAbstractEventDispatcher::registeredTimers(QObject *object) const
- Returns a list of registered timers for \a object. The timer ID
- is the first member in each pair; the interval is the second.
+ Returns a list of registered timers for \a object. The TimerInfo struct has
+ \c timerId, \c interval, and \c timerType members.
+
+ \sa Qt::TimerType
*/
/*! \fn void QAbstractEventDispatcher::wakeUp()
diff --git a/src/corelib/kernel/qabstracteventdispatcher.h b/src/corelib/kernel/qabstracteventdispatcher.h
index 36bd1be368..80e77c02af 100644
--- a/src/corelib/kernel/qabstracteventdispatcher.h
+++ b/src/corelib/kernel/qabstracteventdispatcher.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -53,7 +53,6 @@ QT_MODULE(Core)
class QAbstractEventDispatcherPrivate;
class QSocketNotifier;
-template <typename T1, typename T2> struct QPair;
class Q_CORE_EXPORT QAbstractEventDispatcher : public QObject
{
@@ -61,7 +60,16 @@ class Q_CORE_EXPORT QAbstractEventDispatcher : public QObject
Q_DECLARE_PRIVATE(QAbstractEventDispatcher)
public:
- typedef QPair<int, int> TimerInfo;
+ struct TimerInfo
+ {
+ int timerId;
+ int interval;
+ Qt::TimerType timerType;
+
+ inline TimerInfo(int id, int i, Qt::TimerType t)
+ : timerId(id), interval(i), timerType(t)
+ { }
+ };
explicit QAbstractEventDispatcher(QObject *parent = 0);
~QAbstractEventDispatcher();
@@ -74,8 +82,14 @@ public:
virtual void registerSocketNotifier(QSocketNotifier *notifier) = 0;
virtual void unregisterSocketNotifier(QSocketNotifier *notifier) = 0;
- int registerTimer(int interval, QObject *object);
- virtual void registerTimer(int timerId, int interval, QObject *object) = 0;
+#if QT_DEPRECATED_SINCE(5,0)
+ QT_DEPRECATED inline int registerTimer(int interval, QObject *object)
+ { return registerTimer(interval, Qt::CoarseTimer, object); }
+ QT_DEPRECATED inline void registerTimer(int timerId, int interval, QObject *object)
+ { registerTimer(timerId, interval, Qt::CoarseTimer, object); }
+#endif
+ int registerTimer(int interval, Qt::TimerType timerType, QObject *object);
+ virtual void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object) = 0;
virtual bool unregisterTimer(int timerId) = 0;
virtual bool unregisterTimers(QObject *object) = 0;
virtual QList<TimerInfo> registeredTimers(QObject *object) const = 0;
diff --git a/src/corelib/kernel/qabstracteventdispatcher_p.h b/src/corelib/kernel/qabstracteventdispatcher_p.h
index 31c579d865..6e1c81ae33 100644
--- a/src/corelib/kernel/qabstracteventdispatcher_p.h
+++ b/src/corelib/kernel/qabstracteventdispatcher_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qbasictimer.cpp b/src/corelib/kernel/qbasictimer.cpp
index 8efeea6fae..a52152875f 100644
--- a/src/corelib/kernel/qbasictimer.cpp
+++ b/src/corelib/kernel/qbasictimer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -40,8 +40,8 @@
****************************************************************************/
#include "qbasictimer.h"
-#include "qcoreapplication.h"
#include "qabstracteventdispatcher.h"
+#include "qabstracteventdispatcher_p.h"
QT_BEGIN_NAMESPACE
@@ -106,18 +106,55 @@ QT_BEGIN_NAMESPACE
/*!
\fn void QBasicTimer::start(int msec, QObject *object)
- Starts (or restarts) the timer with a \a msec milliseconds
- timeout.
+ Starts (or restarts) the timer with a \a msec milliseconds timeout. The
+ timer will be a Qt::CoarseTimer. See Qt::TimerType for information on the
+ different timer types.
The given \a object will receive timer events.
- \sa stop() isActive() QObject::timerEvent()
+ \sa stop() isActive() QObject::timerEvent() Qt::CoarseTimer
*/
void QBasicTimer::start(int msec, QObject *obj)
{
- stop();
- if (obj)
- id = obj->startTimer(msec);
+ QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance();
+ if (!eventDispatcher) {
+ qWarning("QBasicTimer::start: QBasicTimer can only be used with threads started with QThread");
+ return;
+ }
+ if (id) {
+ eventDispatcher->unregisterTimer(id);
+ QAbstractEventDispatcherPrivate::releaseTimerId(id);
+ }
+ id = 0;
+ if (obj)
+ id = eventDispatcher->registerTimer(msec, Qt::CoarseTimer, obj);
+}
+
+/*!
+ \overload
+
+ Starts (or restarts) the timer with a \a msec milliseconds timeout and the
+ given \a timerType. See Qt::TimerType for information on the different
+ timer types.
+
+ The given \a object will receive timer events.
+
+ \sa stop() isActive() QObject::timerEvent() Qt::TimerType
+ */
+void QBasicTimer::start(int msec, Qt::TimerType timerType, QObject *obj)
+{
+ QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance();
+ if (!eventDispatcher) {
+ qWarning("QBasicTimer::start: QBasicTimer can only be used with threads started with QThread");
+ return;
+ }
+ if (id) {
+ eventDispatcher->unregisterTimer(id);
+ QAbstractEventDispatcherPrivate::releaseTimerId(id);
+ }
+ id = 0;
+ if (obj)
+ id = eventDispatcher->registerTimer(msec, timerType, obj);
}
/*!
@@ -131,6 +168,7 @@ void QBasicTimer::stop()
QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance();
if (eventDispatcher)
eventDispatcher->unregisterTimer(id);
+ QAbstractEventDispatcherPrivate::releaseTimerId(id);
}
id = 0;
}
diff --git a/src/corelib/kernel/qbasictimer.h b/src/corelib/kernel/qbasictimer.h
index f13848cb85..84b232e766 100644
--- a/src/corelib/kernel/qbasictimer.h
+++ b/src/corelib/kernel/qbasictimer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -43,6 +43,7 @@
#define QBASICTIMER_H
#include <QtCore/qglobal.h>
+#include <QtCore/qnamespace.h>
QT_BEGIN_HEADER
@@ -63,6 +64,7 @@ public:
inline int timerId() const { return id; }
void start(int msec, QObject *obj);
+ void start(int msec, Qt::TimerType timerType, QObject *obj);
void stop();
};
Q_DECLARE_TYPEINFO(QBasicTimer, Q_MOVABLE_TYPE);
diff --git a/src/corelib/kernel/qcore_mac.cpp b/src/corelib/kernel/qcore_mac.cpp
index 0814c1aec7..88cc83ce48 100644
--- a/src/corelib/kernel/qcore_mac.cpp
+++ b/src/corelib/kernel/qcore_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
index adbad83cad..4efd6bf653 100644
--- a/src/corelib/kernel/qcore_mac_p.h
+++ b/src/corelib/kernel/qcore_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp
deleted file mode 100644
index 5b52ec22a1..0000000000
--- a/src/corelib/kernel/qcore_symbian_p.cpp
+++ /dev/null
@@ -1,317 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <exception>
-#include <e32base.h>
-#include <e32uid.h>
-#include "qcore_symbian_p.h"
-#include <string>
-#include <in_sock.h>
-
-QT_BEGIN_NAMESPACE
-
-/*
- Helper function for calling into Symbian classes that expect a TDes&.
- This function converts a QString to a TDes by allocating memory that
- must be deleted by the caller.
-*/
-
-Q_CORE_EXPORT HBufC* qt_QString2HBufC(const QString& aString)
-{
- HBufC *buffer;
-#ifdef QT_NO_UNICODE
- TPtrC8 ptr(reinterpret_cast<const TUint8*>(aString.toLocal8Bit().constData()));
-#else
- TPtrC16 ptr(qt_QString2TPtrC(aString));
-#endif
- buffer = HBufC::New(ptr.Length());
- Q_CHECK_PTR(buffer);
- buffer->Des().Copy(ptr);
- return buffer;
-}
-
-Q_CORE_EXPORT QString qt_TDesC2QString(const TDesC& aDescriptor)
-{
-#ifdef QT_NO_UNICODE
- return QString::fromLocal8Bit(aDescriptor.Ptr(), aDescriptor.Length());
-#else
- return QString(reinterpret_cast<const QChar *>(aDescriptor.Ptr()), aDescriptor.Length());
-#endif
-}
-
-QHBufC::QHBufC()
- : m_hBufC(0)
-{
-}
-
-QHBufC::QHBufC(const QHBufC &src)
- : m_hBufC(src.m_hBufC->Alloc())
-{
- Q_CHECK_PTR(m_hBufC);
-}
-
-/*!
- \internal
- Constructs a QHBufC from an HBufC. Note that the QHBufC instance takes
- ownership of the HBufC.
-*/
-QHBufC::QHBufC(HBufC *src)
- : m_hBufC(src)
-{
-}
-
-QHBufC::QHBufC(const QString &src)
-{
- m_hBufC = qt_QString2HBufC(src);
-}
-
-QHBufC::~QHBufC()
-{
- if (m_hBufC)
- delete m_hBufC;
-}
-
-class QS60PluginResolver
-{
-public:
- QS60PluginResolver()
- : initTried(false) {}
-
- ~QS60PluginResolver() {
- lib.Close();
- }
-
- TLibraryFunction resolve(int ordinal) {
- if (!initTried) {
- init();
- initTried = true;
- }
-
- if (lib.Handle())
- return lib.Lookup(ordinal);
- else
- return reinterpret_cast<TLibraryFunction>(NULL);
- }
-
-private:
- void init()
- {
- _LIT(KLibName_3_1, "qts60plugin_3_1" QT_LIBINFIX_UNICODE L".dll");
- _LIT(KLibName_3_2, "qts60plugin_3_2" QT_LIBINFIX_UNICODE L".dll");
- _LIT(KLibName_5_0, "qts60plugin_5_0" QT_LIBINFIX_UNICODE L".dll");
-
- TPtrC libName;
- TInt uidValue;
- switch (QSysInfo::s60Version()) {
- case QSysInfo::SV_S60_3_1:
- libName.Set(KLibName_3_1);
- uidValue = 0x2001E620;
- break;
- case QSysInfo::SV_S60_3_2:
- libName.Set(KLibName_3_2);
- uidValue = 0x2001E621;
- break;
- case QSysInfo::SV_S60_5_0: // Fall through to default
- default:
- // Default to 5.0 version, as any unknown platform is likely to be newer than that
- libName.Set(KLibName_5_0);
- uidValue = 0x2001E622;
- break;
- }
-
- TUidType libUid(KDynamicLibraryUid, KSharedLibraryUid, TUid::Uid(uidValue));
- lib.Load(libName, libUid);
-
- // Duplicate lib handle to enable process wide access to it. Since Duplicate overwrites
- // existing handle without closing it, store original for subsequent closing.
- RLibrary origHandleCloser = lib;
- lib.Duplicate(RThread(), EOwnerProcess);
- origHandleCloser.Close();
- }
-
- RLibrary lib;
- bool initTried;
-};
-
-Q_GLOBAL_STATIC(QS60PluginResolver, qt_s60_plugin_resolver);
-
-/*!
- \internal
- Resolves a platform version specific function from S60 plugin.
- If plugin is missing or resolving fails for another reason, NULL is returned.
-*/
-Q_CORE_EXPORT TLibraryFunction qt_resolveS60PluginFunc(int ordinal)
-{
- return qt_s60_plugin_resolver()->resolve(ordinal);
-}
-
-class QS60RFsSession
-{
-public:
- QS60RFsSession() {
- qt_symbian_throwIfError(iFs.Connect());
- qt_symbian_throwIfError(iFs.ShareProtected());
- }
-
- ~QS60RFsSession() {
- iFs.Close();
- }
-
- RFs& GetRFs() {
- return iFs;
- }
-
-private:
-
- RFs iFs;
-};
-
-uint qHash(const RSubSessionBase& key)
-{
- return qHash(key.SubSessionHandle());
-}
-
-Q_GLOBAL_STATIC(QS60RFsSession, qt_s60_RFsSession);
-
-Q_CORE_EXPORT RFs& qt_s60GetRFs()
-{
- return qt_s60_RFsSession()->GetRFs();
-}
-
-QSymbianSocketManager::QSymbianSocketManager() :
- iNextSocket(0), iDefaultConnection(0)
-{
- TSessionPref preferences;
- // ### In future this could be changed to KAfInet6 when that is more common than IPv4
- preferences.iAddrFamily = KAfInet;
- preferences.iProtocol = KProtocolInetIp;
- //use global message pool, as we do not know how many sockets app will use
- //TODO: is this the right choice?
- qt_symbian_throwIfError(iSocketServ.Connect(preferences, -1));
- qt_symbian_throwIfError(iSocketServ.ShareAuto());
-}
-
-QSymbianSocketManager::~QSymbianSocketManager()
-{
- iSocketServ.Close();
- if(!socketMap.isEmpty()) {
- qWarning("leaked %d sockets on exit", socketMap.count());
- }
-}
-
-RSocketServ& QSymbianSocketManager::getSocketServer() {
- return iSocketServ;
-}
-
-int QSymbianSocketManager::addSocket(const RSocket& socket) {
- QHashableSocket sock(static_cast<const QHashableSocket &>(socket));
- QMutexLocker l(&iMutex);
- Q_ASSERT(!socketMap.contains(sock));
- if(socketMap.contains(sock))
- return socketMap.value(sock);
- // allocate socket number
- int guard = 0;
- while(reverseSocketMap.contains(iNextSocket)) {
- iNextSocket++;
- iNextSocket %= max_sockets;
- guard++;
- if(guard > max_sockets)
- return -1;
- }
- int id = iNextSocket;
-
- socketMap[sock] = id;
- reverseSocketMap[id] = sock;
- return id + socket_offset;
-}
-
-bool QSymbianSocketManager::removeSocket(const RSocket &socket) {
- QHashableSocket sock(static_cast<const QHashableSocket &>(socket));
- QMutexLocker l(&iMutex);
- if(!socketMap.contains(sock))
- return false;
- int id = socketMap.value(sock);
- socketMap.remove(sock);
- reverseSocketMap.remove(id);
- return true;
-}
-
-int QSymbianSocketManager::lookupSocket(const RSocket& socket) const {
- QHashableSocket sock(static_cast<const QHashableSocket &>(socket));
- QMutexLocker l(&iMutex);
- if(!socketMap.contains(sock))
- return -1;
- int id = socketMap.value(sock);
- return id + socket_offset;
-}
-
-bool QSymbianSocketManager::lookupSocket(int fd, RSocket& socket) const {
- QMutexLocker l(&iMutex);
- int id = fd - socket_offset;
- if(!reverseSocketMap.contains(id))
- return false;
- socket = reverseSocketMap.value(id);
- return true;
-}
-
-void QSymbianSocketManager::setDefaultConnection(RConnection* con)
-{
- iDefaultConnection = con;
-}
-
-RConnection* QSymbianSocketManager::defaultConnection() const
-{
- return iDefaultConnection;
-}
-
-Q_GLOBAL_STATIC(QSymbianSocketManager, qt_symbianSocketManager);
-
-QSymbianSocketManager& QSymbianSocketManager::instance()
-{
- return *(qt_symbianSocketManager());
-}
-
-Q_CORE_EXPORT RSocketServ& qt_symbianGetSocketServer()
-{
- return QSymbianSocketManager::instance().getSocketServer();
-}
-
-QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qcore_symbian_p.h b/src/corelib/kernel/qcore_symbian_p.h
deleted file mode 100644
index 84c6fed4db..0000000000
--- a/src/corelib/kernel/qcore_symbian_p.h
+++ /dev/null
@@ -1,282 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCORE_SYMBIAN_P_H
-#define QCORE_SYMBIAN_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <e32std.h>
-#include <QtCore/qglobal.h>
-#include <QtCore/qmutex.h>
-#include <qstring.h>
-#include <qrect.h>
-#include <qhash.h>
-#include <f32file.h>
-#include <es_sock.h>
-
-#define QT_LSTRING2(x) L##x
-#define QT_LSTRING(x) QT_LSTRING2(x)
-
-#if defined(QT_LIBINFIX)
-# define QT_LIBINFIX_UNICODE QT_LSTRING(QT_LIBINFIX)
-#else
-# define QT_LIBINFIX_UNICODE L""
-#endif
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-Q_CORE_EXPORT HBufC* qt_QString2HBufC(const QString& aString);
-
-Q_CORE_EXPORT QString qt_TDesC2QString(const TDesC& aDescriptor);
-inline QString qt_TDes2QString(const TDes& aDescriptor) { return qt_TDesC2QString(aDescriptor); }
-
-static inline QSize qt_TSize2QSize(const TSize& ts)
-{
- return QSize(ts.iWidth, ts.iHeight);
-}
-
-static inline TSize qt_QSize2TSize(const QSize& qs)
-{
- return TSize(qs.width(), qs.height());
-}
-
-static inline QRect qt_TRect2QRect(const TRect& tr)
-{
- return QRect(tr.iTl.iX, tr.iTl.iY, tr.Width(), tr.Height());
-}
-
-static inline TRect qt_QRect2TRect(const QRect& qr)
-{
- return TRect(TPoint(qr.left(), qr.top()), TSize(qr.width(), qr.height()));
-}
-
-// Returned TPtrC is valid as long as the given parameter is valid and unmodified
-static inline TPtrC qt_QString2TPtrC( const QString& string )
-{
- return TPtrC16(static_cast<const TUint16*>(string.utf16()), string.length());
-}
-
-/*!
- \internal
- This class is a wrapper around the Symbian HBufC descriptor class.
- It makes sure that the heap allocated HBufC class is freed when it is
- destroyed.
-*/
-class Q_CORE_EXPORT QHBufC
-{
-public:
- QHBufC();
- QHBufC(const QHBufC &src);
- QHBufC(HBufC *src);
- QHBufC(const QString &src);
- ~QHBufC();
-
- inline operator HBufC *() { return m_hBufC; }
- inline operator const HBufC *() const { return m_hBufC; }
- inline HBufC *data() { return m_hBufC; }
- inline const HBufC *data() const { return m_hBufC; }
- inline HBufC & operator*() { return *m_hBufC; }
- inline const HBufC & operator*() const { return *m_hBufC; }
- inline HBufC * operator->() { return m_hBufC; }
- inline const HBufC * operator->() const { return m_hBufC; }
-
- inline bool operator==(const QHBufC &param) const { return data() == param.data(); }
- inline bool operator!=(const QHBufC &param) const { return data() != param.data(); }
-
-private:
- HBufC *m_hBufC;
-};
-
-inline uint qHash(TUid uid)
-{
- return qHash(uid.iUid);
-}
-
-// S60 version specific function ordinals that can be resolved
-enum S60PluginFuncOrdinals
-{
- S60Plugin_TimeFormatL = 1,
- S60Plugin_GetTimeFormatSpec = 2,
- S60Plugin_GetLongDateFormatSpec = 3,
- S60Plugin_GetShortDateFormatSpec = 4,
- S60Plugin_LocalizedDirectoryName = 5,
- S60Plugin_GetSystemDrive = 6
-};
-
-Q_CORE_EXPORT TLibraryFunction qt_resolveS60PluginFunc(int ordinal);
-
-Q_CORE_EXPORT RFs& qt_s60GetRFs();
-Q_CORE_EXPORT RSocketServ& qt_symbianGetSocketServer();
-
-// Defined in qlocale_symbian.cpp.
-Q_CORE_EXPORT QByteArray qt_symbianLocaleName(int code);
-
-template <typename R>
-struct QScopedPointerRCloser
-{
- static inline void cleanup(R *rPointer)
- {
- // Enforce a complete type.
- // If you get a compile error here, read the section on forward declared
- // classes in the QScopedPointer documentation.
- typedef char IsIncompleteType[ sizeof(R) ? 1 : -1 ];
- (void) sizeof(IsIncompleteType);
-
- if (rPointer)
- rPointer->Close();
- }
-};
-
-//Wrapper for RSocket so it can be used as a key in QHash or QMap
-class QHashableSocket : public RSocket
-{
-public:
- bool operator==(const QHashableSocket &other) const
- {
- return SubSessionHandle() == other.SubSessionHandle()
- && Session().Handle() == other.Session().Handle();
- }
- bool operator<(const QHashableSocket &other) const
- {
- if (Session().Handle() == other.Session().Handle())
- return SubSessionHandle() < other.SubSessionHandle();
- return Session().Handle() < other.Session().Handle();
- }
-};
-
-uint qHash(const RSubSessionBase& key);
-
-/*!
- \internal
- This class exists in QtCore for the benefit of QSocketNotifier, which uses integer
- file descriptors in its public API.
- So we need a way to map between int and RSocket.
- Additionally, it is used to host the global RSocketServ session
-*/
-class Q_CORE_EXPORT QSymbianSocketManager
-{
-public:
- QSymbianSocketManager();
- ~QSymbianSocketManager();
-
- /*!
- \internal
- \return handle to the socket server
- */
- RSocketServ& getSocketServer();
- /*!
- \internal
- Adds a symbian socket to the global map
- \param an open socket
- \return pseudo file descriptor, -1 if out of resources
- */
- int addSocket(const RSocket &sock);
- /*!
- \internal
- Removes a symbian socket from the global map
- \param an open socket
- \return true if the socket was in the map
- */
- bool removeSocket(const RSocket &sock);
- /*!
- \internal
- Get pseudo file descriptor for a socket
- \param an open socket
- \return integer handle, or -1 if not in map
- */
- int lookupSocket(const RSocket &sock) const;
- /*!
- \internal
- Get socket for a pseudo file descriptor
- \param an open socket fd
- \param sock (out) socket handle
- \return true on success or false if not in map
- */
- bool lookupSocket(int fd, RSocket& sock) const;
-
- /*!
- \internal
- Set the default connection to use for new sockets
- \param an open connection
- */
- void setDefaultConnection(RConnection* con);
- /*!
- \internal
- Get the default connection to use for new sockets
- \return the connection, or null pointer if there is none set
- */
- RConnection *defaultConnection() const;
-
- /*!
- \internal
- Gets a reference to the singleton socket manager
- */
- static QSymbianSocketManager& instance();
-private:
- int allocateSocket();
-
- const static int max_sockets = 0x20000; //covers all TCP and UDP ports, probably run out of memory first
- const static int socket_offset = 0x40000000; //hacky way of separating sockets from file descriptors
- int iNextSocket;
- QHash<QHashableSocket, int> socketMap;
- QHash<int, RSocket> reverseSocketMap;
- mutable QMutex iMutex;
- RSocketServ iSocketServ;
- RConnection *iDefaultConnection;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif //QCORE_SYMBIAN_P_H
diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp
index f30fceeb68..08a2f69bf3 100644
--- a/src/corelib/kernel/qcore_unix.cpp
+++ b/src/corelib/kernel/qcore_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h
index e7259d29c9..9ac4f5c480 100644
--- a/src/corelib/kernel/qcore_unix_p.h
+++ b/src/corelib/kernel/qcore_unix_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 7ff82b1bca..05f26cc87f 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -143,7 +143,7 @@ static inline void qt_init_symbian_apa_arguments(int &argc, char **&argv)
TPtrC8 apaCmdLine = commandLine->TailEnd();
int tailLen = apaCmdLine.Length();
if (tailLen) {
- apaTail = reinterpret_cast<char *>(qMalloc(tailLen + 1));
+ apaTail = reinterpret_cast<char *>(malloc(tailLen + 1));
qMemCopy(apaTail, reinterpret_cast<const char *>(apaCmdLine.Ptr()), tailLen);
apaTail[tailLen] = '\0';
apaArgv = new QVector<char *>(8);
@@ -300,7 +300,7 @@ Q_CORE_EXPORT uint qGlobalPostedEventsCount()
QCoreApplication *QCoreApplication::self = 0;
QAbstractEventDispatcher *QCoreApplicationPrivate::eventDispatcher = 0;
-uint QCoreApplicationPrivate::attribs;
+uint QCoreApplicationPrivate::attribs = (1 << Qt::AA_SynthesizeMouseForUnhandledTouchEvents);
#ifdef Q_OS_UNIX
Qt::HANDLE qt_application_thread_id = 0;
@@ -802,26 +802,7 @@ bool QCoreApplication::notifyInternal(QObject *receiver, QEvent *event)
QObjectPrivate *d = receiver->d_func();
QThreadData *threadData = d->threadData;
QScopedLoopLevelCounter loopLevelCounter(threadData);
-
-#ifdef QT_JAMBI_BUILD
- int deleteWatch = 0;
- int *oldDeleteWatch = QObjectPrivate::setDeleteWatch(d, &deleteWatch);
-
- bool inEvent = d->inEventHandler;
- d->inEventHandler = true;
-#endif
-
- bool returnValue;
- returnValue = notify(receiver, event);
-
-#ifdef QT_JAMBI_BUILD
- // Restore the previous state if the object was not deleted..
- if (!deleteWatch) {
- d->inEventHandler = inEvent;
- }
- QObjectPrivate::resetDeleteWatch(d, oldDeleteWatch, deleteWatch);
-#endif
- return returnValue;
+ return notify(receiver, event);
}
@@ -1424,9 +1405,18 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type
if (!allowDeferredDelete) {
// cannot send deferred delete
if (!event_type && !receiver) {
- // don't lose the event
- data->postEventList.addEvent(pe);
+ // we must copy it first; we want to re-post the event
+ // with the event pointer intact, but we can't delay
+ // nulling the event ptr until after re-posting, as
+ // addEvent may invalidate pe.
+ QPostEvent pe_copy = pe;
+
+ // null out the event so if sendPostedEvents recurses, it
+ // will ignore this one, as it's been re-posted.
const_cast<QPostEvent &>(pe).event = 0;
+
+ // re-post the copied event so it isn't lost
+ data->postEventList.addEvent(pe_copy);
}
continue;
}
@@ -1528,7 +1518,7 @@ void QCoreApplication::removePostedEvents(QObject *receiver, int eventType)
const_cast<QPostEvent &>(pe).event = 0;
} else if (!data->postEventList.recursion) {
if (i != j)
- data->postEventList.swap(i, j);
+ qSwap(data->postEventList[i], data->postEventList[j]);
++j;
}
}
@@ -1842,9 +1832,9 @@ bool QCoreApplicationPrivate::isTranslatorInstalled(QTranslator *translator)
/*!
Returns the directory that contains the application executable.
- For example, if you have installed Qt in the \c{C:\Trolltech\Qt}
+ For example, if you have installed Qt in the \c{C:\Qt}
directory, and you run the \c{regexp} example, this function will
- return "C:/Trolltech/Qt/examples/tools/regexp".
+ return "C:/Qt/examples/tools/regexp".
On Mac OS X this will point to the directory actually containing the
executable, which may be inside of an application bundle (if the
@@ -2587,6 +2577,14 @@ void QCoreApplication::setEventDispatcher(QAbstractEventDispatcher *eventDispatc
\sa Q_OBJECT, QObject::tr(), QObject::trUtf8()
*/
+/*!
+ \enum QCoreApplication::Type
+
+ \value Tty a console application
+ \value GuiClient a GUI application
+ \value GuiServer \e{Deprecated.} this value is only left for compatibility.
+*/
+
QT_END_NAMESPACE
#include "moc_qcoreapplication.cpp"
diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h
index 3d6aa170fd..abbc6e5821 100644
--- a/src/corelib/kernel/qcoreapplication.h
+++ b/src/corelib/kernel/qcoreapplication.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -78,6 +78,12 @@ public:
enum { ApplicationFlags = QT_VERSION
};
+ enum Type {
+ Tty,
+ GuiClient,
+ GuiServer // # deprecated
+ };
+
QCoreApplication(int &argc, char **argv, int = ApplicationFlags);
~QCoreApplication();
diff --git a/src/corelib/kernel/qcoreapplication_mac.cpp b/src/corelib/kernel/qcoreapplication_mac.cpp
index 8fec4bfcb2..289c2f4bdb 100644
--- a/src/corelib/kernel/qcoreapplication_mac.cpp
+++ b/src/corelib/kernel/qcoreapplication_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index d61a5a1bf5..692e460114 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp
index 1b51e6f568..3cba628a41 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qcorecmdlineargs_p.h b/src/corelib/kernel/qcorecmdlineargs_p.h
index 2081d5cc17..937c9898cd 100644
--- a/src/corelib/kernel/qcorecmdlineargs_p.h
+++ b/src/corelib/kernel/qcorecmdlineargs_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index 213f0e4a58..bf8207283b 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -108,7 +108,6 @@ QT_BEGIN_NAMESPACE
\value ApplicationPaletteChange The default application palette has changed.
\value ApplicationWindowIconChange The application's icon has changed.
\value ChildAdded An object gets a child (QChildEvent).
- \value ChildInserted An object gets a child (QChildEvent). Qt3Support only, use ChildAdded instead.
\value ChildPolished A widget child gets polished (QChildEvent).
\value ChildRemoved An object loses a child (QChildEvent).
\value Clipboard The clipboard contents have changed (QClipboardEvent).
@@ -252,8 +251,6 @@ QT_BEGIN_NAMESPACE
\omitvalue AcceptDropsChange
\omitvalue ActivateControl
\omitvalue CaptionChange
- \omitvalue ChildInsertedRequest
- \omitvalue ChildInserted
\omitvalue Create
\omitvalue DeactivateControl
\omitvalue Destroy
diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h
index ba1106276a..cbdf13c992 100644
--- a/src/corelib/kernel/qcoreevent.h
+++ b/src/corelib/kernel/qcoreevent.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -185,9 +185,6 @@ public:
HoverLeave = 128, // mouse cursor leaves a hover widget
HoverMove = 129, // mouse cursor move inside a hover widget
- AccessibilityHelp = 119, // accessibility help text request
- AccessibilityDescription = 130, // accessibility description text request
-
// last event id used = 132
#ifdef QT_KEYPAD_NAVIGATION
diff --git a/src/corelib/kernel/qcoreglobaldata.cpp b/src/corelib/kernel/qcoreglobaldata.cpp
index bac95251fd..3854f7d53a 100644
--- a/src/corelib/kernel/qcoreglobaldata.cpp
+++ b/src/corelib/kernel/qcoreglobaldata.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qcoreglobaldata_p.h b/src/corelib/kernel/qcoreglobaldata_p.h
index f12d42842b..7b5120a0dc 100644
--- a/src/corelib/kernel/qcoreglobaldata_p.h
+++ b/src/corelib/kernel/qcoreglobaldata_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qcrashhandler.cpp b/src/corelib/kernel/qcrashhandler.cpp
index 979e215997..8f4577be24 100644
--- a/src/corelib/kernel/qcrashhandler.cpp
+++ b/src/corelib/kernel/qcrashhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qcrashhandler_p.h b/src/corelib/kernel/qcrashhandler_p.h
index 2383bb9dcc..a23dc98967 100644
--- a/src/corelib/kernel/qcrashhandler_p.h
+++ b/src/corelib/kernel/qcrashhandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index 0773915391..f34570007b 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -509,7 +509,7 @@ void QEventDispatcherGlib::unregisterSocketNotifier(QSocketNotifier *notifier)
}
}
-void QEventDispatcherGlib::registerTimer(int timerId, int interval, QObject *object)
+void QEventDispatcherGlib::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object)
{
#ifndef QT_NO_DEBUG
if (timerId < 1 || interval < 0 || !object) {
@@ -522,7 +522,7 @@ void QEventDispatcherGlib::registerTimer(int timerId, int interval, QObject *obj
#endif
Q_D(QEventDispatcherGlib);
- d->timerSource->timerList.registerTimer(timerId, interval, object);
+ d->timerSource->timerList.registerTimer(timerId, interval, timerType, object);
}
bool QEventDispatcherGlib::unregisterTimer(int timerId)
diff --git a/src/corelib/kernel/qeventdispatcher_glib_p.h b/src/corelib/kernel/qeventdispatcher_glib_p.h
index 419f2f3dc0..facacb07a8 100644
--- a/src/corelib/kernel/qeventdispatcher_glib_p.h
+++ b/src/corelib/kernel/qeventdispatcher_glib_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -80,7 +80,7 @@ public:
void registerSocketNotifier(QSocketNotifier *socketNotifier);
void unregisterSocketNotifier(QSocketNotifier *socketNotifier);
- void registerTimer(int timerId, int interval, QObject *object);
+ void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object);
bool unregisterTimer(int timerId);
bool unregisterTimers(QObject *object);
QList<TimerInfo> registeredTimers(QObject *object) const;
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp
deleted file mode 100644
index 1d7ecce9ae..0000000000
--- a/src/corelib/kernel/qeventdispatcher_symbian.cpp
+++ /dev/null
@@ -1,1316 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qeventdispatcher_symbian_p.h"
-#include <private/qthread_p.h>
-#include <qcoreapplication.h>
-#include <private/qcoreapplication_p.h>
-#include <qsemaphore.h>
-
-#include <unistd.h>
-#include <errno.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
-// when the system UI is Qt based, priority drop is not needed as CPU starved processes will not be killed.
-#undef QT_SYMBIAN_PRIORITY_DROP
-#else
-#define QT_SYMBIAN_PRIORITY_DROP
-#endif
-
-#define WAKE_UP_PRIORITY CActive::EPriorityStandard
-#define TIMER_PRIORITY CActive::EPriorityHigh
-#define NULLTIMER_PRIORITY CActive::EPriorityLow
-#define COMPLETE_DEFERRED_ACTIVE_OBJECTS_PRIORITY CActive::EPriorityIdle
-
-static inline int qt_pipe_write(int socket, const char *data, qint64 len)
-{
- return ::write(socket, data, len);
-}
-#if defined(write)
-# undef write
-#endif
-
-static inline int qt_pipe_close(int socket)
-{
- return ::close(socket);
-}
-#if defined(close)
-# undef close
-#endif
-
-static inline int qt_pipe_fcntl(int socket, int command)
-{
- return ::fcntl(socket, command);
-}
-static inline int qt_pipe2_fcntl(int socket, int command, int option)
-{
- return ::fcntl(socket, command, option);
-}
-#if defined(fcntl)
-# undef fcntl
-#endif
-
-static inline int qt_socket_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
-{
- return ::select(nfds, readfds, writefds, exceptfds, timeout);
-}
-
-// This simply interrupts the select and locks the mutex until destroyed.
-class QSelectMutexGrabber
-{
-public:
- QSelectMutexGrabber(int writeFd, int readFd, QMutex *mutex)
- : m_mutex(mutex)
- {
- if (m_mutex->tryLock())
- return;
-
- char dummy = 0;
- qt_pipe_write(writeFd, &dummy, 1);
-
- m_mutex->lock();
-
- char buffer;
- while (::read(readFd, &buffer, 1) > 0) {}
- }
-
- ~QSelectMutexGrabber()
- {
- m_mutex->unlock();
- }
-
-private:
- QMutex *m_mutex;
-};
-
-/*
- * This class is designed to aid in implementing event handling in a more round robin fashion. We
- * cannot change active objects that we do not own, but the active objects that Qt owns will use
- * this as a base class with convenience functions.
- *
- * Here is how it works: On every RunL, the deriving class should call maybeQueueForLater().
- * This will return whether the active object has been queued, or whether it should run immediately.
- * Queued objects will run again after other events have been processed.
- *
- * The QCompleteDeferredAOs class is a special object that runs after all others, which will
- * reactivate the objects that were previously not run.
- */
-QActiveObject::QActiveObject(TInt priority, QEventDispatcherSymbian *dispatcher)
- : CActive(priority),
- m_dispatcher(dispatcher),
- m_hasAlreadyRun(false),
- m_hasRunAgain(false),
- m_iterationCount(1)
-{
-}
-
-QActiveObject::~QActiveObject()
-{
- if (m_hasRunAgain)
- m_dispatcher->removeDeferredActiveObject(this);
-}
-
-bool QActiveObject::maybeQueueForLater()
-{
- Q_ASSERT(!m_hasRunAgain);
-
- if (!m_hasAlreadyRun || m_dispatcher->iterationCount() != m_iterationCount) {
- // First occurrence of this event in this iteration.
- m_hasAlreadyRun = true;
- m_iterationCount = m_dispatcher->iterationCount();
- return false;
- } else {
- // The event has already occurred.
- m_dispatcher->addDeferredActiveObject(this);
- m_hasRunAgain = true;
- return true;
- }
-}
-
-bool QActiveObject::maybeDeferSocketEvent()
-{
- Q_ASSERT(!m_hasRunAgain);
- Q_ASSERT(m_dispatcher);
- if (!m_dispatcher->areSocketEventsBlocked()) {
- return false;
- }
- m_hasRunAgain = true;
- m_dispatcher->addDeferredSocketActiveObject(this);
- return true;
-}
-
-void QActiveObject::reactivateAndComplete()
-{
- TInt error = iStatus.Int();
- iStatus = KRequestPending;
- SetActive();
- TRequestStatus *status = &iStatus;
- QEventDispatcherSymbian::RequestComplete(status, error);
-
- m_hasRunAgain = false;
- m_hasAlreadyRun = false;
-}
-
-QWakeUpActiveObject::QWakeUpActiveObject(QEventDispatcherSymbian *dispatcher)
- : QActiveObject(WAKE_UP_PRIORITY, dispatcher)
-{
- m_hostThreadId = RThread().Id();
- CActiveScheduler::Add(this);
- iStatus = KRequestPending;
- SetActive();
-}
-
-QWakeUpActiveObject::~QWakeUpActiveObject()
-{
- Cancel();
-}
-
-void QWakeUpActiveObject::DoCancel()
-{
- if (iStatus.Int() == KRequestPending) {
- TRequestStatus *status = &iStatus;
- QEventDispatcherSymbian::RequestComplete(status, KErrNone);
- } else if (IsActive() && m_hostThreadId != RThread().Id()) {
- // This is being cancelled in the adopted monitor thread, which can happen if an adopted thread with
- // an event loop has exited. The event loop creates an event dispatcher with this active object, which may be complete but not run on exit.
- // We force a cancellation in this thread, because a) the object cannot be deleted while active and b) without a cancellation
- // the thread semaphore will be one count down.
- // It is possible for this problem to affect other active objects. They symptom would be that finished signals
- // from adopted threads are not sent, or they arrive much later than they should.
- TRequestStatus *status = &iStatus;
- User::RequestComplete(status, KErrNone);
- }
-}
-
-void QWakeUpActiveObject::RunL()
-{
- if (maybeQueueForLater())
- return;
-
- iStatus = KRequestPending;
- SetActive();
- QT_TRYCATCH_LEAVING(m_dispatcher->wakeUpWasCalled());
-}
-
-QTimerActiveObject::QTimerActiveObject(QEventDispatcherSymbian *dispatcher, SymbianTimerInfo *timerInfo)
- : QActiveObject((timerInfo->interval) ? TIMER_PRIORITY : NULLTIMER_PRIORITY , dispatcher),
- m_timerInfo(timerInfo), m_expectedTimeSinceLastEvent(0)
-{
- // start the timeout timer to ensure initialisation
- m_timeoutTimer.start();
-}
-
-QTimerActiveObject::~QTimerActiveObject()
-{
- Cancel();
- m_rTimer.Close(); //close of null handle is safe
-}
-
-void QTimerActiveObject::DoCancel()
-{
- if (m_timerInfo->interval > 0) {
- m_rTimer.Cancel();
- } else {
- if (iStatus.Int() == KRequestPending) {
- TRequestStatus *status = &iStatus;
- QEventDispatcherSymbian::RequestComplete(status, KErrNone);
- }
- }
-}
-
-void QTimerActiveObject::RunL()
-{
- int error = KErrNone;
- if (iStatus == KErrNone) {
- QT_TRYCATCH_ERROR(error, Run());
- } else {
- error = iStatus.Int();
- }
- // All Symbian error codes are negative.
- if (error < 0) {
- CActiveScheduler::Current()->Error(error); // stop and report here, as this timer will be deleted on scope exit
- }
-}
-
-#define MAX_SYMBIAN_TIMEOUT_MS 2000000
-void QTimerActiveObject::StartTimer()
-{
- if (m_timerInfo->msLeft > MAX_SYMBIAN_TIMEOUT_MS) {
- //There is loss of accuracy anyway due to needing to restart the timer every 33 minutes,
- //so the 1/64s res of After() is acceptable for these very long timers.
- m_rTimer.After(iStatus, MAX_SYMBIAN_TIMEOUT_MS * 1000);
- m_timerInfo->msLeft -= MAX_SYMBIAN_TIMEOUT_MS;
- } else {
- // this algorithm implements drift correction for repeating timers
- // calculate how late we are for this event
- int timeSinceLastEvent = m_timeoutTimer.restart();
- int overshoot = timeSinceLastEvent - m_expectedTimeSinceLastEvent;
- if (overshoot > m_timerInfo->msLeft) {
- // we skipped a whole timeout, restart from here
- overshoot = 0;
- }
- // calculate when the next event should happen
- int waitTime = m_timerInfo->msLeft - overshoot;
- m_expectedTimeSinceLastEvent = waitTime;
- // limit the actual ms wait time to avoid wild corrections
- // this will cause the real event time to slowly drift back to the expected event time
- // measurements show that Symbian timers always fire 1 or 2 ms late
- const int limit = 4;
- waitTime = qMax(m_timerInfo->msLeft - limit, waitTime);
- m_rTimer.HighRes(iStatus, waitTime * 1000);
- m_timerInfo->msLeft = 0;
- }
- SetActive();
-}
-
-void QTimerActiveObject::Run()
-{
- //restart timer immediately, if the timeout has been split because it overflows max for platform.
- if (m_timerInfo->msLeft > 0) {
- StartTimer();
- return;
- }
-
- if (maybeQueueForLater())
- return;
-
- if (m_timerInfo->interval > 0) {
- // Start a new timer immediately so that we don't lose time.
- m_timerInfo->msLeft = m_timerInfo->interval;
- StartTimer();
-
- m_timerInfo->dispatcher->timerFired(m_timerInfo->timerId);
- } else {
- // However, we only complete zero timers after the event has finished,
- // in order to prevent busy looping when doing nested loops.
-
- // Keep the refpointer around in order to avoid deletion until the end of this function.
- SymbianTimerInfoPtr timerInfoPtr(m_timerInfo);
-
- m_timerInfo->dispatcher->timerFired(m_timerInfo->timerId);
-
- iStatus = KRequestPending;
- SetActive();
- TRequestStatus *status = &iStatus;
- QEventDispatcherSymbian::RequestComplete(status, KErrNone);
- }
-}
-
-void QTimerActiveObject::Start()
-{
- CActiveScheduler::Add(this);
- m_timerInfo->msLeft = m_timerInfo->interval;
- if (m_timerInfo->interval > 0) {
- if (!m_rTimer.Handle()) {
- qt_symbian_throwIfError(m_rTimer.CreateLocal());
- }
- m_timeoutTimer.start();
- m_expectedTimeSinceLastEvent = 0;
- StartTimer();
- } else {
- iStatus = KRequestPending;
- SetActive();
- TRequestStatus *status = &iStatus;
- QEventDispatcherSymbian::RequestComplete(status, KErrNone);
- }
-}
-
-SymbianTimerInfo::SymbianTimerInfo()
- : timerAO(0)
-{
-}
-
-SymbianTimerInfo::~SymbianTimerInfo()
-{
- delete timerAO;
-}
-
-QCompleteDeferredAOs::QCompleteDeferredAOs(QEventDispatcherSymbian *dispatcher)
- : CActive(COMPLETE_DEFERRED_ACTIVE_OBJECTS_PRIORITY),
- m_dispatcher(dispatcher)
-{
- CActiveScheduler::Add(this);
- iStatus = KRequestPending;
- SetActive();
-}
-
-QCompleteDeferredAOs::~QCompleteDeferredAOs()
-{
- Cancel();
-}
-
-void QCompleteDeferredAOs::complete()
-{
- if (iStatus.Int() == KRequestPending) {
- TRequestStatus *status = &iStatus;
- QEventDispatcherSymbian::RequestComplete(status, KErrNone);
- }
-}
-
-void QCompleteDeferredAOs::DoCancel()
-{
- if (iStatus.Int() == KRequestPending) {
- TRequestStatus *status = &iStatus;
- QEventDispatcherSymbian::RequestComplete(status, KErrNone);
- }
-}
-
-void QCompleteDeferredAOs::RunL()
-{
- iStatus = KRequestPending;
- SetActive();
-
- QT_TRYCATCH_LEAVING(m_dispatcher->reactivateDeferredActiveObjects());
-}
-
-QSelectThread::QSelectThread()
- : m_quit(false)
-{
- if (::pipe(m_pipeEnds) != 0) {
- qWarning("Select thread was unable to open a pipe, errno: %i", errno);
- } else {
- int flags0 = qt_pipe_fcntl(m_pipeEnds[0], F_GETFL);
- int flags1 = qt_pipe_fcntl(m_pipeEnds[1], F_GETFL);
- // We should check the error code here, but Open C has a bug that returns
- // failure even though the operation was successful.
- qt_pipe2_fcntl(m_pipeEnds[0], F_SETFL, flags0 | O_NONBLOCK);
- qt_pipe2_fcntl(m_pipeEnds[1], F_SETFL, flags1 | O_NONBLOCK);
- }
-}
-
-QSelectThread::~QSelectThread()
-{
- qt_pipe_close(m_pipeEnds[1]);
- qt_pipe_close(m_pipeEnds[0]);
-}
-
-void QSelectThread::run()
-{
- Q_D(QThread);
-
- m_mutex.lock();
-
- while (!m_quit) {
- fd_set readfds;
- fd_set writefds;
- fd_set exceptionfds;
-
- FD_ZERO(&readfds);
- FD_ZERO(&writefds);
- FD_ZERO(&exceptionfds);
-
- int maxfd = 0;
- maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Read, &readfds));
- maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Write, &writefds));
- maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Exception, &exceptionfds));
- maxfd = qMax(maxfd, m_pipeEnds[0]);
- maxfd++;
-
- FD_SET(m_pipeEnds[0], &readfds);
-
- int ret;
- int savedSelectErrno;
- ret = qt_socket_select(maxfd, &readfds, &writefds, &exceptionfds, 0);
- savedSelectErrno = errno;
-
- if(ret == 0) {
- // do nothing
- } else if (ret < 0) {
- switch (savedSelectErrno) {
- case EBADF:
- case EINVAL:
- case ENOMEM:
- case EFAULT:
- qWarning("::select() returned an error: %i", savedSelectErrno);
- break;
- case ECONNREFUSED:
- case EPIPE:
- qWarning("::select() returned an error: %i (go through sockets)", savedSelectErrno);
- // prepare to go through all sockets
- // mark in fd sets both:
- // good ones
- // ones that return -1 in select
- // after loop update notifiers for all of them
-
- // as we don't have "exception" notifier type
- // we should force monitoring fd_set of this
- // type as well
-
- // clean @ start
- FD_ZERO(&readfds);
- FD_ZERO(&writefds);
- FD_ZERO(&exceptionfds);
- for (QHash<QSocketNotifier *, TRequestStatus *>::const_iterator i = m_AOStatuses.begin();
- i != m_AOStatuses.end(); ++i) {
-
- fd_set onefds;
- FD_ZERO(&onefds);
- FD_SET(i.key()->socket(), &onefds);
-
- fd_set excfds;
- FD_ZERO(&excfds);
- FD_SET(i.key()->socket(), &excfds);
-
- maxfd = i.key()->socket() + 1;
-
- struct timeval timeout;
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
-
- ret = 0;
-
- if(i.key()->type() == QSocketNotifier::Read) {
- ret = ::select(maxfd, &onefds, 0, &excfds, &timeout);
- if(ret != 0) FD_SET(i.key()->socket(), &readfds);
- } else if(i.key()->type() == QSocketNotifier::Write) {
- ret = ::select(maxfd, 0, &onefds, &excfds, &timeout);
- if(ret != 0) FD_SET(i.key()->socket(), &writefds);
- }
-
- } // end for
-
- // traversed all, so update
- updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds);
- updateActivatedNotifiers(QSocketNotifier::Read, &readfds);
- updateActivatedNotifiers(QSocketNotifier::Write, &writefds);
-
- break;
- case EINTR: // Should never occur on Symbian, but this is future proof!
- default:
- qWarning("::select() returned an unknown error: %i", savedSelectErrno);
-
- break;
- }
- } else {
- updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds);
- updateActivatedNotifiers(QSocketNotifier::Read, &readfds);
- updateActivatedNotifiers(QSocketNotifier::Write, &writefds);
- }
-
- if (FD_ISSET(m_pipeEnds[0], &readfds))
- m_waitCond.wait(&m_mutex);
- }
-
- m_mutex.unlock();
-}
-
-void QSelectThread::requestSocketEvents ( QSocketNotifier *notifier, TRequestStatus *status )
-{
- Q_D(QThread);
-
- if (!isRunning()) {
- start();
- }
-
- Q_ASSERT(QThread::currentThread() == this->thread());
-
- QSelectMutexGrabber lock(m_pipeEnds[1], m_pipeEnds[0], &m_mutex);
-
- Q_ASSERT(!m_AOStatuses.contains(notifier));
-
- m_AOStatuses.insert(notifier, status);
-
- m_waitCond.wakeAll();
-}
-
-void QSelectThread::cancelSocketEvents ( QSocketNotifier *notifier )
-{
- Q_ASSERT(QThread::currentThread() == this->thread());
-
- QSelectMutexGrabber lock(m_pipeEnds[1], m_pipeEnds[0], &m_mutex);
-
- m_AOStatuses.remove(notifier);
-
- m_waitCond.wakeAll();
-}
-
-void QSelectThread::restart()
-{
- Q_ASSERT(QThread::currentThread() == this->thread());
-
- QSelectMutexGrabber lock(m_pipeEnds[1], m_pipeEnds[0], &m_mutex);
-
- m_waitCond.wakeAll();
-}
-
-int QSelectThread::updateSocketSet(QSocketNotifier::Type type, fd_set *fds)
-{
- int maxfd = 0;
- if(m_AOStatuses.isEmpty()) {
- /*
- * Wonder if should return -1
- * to signal that no descriptors
- * added to fds
- */
- return maxfd;
- }
- for ( QHash<QSocketNotifier *, TRequestStatus *>::const_iterator i = m_AOStatuses.begin();
- i != m_AOStatuses.end(); ++i) {
- if (i.key()->type() == type) {
- FD_SET(i.key()->socket(), fds);
- maxfd = qMax(maxfd, i.key()->socket());
- } else if(type == QSocketNotifier::Exception) {
- /*
- * We are registering existing sockets
- * always to exception set
- *
- * Doing double FD_SET shouldn't
- * matter
- */
- FD_SET(i.key()->socket(), fds);
- maxfd = qMax(maxfd, i.key()->socket());
- }
- }
-
- return maxfd;
-}
-
-void QSelectThread::updateActivatedNotifiers(QSocketNotifier::Type type, fd_set *fds)
-{
- Q_D(QThread);
- if(m_AOStatuses.isEmpty()) {
- return;
- }
- QList<QSocketNotifier *> toRemove;
- for (QHash<QSocketNotifier *, TRequestStatus *>::const_iterator i = m_AOStatuses.begin();
- i != m_AOStatuses.end(); ++i) {
- if (i.key()->type() == type && FD_ISSET(i.key()->socket(), fds)) {
- toRemove.append(i.key());
- TRequestStatus *status = i.value();
- // Thread data is still owned by the main thread.
- QEventDispatcherSymbian::RequestComplete(d->threadData->symbian_thread_handle, status, KErrNone);
- } else if(type == QSocketNotifier::Exception && FD_ISSET(i.key()->socket(), fds)) {
- /*
- * check if socket is in exception set
- * then signal RequestComplete for it
- */
- qWarning("exception on %d [will close the socket handle - hack]", i.key()->socket());
- // quick fix; there is a bug
- // when doing read on socket
- // errors not preoperly mapped
- // after offline-ing the device
- // on some devices we do get exception
- ::close(i.key()->socket());
- toRemove.append(i.key());
- TRequestStatus *status = i.value();
- QEventDispatcherSymbian::RequestComplete(d->threadData->symbian_thread_handle, status, KErrNone);
- }
- }
-
- for (int c = 0; c < toRemove.size(); ++c) {
- m_AOStatuses.remove(toRemove[c]);
- }
-}
-
-void QSelectThread::stop()
-{
- m_quit = true;
- restart();
- wait();
-}
-
-QSocketActiveObject::QSocketActiveObject(QEventDispatcherSymbian *dispatcher, QSocketNotifier *notifier)
- : QActiveObject(CActive::EPriorityStandard, dispatcher),
- m_notifier(notifier),
- m_inSocketEvent(false),
- m_deleteLater(false)
-{
- CActiveScheduler::Add(this);
- iStatus = KRequestPending;
- SetActive();
-}
-
-QSocketActiveObject::~QSocketActiveObject()
-{
- Cancel();
-}
-
-void QSocketActiveObject::DoCancel()
-{
- if (iStatus.Int() == KRequestPending) {
- TRequestStatus *status = &iStatus;
- QEventDispatcherSymbian::RequestComplete(status, KErrNone);
- }
-}
-
-void QSocketActiveObject::RunL()
-{
- if (maybeDeferSocketEvent())
- return;
- if (maybeQueueForLater())
- return;
-
- QT_TRYCATCH_LEAVING(run());
-}
-
-void QSocketActiveObject::run()
-{
- QEvent e(QEvent::SockAct);
- m_inSocketEvent = true;
- QCoreApplication::sendEvent(m_notifier, &e);
- m_inSocketEvent = false;
-
- if (m_deleteLater) {
- delete this;
- } else {
- iStatus = KRequestPending;
- SetActive();
- m_dispatcher->reactivateSocketNotifier(m_notifier);
- }
-}
-
-void QSocketActiveObject::deleteLater()
-{
- if (m_inSocketEvent) {
- m_deleteLater = true;
- } else {
- delete this;
- }
-}
-
-#ifdef QT_SYMBIAN_PRIORITY_DROP
-class QIdleDetectorThread
-{
-public:
- QIdleDetectorThread()
- : m_state(STATE_RUN), m_stop(false), m_running(false)
- {
- start();
- }
-
- ~QIdleDetectorThread()
- {
- stop();
- }
-
- void start()
- {
- QMutexLocker lock(&m_mutex);
- if (m_running)
- return;
- m_stop = false;
- m_state = STATE_RUN;
- TInt err = m_idleDetectorThread.Create(KNullDesC(), &idleDetectorThreadFunc, 1024, &User::Allocator(), this);
- if (err != KErrNone)
- return; // Fail silently on error. Next kick will try again. Exception might stop the event being processed
- m_idleDetectorThread.SetPriority(EPriorityAbsoluteBackgroundNormal);
- m_idleDetectorThread.Resume();
- m_running = true;
- // get a callback from QCoreApplication destruction to stop this thread
- qAddPostRoutine(StopIdleDetectorThread);
- }
-
- void stop()
- {
- QMutexLocker lock(&m_mutex);
- if (!m_running)
- return;
- // close down the idle thread because if corelib is loaded temporarily, this would leak threads into the host process
- m_stop = true;
- m_kick.release();
- m_idleDetectorThread.SetPriority(EPriorityNormal);
- TRequestStatus s;
- m_idleDetectorThread.Logon(s);
- User::WaitForRequest(s);
- m_idleDetectorThread.Close();
- m_running = false;
- }
-
- void kick()
- {
- start();
- m_state = STATE_KICKED;
- m_kick.release();
- }
-
- bool hasRun()
- {
- return m_state == STATE_RUN;
- }
-
-private:
- static TInt idleDetectorThreadFunc(TAny* self)
- {
- User::RenameThread(_L("IdleDetectorThread"));
- static_cast<QIdleDetectorThread*>(self)->IdleLoop();
- return KErrNone;
- }
-
- void IdleLoop()
- {
- while (!m_stop) {
- m_kick.acquire();
- m_state = STATE_RUN;
- }
- }
-
- static void StopIdleDetectorThread();
-
-private:
- enum IdleStates {STATE_KICKED, STATE_RUN} m_state;
- bool m_stop;
- bool m_running;
- RThread m_idleDetectorThread;
- QSemaphore m_kick;
- QMutex m_mutex;
-};
-
-Q_GLOBAL_STATIC(QIdleDetectorThread, idleDetectorThread);
-
-void QIdleDetectorThread::StopIdleDetectorThread()
-{
- idleDetectorThread()->stop();
-}
-
-const int maxBusyTime = 2000; // maximum time we allow idle detector to be blocked before worrying, in milliseconds
-const int baseDelay = 1000; // minimum delay time used when backing off to allow idling, in microseconds
-#endif
-
-QEventDispatcherSymbian::QEventDispatcherSymbian(QObject *parent)
- : QAbstractEventDispatcher(parent),
- m_selectThread(0),
- m_activeScheduler(0),
- m_wakeUpAO(0),
- m_completeDeferredAOs(0),
- m_interrupt(false),
- m_wakeUpDone(0),
- m_iterationCount(0),
- m_insideTimerEvent(false),
- m_noSocketEvents(false)
-{
-#ifdef QT_SYMBIAN_PRIORITY_DROP
- m_delay = baseDelay;
- m_avgEventTime = 0;
- idleDetectorThread();
-#endif
-}
-
-QEventDispatcherSymbian::~QEventDispatcherSymbian()
-{
-}
-
-void QEventDispatcherSymbian::startingUp()
-{
- if( !CActiveScheduler::Current() ) {
- m_activeScheduler = q_check_ptr(new CQtActiveScheduler()); // CBase derived class needs to be checked on new
- CActiveScheduler::Install(m_activeScheduler);
- }
- m_wakeUpAO = q_check_ptr(new QWakeUpActiveObject(this));
- m_completeDeferredAOs = q_check_ptr(new QCompleteDeferredAOs(this));
- // We already might have posted events, wakeup once to process them
- wakeUp();
-}
-
-QSelectThread& QEventDispatcherSymbian::selectThread() {
- if (!m_selectThread)
- m_selectThread = new QSelectThread;
- return *m_selectThread;
-}
-
-void QEventDispatcherSymbian::closingDown()
-{
- if (m_selectThread && m_selectThread->isRunning()) {
- m_selectThread->stop();
- }
- delete m_selectThread;
- m_selectThread = 0;
-
- delete m_completeDeferredAOs;
- delete m_wakeUpAO;
- if (m_activeScheduler) {
- delete m_activeScheduler;
- }
-}
-
-bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags flags )
-{
- bool handledAnyEvent = false;
- bool oldNoSocketEventsValue = m_noSocketEvents;
- bool oldInsideTimerEventValue = m_insideTimerEvent;
-
- m_insideTimerEvent = false;
-
- QT_TRY {
- Q_D(QAbstractEventDispatcher);
-
- // It is safe if this counter overflows. The main importance is that each
- // iteration count is different from the last.
- m_iterationCount++;
-
- RThread &thread = d->threadData->symbian_thread_handle;
-
- bool block;
- if (flags & QEventLoop::WaitForMoreEvents) {
- block = true;
- emit aboutToBlock();
- } else {
- block = false;
- }
-
- if (flags & QEventLoop::ExcludeSocketNotifiers) {
- m_noSocketEvents = true;
- } else {
- m_noSocketEvents = false;
- handledAnyEvent = sendDeferredSocketEvents();
- }
-
- bool handledSymbianEvent = false;
- m_interrupt = false;
-
-#ifdef QT_SYMBIAN_PRIORITY_DROP
- QElapsedTimer eventTimer;
-#endif
-
- while (1) {
- if (block) {
- // This is where Qt will spend most of its time.
- CActiveScheduler::Current()->WaitForAnyRequest();
- } else {
- if (thread.RequestCount() == 0) {
-#ifdef QT_SYMBIAN_PRIORITY_DROP
- if (idleDetectorThread()->hasRun()) {
- m_lastIdleRequestTimer.start();
- idleDetectorThread()->kick();
- } else if (m_lastIdleRequestTimer.elapsed() > maxBusyTime) {
- User::AfterHighRes(m_delay);
- }
-#endif
- break;
- }
- // This one should return without delay.
- CActiveScheduler::Current()->WaitForAnyRequest();
- }
-
-#ifdef QT_SYMBIAN_PRIORITY_DROP
- if (idleDetectorThread()->hasRun()) {
- if (m_delay > baseDelay)
- m_delay -= baseDelay;
- m_lastIdleRequestTimer.start();
- idleDetectorThread()->kick();
- } else if (m_lastIdleRequestTimer.elapsed() > maxBusyTime) {
- User::AfterHighRes(m_delay);
- // allow delay to be up to 1/4 of execution time
- if (!idleDetectorThread()->hasRun() && m_delay*3 < m_avgEventTime)
- m_delay += baseDelay;
- }
- eventTimer.start();
-#endif
-
- TInt error;
- handledSymbianEvent = CActiveScheduler::RunIfReady(error, KMinTInt);
- if (error) {
- qWarning("CActiveScheduler::RunIfReady() returned error: %i\n", error);
- CActiveScheduler::Current()->Error(error);
- }
-
-#ifdef QT_SYMBIAN_PRIORITY_DROP
- int eventDur = eventTimer.elapsed()*1000;
- // average is calcualted as a 5% decaying exponential average
- m_avgEventTime = (m_avgEventTime * 95 + eventDur * 5) / 100;
-#endif
-
- if (!handledSymbianEvent) {
- qFatal("QEventDispatcherSymbian::processEvents(): Caught Symbian stray signal");
- }
- handledAnyEvent = true;
- if (m_interrupt) {
- break;
- }
- block = false;
- };
-
- emit awake();
- } QT_CATCH (const std::exception& ex) {
-#ifndef QT_NO_EXCEPTIONS
- CActiveScheduler::Current()->Error(qt_symbian_exception2Error(ex));
-#endif
- }
-
- m_noSocketEvents = oldNoSocketEventsValue;
- m_insideTimerEvent = oldInsideTimerEventValue;
-
- return handledAnyEvent;
-}
-
-void QEventDispatcherSymbian::timerFired(int timerId)
-{
- QHash<int, SymbianTimerInfoPtr>::iterator i = m_timerList.find(timerId);
- if (i == m_timerList.end()) {
- // The timer has been deleted. Ignore this event.
- return;
- }
-
- SymbianTimerInfoPtr timerInfo = *i;
-
- // Prevent infinite timer recursion.
- if (timerInfo->inTimerEvent) {
- return;
- }
-
- timerInfo->inTimerEvent = true;
- bool oldInsideTimerEventValue = m_insideTimerEvent;
- m_insideTimerEvent = true;
-
- QTimerEvent event(timerInfo->timerId);
- QCoreApplication::sendEvent(timerInfo->receiver, &event);
-
- m_insideTimerEvent = oldInsideTimerEventValue;
- timerInfo->inTimerEvent = false;
-
- return;
-}
-
-void QEventDispatcherSymbian::wakeUpWasCalled()
-{
- // The reactivation should happen in RunL, right before the call to this function.
- // This is because m_wakeUpDone is the "signal" that the object can be completed
- // once more.
- // Also, by dispatching the posted events after resetting m_wakeUpDone, we guarantee
- // that no posted event notification will be lost. If we did it the other way
- // around, it would be possible for another thread to post an event right after
- // the sendPostedEvents was done, but before the object was ready to be completed
- // again. This could deadlock the application if there are no other posted events.
- m_wakeUpDone.fetchAndStoreOrdered(0);
- sendPostedEvents();
-}
-
-void QEventDispatcherSymbian::interrupt()
-{
- m_interrupt = true;
- wakeUp();
-}
-
-void QEventDispatcherSymbian::wakeUp()
-{
- Q_D(QAbstractEventDispatcher);
-
- if (m_wakeUpAO && m_wakeUpDone.testAndSetAcquire(0, 1)) {
- TRequestStatus *status = &m_wakeUpAO->iStatus;
- QEventDispatcherSymbian::RequestComplete(d->threadData->symbian_thread_handle, status, KErrNone);
- }
-}
-
-bool QEventDispatcherSymbian::sendPostedEvents()
-{
- Q_D(QAbstractEventDispatcher);
-
- // moveToThread calls this and canWait == true -> Events will never get processed
- // if we check for d->threadData->canWait
- //
- // QCoreApplication::postEvent sets canWait = false, but after the object and events
- // are moved to a new thread, the canWait in new thread is true i.e. not changed to reflect
- // the flag on old thread. That's why events in a new thread will not get processed.
- // This migth be actually bug in moveToThread functionality, but because other platforms
- // do not check canWait in wakeUp (where we essentially are now) - decided to remove it from
- // here as well.
-
- //if (!d->threadData->canWait) {
- QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData);
- return true;
- //}
- //return false;
-}
-
-inline void QEventDispatcherSymbian::addDeferredActiveObject(QActiveObject *object)
-{
- queueDeferredActiveObjectsCompletion();
- m_deferredActiveObjects.append(object);
-}
-
-inline void QEventDispatcherSymbian::removeDeferredActiveObject(QActiveObject *object)
-{
- m_deferredActiveObjects.removeAll(object);
- m_deferredSocketEvents.removeAll(object);
-}
-
-inline void QEventDispatcherSymbian::addDeferredSocketActiveObject(QActiveObject *object)
-{
- m_deferredSocketEvents.append(object);
-}
-
-void QEventDispatcherSymbian::queueDeferredActiveObjectsCompletion()
-{
- m_completeDeferredAOs->complete();
-}
-
-void QEventDispatcherSymbian::reactivateDeferredActiveObjects()
-{
- while (!m_deferredActiveObjects.isEmpty()) {
- QActiveObject *object = m_deferredActiveObjects.takeFirst();
- object->reactivateAndComplete();
- }
-
- // We do this because we want to return from processEvents. This is because
- // each invocation of processEvents should only run each active object once.
- // The active scheduler should run them continously, however.
- m_interrupt = true;
-}
-
-bool QEventDispatcherSymbian::sendDeferredSocketEvents()
-{
- bool sentAnyEvents = false;
- while (!m_deferredSocketEvents.isEmpty()) {
- sentAnyEvents = true;
- QActiveObject *object = m_deferredSocketEvents.takeFirst();
- object->reactivateAndComplete();
- }
-
- return sentAnyEvents;
-}
-
-void QEventDispatcherSymbian::flush()
-{
-}
-
-bool QEventDispatcherSymbian::hasPendingEvents()
-{
- Q_D(QAbstractEventDispatcher);
- return (d->threadData->symbian_thread_handle.RequestCount() != 0
- || !d->threadData->canWait || !m_deferredSocketEvents.isEmpty());
-}
-
-void QEventDispatcherSymbian::registerSocketNotifier ( QSocketNotifier * notifier )
-{
- //check socket descriptor is usable
- if (notifier->socket() >= FD_SETSIZE || notifier->socket() < 0) {
- //same warning message as the unix event dispatcher for easy testing
- qWarning("QSocketNotifier: Internal error");
- return;
- }
- //note - this is only for "open C" file descriptors
- //for native sockets, an active object in the symbian socket engine handles this
- QSocketActiveObject *socketAO = new QSocketActiveObject(this, notifier);
- Q_CHECK_PTR(socketAO);
- m_notifiers.insert(notifier, socketAO);
- selectThread().requestSocketEvents(notifier, &socketAO->iStatus);
-}
-
-void QEventDispatcherSymbian::unregisterSocketNotifier ( QSocketNotifier * notifier )
-{
- //note - this is only for "open C" file descriptors
- //for native sockets, an active object in the symbian socket engine handles this
- if (m_selectThread)
- m_selectThread->cancelSocketEvents(notifier);
- if (m_notifiers.contains(notifier)) {
- QSocketActiveObject *sockObj = *m_notifiers.find(notifier);
- m_deferredSocketEvents.removeAll(sockObj);
- sockObj->deleteLater();
- m_notifiers.remove(notifier);
- }
-}
-
-void QEventDispatcherSymbian::reactivateSocketNotifier(QSocketNotifier *notifier)
-{
- selectThread().requestSocketEvents(notifier, &m_notifiers[notifier]->iStatus);
-}
-
-void QEventDispatcherSymbian::registerTimer ( int timerId, int interval, QObject * object )
-{
- if (interval < 0) {
- qWarning("Timer interval < 0");
- interval = 0;
- }
-
- SymbianTimerInfoPtr timer(new SymbianTimerInfo);
- timer->timerId = timerId;
- timer->interval = interval;
- timer->inTimerEvent = false;
- timer->receiver = object;
- timer->dispatcher = this;
- timer->timerAO = q_check_ptr(new QTimerActiveObject(this, timer.data()));
- m_timerList.insert(timerId, timer);
-
- timer->timerAO->Start();
-
- if (m_insideTimerEvent)
- // If we are inside a timer event, we need to prevent event starvation
- // by preventing newly created timers from running in the same event processing
- // iteration. Do this by calling the maybeQueueForLater() function to "fake" that we have
- // already run once. This will cause the next run to be added to the deferred
- // queue instead.
- timer->timerAO->maybeQueueForLater();
-}
-
-bool QEventDispatcherSymbian::unregisterTimer ( int timerId )
-{
- if (!m_timerList.contains(timerId)) {
- return false;
- }
-
- SymbianTimerInfoPtr timerInfo = m_timerList.take(timerId);
-
- if (!QObjectPrivate::get(timerInfo->receiver)->inThreadChangeEvent)
- QAbstractEventDispatcherPrivate::releaseTimerId(timerId);
-
- return true;
-}
-
-bool QEventDispatcherSymbian::unregisterTimers ( QObject * object )
-{
- if (m_timerList.isEmpty())
- return false;
-
- bool unregistered = false;
- for (QHash<int, SymbianTimerInfoPtr>::iterator i = m_timerList.begin(); i != m_timerList.end(); ) {
- if ((*i)->receiver == object) {
- i = m_timerList.erase(i);
- unregistered = true;
- } else {
- ++i;
- }
- }
-
- return unregistered;
-}
-
-QList<QEventDispatcherSymbian::TimerInfo> QEventDispatcherSymbian::registeredTimers ( QObject * object ) const
-{
- QList<TimerInfo> list;
- for (QHash<int, SymbianTimerInfoPtr>::const_iterator i = m_timerList.begin(); i != m_timerList.end(); ++i) {
- if ((*i)->receiver == object) {
- list.push_back(TimerInfo((*i)->timerId, (*i)->interval));
- }
- }
-
- return list;
-}
-
-/*
- * This active scheduler class implements a simple report and continue policy, for Symbian OS leaves
- * or exceptions from Qt that fall back to the scheduler.
- * It will be used in cases where there is no existing active scheduler installed.
- * Apps which link to qts60main.lib will have the UI active scheduler installed in the main thread
- * instead of this one. But this would be used in other threads in the UI.
- * An app could replace this behaviour by installing an alternative active scheduler.
- */
-void CQtActiveScheduler::Error(TInt aError) const
-{
- QT_TRY {
- qWarning("Error from active scheduler %d", aError);
- }
- QT_CATCH (const std::bad_alloc&) {} // ignore alloc fails, nothing more can be done
-}
-
-bool QActiveObject::wait(CActive* ao, int ms)
-{
- if (!ao->IsActive())
- return true; //request already complete
- bool timedout = false;
- if (ms > 0) {
- TRequestStatus tstat;
- RTimer t;
- if (KErrNone != t.CreateLocal())
- return false;
- t.HighRes(tstat, ms*1000);
- User::WaitForRequest(tstat, ao->iStatus);
- if (tstat != KRequestPending) {
- timedout = true;
- } else {
- t.Cancel();
- //balance thread semaphore
- User::WaitForRequest(tstat);
- }
- t.Close();
- } else {
- User::WaitForRequest(ao->iStatus);
- }
- if (timedout)
- return false;
-
- //evil cast to allow calling of protected virtual
- ((QActiveObject*)ao)->RunL();
-
- //clear active & pending flags
- ao->iStatus = TRequestStatus();
-
- return true;
-}
-
-bool QActiveObject::wait(QList<CActive*> aos, int ms)
-{
- QVector<TRequestStatus*> stati;
- stati.reserve(aos.count() + 1);
- foreach (CActive* ao, aos) {
- if (!ao->IsActive())
- return true; //request already complete
- stati.append(&(ao->iStatus));
- }
- bool timedout = false;
- TRequestStatus tstat;
- RTimer t;
- if (ms > 0) {
- if (KErrNone != t.CreateLocal())
- return false;
- t.HighRes(tstat, ms*1000);
- stati.append(&tstat);
- }
- User::WaitForNRequest(stati.data(), stati.count());
- if (ms > 0) {
- if (tstat != KRequestPending) {
- timedout = true;
- } else {
- t.Cancel();
- //balance thread semaphore
- User::WaitForRequest(tstat);
- }
- t.Close();
- }
- if (timedout)
- return false;
-
- foreach (CActive* ao, aos) {
- if (ao->iStatus != KRequestPending) {
- //evil cast to allow calling of protected virtual
- ((QActiveObject*)ao)->RunL();
-
- //clear active & pending flags
- ao->iStatus = TRequestStatus();
- break; //only call one
- }
- }
- return true;
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qeventdispatcher_symbian_p.cpp"
diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h
deleted file mode 100644
index e327a9cdc5..0000000000
--- a/src/corelib/kernel/qeventdispatcher_symbian_p.h
+++ /dev/null
@@ -1,327 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QEVENTDISPATCHER_SYMBIAN_P_H
-#define QEVENTDISPATCHER_SYMBIAN_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 <qhash.h>
-#include <qset.h>
-#include <qshareddata.h>
-#include <qabstracteventdispatcher.h>
-#include <private/qabstracteventdispatcher_p.h>
-#include <qthread.h>
-#include <qmutex.h>
-#include <qwaitcondition.h>
-#include <qsocketnotifier.h>
-#include <qdatetime.h>
-#include <qelapsedtimer.h>
-
-#include <e32base.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/select.h>
-
-QT_BEGIN_NAMESPACE
-
-
-class QEventDispatcherSymbian;
-class QTimerActiveObject;
-
-class Q_CORE_EXPORT QActiveObject : public CActive
-{
-public:
- QActiveObject(TInt priority, QEventDispatcherSymbian *dispatcher);
- ~QActiveObject();
-
- bool maybeQueueForLater();
- bool maybeDeferSocketEvent();
-
- void reactivateAndComplete();
-
- static bool wait(CActive* ao, int ms);
- static bool wait(QList<CActive*> aos, int ms);
-protected:
- QEventDispatcherSymbian *m_dispatcher;
-
-private:
- bool m_hasAlreadyRun : 1;
- bool m_hasRunAgain : 1;
- int m_iterationCount;
-};
-
-class QWakeUpActiveObject : public QActiveObject
-{
-public:
- QWakeUpActiveObject(QEventDispatcherSymbian *dispatcher);
- ~QWakeUpActiveObject();
-
- void Complete();
-
-protected:
- void DoCancel();
- void RunL();
-
-private:
- TThreadId m_hostThreadId;
-};
-
-struct SymbianTimerInfo : public QSharedData
-{
- SymbianTimerInfo();
- ~SymbianTimerInfo();
-
- int timerId;
- int interval;
- int msLeft;
- bool inTimerEvent;
- QObject *receiver;
- QTimerActiveObject *timerAO;
- QEventDispatcherSymbian *dispatcher;
-};
-
-typedef QExplicitlySharedDataPointer<SymbianTimerInfo> SymbianTimerInfoPtr;
-
-// This is a bit of a proxy class. See comments in SetActive and Start for details.
-class QTimerActiveObject : public QActiveObject
-{
-public:
- QTimerActiveObject(QEventDispatcherSymbian *dispatcher, SymbianTimerInfo *timerInfo);
- ~QTimerActiveObject();
-
- void Start();
-
-protected:
- void DoCancel();
- void RunL();
-
-private:
- void Run();
- void StartTimer();
-
-private:
- SymbianTimerInfo *m_timerInfo;
- QElapsedTimer m_timeoutTimer;
- int m_expectedTimeSinceLastEvent;
- RTimer m_rTimer;
-};
-
-class QCompleteDeferredAOs : public CActive
-{
-public:
- QCompleteDeferredAOs(QEventDispatcherSymbian *dispatcher);
- ~QCompleteDeferredAOs();
-
- void complete();
-
-protected:
- void DoCancel();
- void RunL();
-
-private:
- QEventDispatcherSymbian *m_dispatcher;
-};
-
-class QSocketActiveObject : public QActiveObject
-{
-public:
- QSocketActiveObject(QEventDispatcherSymbian *dispatcher, QSocketNotifier *notifier);
- ~QSocketActiveObject();
-
- void deleteLater();
-
-protected:
- void DoCancel();
- void RunL();
- void run();
-
-private:
- QSocketNotifier *m_notifier;
- bool m_inSocketEvent;
- bool m_deleteLater;
-
- friend class QEventDispatcherSymbian;
-};
-
-class QSelectThread : public QThread
-{
- Q_DECLARE_PRIVATE(QThread)
-
-public:
- QSelectThread();
- ~QSelectThread();
-
- void requestSocketEvents ( QSocketNotifier *notifier, TRequestStatus *status );
- void cancelSocketEvents ( QSocketNotifier *notifier );
- void restart();
- void stop();
-
-protected:
- void run();
-
-private:
- int updateSocketSet(QSocketNotifier::Type type, fd_set *fds);
- void updateActivatedNotifiers(QSocketNotifier::Type type, fd_set *fds);
-
-private:
- int m_pipeEnds[2];
- QHash<QSocketNotifier *, TRequestStatus *> m_AOStatuses;
- QMutex m_mutex;
- QWaitCondition m_waitCond;
- bool m_quit;
-};
-
-class Q_CORE_EXPORT CQtActiveScheduler : public CActiveScheduler
-{
-public: // from CActiveScheduler
- virtual void Error(TInt aError) const;
-};
-
-class Q_CORE_EXPORT QEventDispatcherSymbian : public QAbstractEventDispatcher
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QAbstractEventDispatcher)
-
-public:
- QEventDispatcherSymbian(QObject *parent = 0);
- ~QEventDispatcherSymbian();
-
- void flush();
- bool hasPendingEvents();
- void interrupt();
- bool processEvents ( QEventLoop::ProcessEventsFlags flags );
- void registerSocketNotifier ( QSocketNotifier * notifier );
- void registerTimer ( int timerId, int interval, QObject * object );
- QList<TimerInfo> registeredTimers ( QObject * object ) const;
- void unregisterSocketNotifier ( QSocketNotifier * notifier );
- bool unregisterTimer ( int timerId );
- bool unregisterTimers ( QObject * object );
- void wakeUp();
-
- void startingUp();
- void closingDown();
-
- void timerFired(int timerId);
- void wakeUpWasCalled();
- void reactivateSocketNotifier(QSocketNotifier *notifier);
-
- void addDeferredActiveObject(QActiveObject *object);
- void removeDeferredActiveObject(QActiveObject *object);
- void queueDeferredActiveObjectsCompletion();
- // Can be overridden to activate local active objects too, but do call baseclass!
- virtual void reactivateDeferredActiveObjects();
-
- inline int iterationCount() const { return m_iterationCount; }
-
- void addDeferredSocketActiveObject(QActiveObject *object);
- inline bool areSocketEventsBlocked() const { return m_noSocketEvents; }
-
- static void RequestComplete(TRequestStatus *&status, TInt reason);
- static void RequestComplete(RThread &threadHandle, TRequestStatus *&status, TInt reason);
-
-private:
- bool sendPostedEvents();
- bool sendDeferredSocketEvents();
-
- QSelectThread& selectThread();
-private:
- QSelectThread *m_selectThread;
-
- CQtActiveScheduler *m_activeScheduler;
-
- QHash<int, SymbianTimerInfoPtr> m_timerList;
- QHash<QSocketNotifier *, QSocketActiveObject *> m_notifiers;
-
- QWakeUpActiveObject *m_wakeUpAO;
- QCompleteDeferredAOs *m_completeDeferredAOs;
-
- volatile bool m_interrupt;
- QAtomicInt m_wakeUpDone;
-
- unsigned char m_iterationCount;
- bool m_insideTimerEvent;
- bool m_noSocketEvents;
- //deferred until socket events are enabled
- QList<QActiveObject *> m_deferredSocketEvents;
- //deferred until idle
- QList<QActiveObject *> m_deferredActiveObjects;
-
- int m_delay;
- int m_avgEventTime;
- QElapsedTimer m_lastIdleRequestTimer;
-};
-
-#ifdef QT_DEBUG
-# define VERIFY_PENDING_REQUEST_STATUS \
- Q_ASSERT(status->Int() == KRequestPending);
-#else
-# define VERIFY_PENDING_REQUEST_STATUS
-#endif
-
-// Convenience functions for doing some sanity checking on our own complete code.
-// Unless QT_DEBUG is defined, it is exactly equivalent to the Symbian version.
-inline void QEventDispatcherSymbian::RequestComplete(TRequestStatus *&status, TInt reason)
-{
- VERIFY_PENDING_REQUEST_STATUS
- User::RequestComplete(status, reason);
-}
-inline void QEventDispatcherSymbian::RequestComplete(RThread &threadHandle, TRequestStatus *&status, TInt reason)
-{
- VERIFY_PENDING_REQUEST_STATUS
- threadHandle.RequestComplete(status, reason);
-}
-
-#undef VERIFY_PENDING_REQUEST_STATUS
-
-QT_END_NAMESPACE
-
-#endif // QEVENTDISPATCHER_SYMBIAN_P_H
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp
index 27efac6985..26a9e9f0ca 100644
--- a/src/corelib/kernel/qeventdispatcher_unix.cpp
+++ b/src/corelib/kernel/qeventdispatcher_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -72,8 +72,6 @@
QT_BEGIN_NAMESPACE
-Q_CORE_EXPORT bool qt_disable_lowpriority_timers=false;
-
/*****************************************************************************
UNIX signal handling
*****************************************************************************/
@@ -309,326 +307,6 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags,
return (nevents + q->activateSocketNotifiers());
}
-/*
- * Internal functions for manipulating timer data structures. The
- * timerBitVec array is used for keeping track of timer identifiers.
- */
-
-QTimerInfoList::QTimerInfoList()
-{
-#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC) && !defined(Q_OS_NACL)
- if (!QElapsedTimer::isMonotonic()) {
- // not using monotonic timers, initialize the timeChanged() machinery
- previousTime = qt_gettime();
-
- tms unused;
- previousTicks = times(&unused);
-
- ticksPerSecond = sysconf(_SC_CLK_TCK);
- msPerTick = 1000/ticksPerSecond;
- } else {
- // detected monotonic timers
- previousTime.tv_sec = previousTime.tv_usec = 0;
- previousTicks = 0;
- ticksPerSecond = 0;
- msPerTick = 0;
- }
-#endif
-
- firstTimerInfo = 0;
-}
-
-timeval QTimerInfoList::updateCurrentTime()
-{
- return (currentTime = qt_gettime());
-}
-
-#if ((_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC) && !defined(Q_OS_INTEGRITY)) || defined(QT_BOOTSTRAPPED)
-
-template <>
-timeval qAbs(const timeval &t)
-{
- timeval tmp = t;
- if (tmp.tv_sec < 0) {
- tmp.tv_sec = -tmp.tv_sec - 1;
- tmp.tv_usec -= 1000000;
- }
- if (tmp.tv_sec == 0 && tmp.tv_usec < 0) {
- tmp.tv_usec = -tmp.tv_usec;
- }
- return normalizedTimeval(tmp);
-}
-
-/*
- Returns true if the real time clock has changed by more than 10%
- relative to the processor time since the last time this function was
- called. This presumably means that the system time has been changed.
-
- If /a delta is nonzero, delta is set to our best guess at how much the system clock was changed.
-*/
-bool QTimerInfoList::timeChanged(timeval *delta)
-{
-#ifdef Q_OS_NACL
- Q_UNUSED(delta)
- return false; // Calling "times" crashes.
-#endif
- struct tms unused;
- clock_t currentTicks = times(&unused);
-
- clock_t elapsedTicks = currentTicks - previousTicks;
- timeval elapsedTime = currentTime - previousTime;
-
- timeval elapsedTimeTicks;
- elapsedTimeTicks.tv_sec = elapsedTicks / ticksPerSecond;
- elapsedTimeTicks.tv_usec = (((elapsedTicks * 1000) / ticksPerSecond) % 1000) * 1000;
-
- timeval dummy;
- if (!delta)
- delta = &dummy;
- *delta = elapsedTime - elapsedTimeTicks;
-
- previousTicks = currentTicks;
- previousTime = currentTime;
-
- // If tick drift is more than 10% off compared to realtime, we assume that the clock has
- // been set. Of course, we have to allow for the tick granularity as well.
- timeval tickGranularity;
- tickGranularity.tv_sec = 0;
- tickGranularity.tv_usec = msPerTick * 1000;
- return elapsedTimeTicks < ((qAbs(*delta) - tickGranularity) * 10);
-}
-
-void QTimerInfoList::repairTimersIfNeeded()
-{
- if (QElapsedTimer::isMonotonic())
- return;
- timeval delta;
- if (timeChanged(&delta))
- timerRepair(delta);
-}
-
-#else // !(_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(QT_BOOTSTRAPPED)
-
-void QTimerInfoList::repairTimersIfNeeded()
-{
-}
-
-#endif
-
-/*
- insert timer info into list
-*/
-void QTimerInfoList::timerInsert(QTimerInfo *ti)
-{
- int index = size();
- while (index--) {
- register const QTimerInfo * const t = at(index);
- if (!(ti->timeout < t->timeout))
- break;
- }
- insert(index+1, ti);
-}
-
-/*
- repair broken timer
-*/
-void QTimerInfoList::timerRepair(const timeval &diff)
-{
- // repair all timers
- for (int i = 0; i < size(); ++i) {
- register QTimerInfo *t = at(i);
- t->timeout = t->timeout + diff;
- }
-}
-
-static timeval roundToMillisecond(timeval val)
-{
- // always round up
- // worst case scenario is that the first trigger of a 1-ms timer is 0.999 ms late
-
- int us = val.tv_usec % 1000;
- val.tv_usec += 1000 - us;
- return normalizedTimeval(val);
-}
-
-/*
- Returns the time to wait for the next timer, or null if no timers
- are waiting.
-*/
-bool QTimerInfoList::timerWait(timeval &tm)
-{
- timeval currentTime = updateCurrentTime();
- repairTimersIfNeeded();
-
- // Find first waiting timer not already active
- QTimerInfo *t = 0;
- for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) {
- if (!(*it)->activateRef) {
- t = *it;
- break;
- }
- }
-
- if (!t)
- return false;
-
- if (currentTime < t->timeout) {
- // time to wait
- tm = roundToMillisecond(t->timeout - currentTime);
- } else {
- // no time to wait
- tm.tv_sec = 0;
- tm.tv_usec = 0;
- }
-
- return true;
-}
-
-void QTimerInfoList::registerTimer(int timerId, int interval, QObject *object)
-{
- QTimerInfo *t = new QTimerInfo;
- t->id = timerId;
- t->interval.tv_sec = interval / 1000;
- t->interval.tv_usec = (interval % 1000) * 1000;
- t->timeout = updateCurrentTime() + t->interval;
- t->obj = object;
- t->activateRef = 0;
-
- timerInsert(t);
-}
-
-bool QTimerInfoList::unregisterTimer(int timerId)
-{
- // set timer inactive
- for (int i = 0; i < count(); ++i) {
- register QTimerInfo *t = at(i);
- if (t->id == timerId) {
- // found it
- removeAt(i);
- if (t == firstTimerInfo)
- firstTimerInfo = 0;
- if (t->activateRef)
- *(t->activateRef) = 0;
-
- // release the timer id
- if (!QObjectPrivate::get(t->obj)->inThreadChangeEvent)
- QAbstractEventDispatcherPrivate::releaseTimerId(timerId);
-
- delete t;
- return true;
- }
- }
- // id not found
- return false;
-}
-
-bool QTimerInfoList::unregisterTimers(QObject *object)
-{
- if (isEmpty())
- return false;
- for (int i = 0; i < count(); ++i) {
- register QTimerInfo *t = at(i);
- if (t->obj == object) {
- // object found
- removeAt(i);
- if (t == firstTimerInfo)
- firstTimerInfo = 0;
- if (t->activateRef)
- *(t->activateRef) = 0;
-
- // release the timer id
- if (!QObjectPrivate::get(t->obj)->inThreadChangeEvent)
- QAbstractEventDispatcherPrivate::releaseTimerId(t->id);
-
- delete t;
- // move back one so that we don't skip the new current item
- --i;
- }
- }
- return true;
-}
-
-QList<QPair<int, int> > QTimerInfoList::registeredTimers(QObject *object) const
-{
- QList<QPair<int, int> > list;
- for (int i = 0; i < count(); ++i) {
- register const QTimerInfo * const t = at(i);
- if (t->obj == object)
- list << QPair<int, int>(t->id, t->interval.tv_sec * 1000 + t->interval.tv_usec / 1000);
- }
- return list;
-}
-
-/*
- Activate pending timers, returning how many where activated.
-*/
-int QTimerInfoList::activateTimers()
-{
- if (qt_disable_lowpriority_timers || isEmpty())
- return 0; // nothing to do
-
- int n_act = 0, maxCount = 0;
- firstTimerInfo = 0;
-
- timeval currentTime = updateCurrentTime();
- repairTimersIfNeeded();
-
-
- // Find out how many timer have expired
- for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) {
- if (currentTime < (*it)->timeout)
- break;
- maxCount++;
- }
-
- //fire the timers.
- while (maxCount--) {
- if (isEmpty())
- break;
-
- QTimerInfo *currentTimerInfo = first();
- if (currentTime < currentTimerInfo->timeout)
- break; // no timer has expired
-
- if (!firstTimerInfo) {
- firstTimerInfo = currentTimerInfo;
- } else if (firstTimerInfo == currentTimerInfo) {
- // avoid sending the same timer multiple times
- break;
- } else if (currentTimerInfo->interval < firstTimerInfo->interval
- || currentTimerInfo->interval == firstTimerInfo->interval) {
- firstTimerInfo = currentTimerInfo;
- }
-
- // remove from list
- removeFirst();
-
- // determine next timeout time
- currentTimerInfo->timeout += currentTimerInfo->interval;
- if (currentTimerInfo->timeout < currentTime)
- currentTimerInfo->timeout = currentTime + currentTimerInfo->interval;
-
- // reinsert timer
- timerInsert(currentTimerInfo);
- if (currentTimerInfo->interval.tv_usec > 0 || currentTimerInfo->interval.tv_sec > 0)
- n_act++;
-
- if (!currentTimerInfo->activateRef) {
- // send event, but don't allow it to recurse
- currentTimerInfo->activateRef = &currentTimerInfo;
-
- QTimerEvent e(currentTimerInfo->id);
- QCoreApplication::sendEvent(currentTimerInfo->obj, &e);
-
- if (currentTimerInfo)
- currentTimerInfo->activateRef = 0;
- }
- }
-
- firstTimerInfo = 0;
- return n_act;
-}
-
QEventDispatcherUNIX::QEventDispatcherUNIX(QObject *parent)
: QAbstractEventDispatcher(*new QEventDispatcherUNIXPrivate, parent)
{ }
@@ -652,7 +330,7 @@ int QEventDispatcherUNIX::select(int nfds, fd_set *readfds, fd_set *writefds, fd
/*!
\internal
*/
-void QEventDispatcherUNIX::registerTimer(int timerId, int interval, QObject *obj)
+void QEventDispatcherUNIX::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *obj)
{
#ifndef QT_NO_DEBUG
if (timerId < 1 || interval < 0 || !obj) {
@@ -665,7 +343,7 @@ void QEventDispatcherUNIX::registerTimer(int timerId, int interval, QObject *obj
#endif
Q_D(QEventDispatcherUNIX);
- d->timerList.registerTimer(timerId, interval, obj);
+ d->timerList.registerTimer(timerId, interval, timerType, obj);
}
/*!
diff --git a/src/corelib/kernel/qeventdispatcher_unix_p.h b/src/corelib/kernel/qeventdispatcher_unix_p.h
index 122f17f9e9..f4862bd9c3 100644
--- a/src/corelib/kernel/qeventdispatcher_unix_p.h
+++ b/src/corelib/kernel/qeventdispatcher_unix_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -59,6 +59,7 @@
#include "private/qcore_unix_p.h"
#include "private/qpodlist_p.h"
#include "QtCore/qvarlengtharray.h"
+#include "private/qtimerinfo_unix_p.h"
#if defined(Q_OS_VXWORKS)
# include <sys/times.h>
@@ -71,50 +72,6 @@
QT_BEGIN_NAMESPACE
-// internal timer info
-struct QTimerInfo {
- int id; // - timer identifier
- timeval interval; // - timer interval
- timeval timeout; // - when to sent event
- QObject *obj; // - object to receive event
- QTimerInfo **activateRef; // - ref from activateTimers
-};
-
-class QTimerInfoList : public QList<QTimerInfo*>
-{
-#if ((_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC)) || defined(QT_BOOTSTRAPPED)
- timeval previousTime;
- clock_t previousTicks;
- int ticksPerSecond;
- int msPerTick;
-
- bool timeChanged(timeval *delta);
-#endif
-
- // state variables used by activateTimers()
- QTimerInfo *firstTimerInfo;
-
-public:
- QTimerInfoList();
-
- timeval currentTime;
- timeval updateCurrentTime();
-
- // must call updateCurrentTime() first!
- void repairTimersIfNeeded();
-
- bool timerWait(timeval &);
- void timerInsert(QTimerInfo *);
- void timerRepair(const timeval &);
-
- void registerTimer(int timerId, int interval, QObject *object);
- bool unregisterTimer(int timerId);
- bool unregisterTimers(QObject *object);
- QList<QPair<int, int> > registeredTimers(QObject *object) const;
-
- int activateTimers();
-};
-
struct QSockNot
{
QSocketNotifier *obj;
@@ -154,7 +111,7 @@ public:
void registerSocketNotifier(QSocketNotifier *notifier);
void unregisterSocketNotifier(QSocketNotifier *notifier);
- void registerTimer(int timerId, int interval, QObject *object);
+ void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object);
bool unregisterTimer(int timerId);
bool unregisterTimers(QObject *object);
QList<TimerInfo> registeredTimers(QObject *object) const;
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index afee536d02..3ade11ca60 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -332,26 +332,6 @@ void QEventDispatcherWin32Private::activateEventNotifier(QWinEventNotifier * wen
QCoreApplication::sendEvent(wen, &event);
}
-// ### Qt 5: remove
-Q_CORE_EXPORT bool winPeekMessage(MSG* msg, HWND hWnd, UINT wMsgFilterMin,
- UINT wMsgFilterMax, UINT wRemoveMsg)
-{
- return PeekMessage(msg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
-}
-
-// ### Qt 5: remove
-Q_CORE_EXPORT bool winPostMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- return PostMessage(hWnd, msg, wParam, lParam);
-}
-
-// ### Qt 5: remove
-Q_CORE_EXPORT bool winGetMessage(MSG* msg, HWND hWnd, UINT wMsgFilterMin,
- UINT wMsgFilterMax)
-{
- return GetMessage(msg, hWnd, wMsgFilterMin, wMsgFilterMax);
-}
-
// This function is called by a workerthread
void WINAPI QT_WIN_CALLBACK qt_fast_timer_proc(uint timerId, uint /*reserved*/, DWORD_PTR user, DWORD_PTR /*reserved*/, DWORD_PTR /*reserved*/)
{
@@ -501,11 +481,16 @@ static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatch
wc.lpszClassName = reinterpret_cast<const wchar_t *> (className.utf16());
RegisterClass(&wc);
+#ifdef Q_OS_WINCE
+ HWND parent = 0;
+#else
+ HWND parent = HWND_MESSAGE;
+#endif
HWND wnd = CreateWindow(wc.lpszClassName, // classname
wc.lpszClassName, // window name
0, // style
0, 0, 0, 0, // geometry
- 0, // parent
+ parent, // parent
0, // menu handle
qWinAppInst(), // application
0); // windows creation data.
@@ -530,30 +515,29 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t)
Q_Q(QEventDispatcherWin32);
int ok = 0;
- if (t->interval > 20 || !t->interval || !qtimeSetEvent) {
+ uint interval = t->interval;
+ if (interval == 0u) {
+ // optimization for single-shot-zero-timer
+ QCoreApplication::postEvent(q, new QZeroTimerEvent(t->timerId));
ok = 1;
- if (!t->interval) // optimization for single-shot-zero-timer
- QCoreApplication::postEvent(q, new QZeroTimerEvent(t->timerId));
- else
- ok = SetTimer(internalHwnd, t->timerId, (uint) t->interval, 0);
- } else {
- ok = t->fastTimerId = qtimeSetEvent(t->interval, 1, qt_fast_timer_proc, (DWORD_PTR)t,
+ } else if ((interval < 20u || t->timerType == Qt::PreciseTimer) && qtimeSetEvent) {
+ ok = t->fastTimerId = qtimeSetEvent(interval, 1, qt_fast_timer_proc, (DWORD_PTR)t,
TIME_CALLBACK_FUNCTION | TIME_PERIODIC | TIME_KILL_SYNCHRONOUS);
- if (ok == 0) { // fall back to normal timer if no more multimedia timers available
- ok = SetTimer(internalHwnd, t->timerId, (uint) t->interval, 0);
- }
+ } else if (interval >= 20000u || t->timerType == Qt::VeryCoarseTimer) {
+ // round the interval, VeryCoarseTimers only have full second accuracy
+ interval = ((interval + 500)) / 1000 * 1000;
+ }
+ if (ok == 0) {
+ // user normal timers for (Very)CoarseTimers, or if no more multimedia timers available
+ ok = SetTimer(internalHwnd, t->timerId, interval, 0);
}
if (ok == 0)
qErrnoWarning("QEventDispatcherWin32::registerTimer: Failed to create a timer");
}
-void QEventDispatcherWin32Private::unregisterTimer(WinTimerInfo *t, bool closingDown)
+void QEventDispatcherWin32Private::unregisterTimer(WinTimerInfo *t)
{
- // mark timer as unused
- if (!QObjectPrivate::get(t->obj)->inThreadChangeEvent && !closingDown)
- QAbstractEventDispatcherPrivate::releaseTimerId(t->timerId);
-
if (t->interval == 0) {
QCoreApplicationPrivate::removePostedTimerEvent(t->dispatcher, t->timerId);
} else if (t->fastTimerId != 0) {
@@ -859,7 +843,7 @@ void QEventDispatcherWin32::unregisterSocketNotifier(QSocketNotifier *notifier)
d->doWsaAsyncSelect(sockfd);
}
-void QEventDispatcherWin32::registerTimer(int timerId, int interval, QObject *object)
+void QEventDispatcherWin32::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object)
{
if (timerId < 1 || interval < 0 || !object) {
qWarning("QEventDispatcherWin32::registerTimer: invalid arguments");
@@ -875,6 +859,7 @@ void QEventDispatcherWin32::registerTimer(int timerId, int interval, QObject *ob
t->dispatcher = this;
t->timerId = timerId;
t->interval = interval;
+ t->timerType = timerType;
t->obj = object;
t->inTimerEvent = false;
t->fastTimerId = 0;
@@ -953,7 +938,7 @@ QEventDispatcherWin32::registeredTimers(QObject *object) const
for (int i = 0; i < d->timerVec.size(); ++i) {
const WinTimerInfo *t = d->timerVec.at(i);
if (t && t->obj == object)
- list << TimerInfo(t->timerId, t->interval);
+ list << TimerInfo(t->timerId, t->interval, t->timerType);
}
return list;
}
@@ -1050,7 +1035,7 @@ void QEventDispatcherWin32::closingDown()
// clean up any timers
for (int i = 0; i < d->timerVec.count(); ++i)
- d->unregisterTimer(d->timerVec.at(i), true);
+ d->unregisterTimer(d->timerVec.at(i));
d->timerVec.clear();
d->timerDict.clear();
diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h
index 4a7aac0c04..833fcf13ac 100644
--- a/src/corelib/kernel/qeventdispatcher_win_p.h
+++ b/src/corelib/kernel/qeventdispatcher_win_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -84,7 +84,7 @@ public:
void registerSocketNotifier(QSocketNotifier *notifier);
void unregisterSocketNotifier(QSocketNotifier *notifier);
- void registerTimer(int timerId, int interval, QObject *object);
+ void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object);
bool unregisterTimer(int timerId);
bool unregisterTimers(QObject *object);
QList<TimerInfo> registeredTimers(QObject *object) const;
@@ -120,6 +120,7 @@ struct WinTimerInfo { // internal timer info
QObject *dispatcher;
int timerId;
int interval;
+ Qt::TimerType timerType;
QObject *obj; // - object to receive events
bool inTimerEvent;
int fastTimerId;
@@ -160,7 +161,7 @@ public:
WinTimerVec timerVec;
WinTimerDict timerDict;
void registerTimer(WinTimerInfo *t);
- void unregisterTimer(WinTimerInfo *t, bool closingDown = false);
+ void unregisterTimer(WinTimerInfo *t);
void sendTimerEvent(int timerId);
// socket notifiers
diff --git a/src/corelib/kernel/qeventloop.cpp b/src/corelib/kernel/qeventloop.cpp
index 37c06a2093..05e284ba34 100644
--- a/src/corelib/kernel/qeventloop.cpp
+++ b/src/corelib/kernel/qeventloop.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qeventloop.h b/src/corelib/kernel/qeventloop.h
index 5bd4146352..a76ba0ad93 100644
--- a/src/corelib/kernel/qeventloop.h
+++ b/src/corelib/kernel/qeventloop.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qfunctions_nacl.cpp b/src/corelib/kernel/qfunctions_nacl.cpp
index 410df0f1e8..76272154b3 100644
--- a/src/corelib/kernel/qfunctions_nacl.cpp
+++ b/src/corelib/kernel/qfunctions_nacl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qfunctions_nacl.h b/src/corelib/kernel/qfunctions_nacl.h
index c4c1fd0e2e..a2f5d928f0 100644
--- a/src/corelib/kernel/qfunctions_nacl.h
+++ b/src/corelib/kernel/qfunctions_nacl.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qfunctions_p.h b/src/corelib/kernel/qfunctions_p.h
index 1e75fec25d..88686e976a 100644
--- a/src/corelib/kernel/qfunctions_p.h
+++ b/src/corelib/kernel/qfunctions_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qfunctions_vxworks.cpp b/src/corelib/kernel/qfunctions_vxworks.cpp
index 845825740e..c39e6ad458 100644
--- a/src/corelib/kernel/qfunctions_vxworks.cpp
+++ b/src/corelib/kernel/qfunctions_vxworks.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qfunctions_vxworks.h b/src/corelib/kernel/qfunctions_vxworks.h
index d7d4ebe382..22dc7bcc06 100644
--- a/src/corelib/kernel/qfunctions_vxworks.h
+++ b/src/corelib/kernel/qfunctions_vxworks.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qfunctions_wince.cpp b/src/corelib/kernel/qfunctions_wince.cpp
index f0f1a071b9..8fd09679ce 100644
--- a/src/corelib/kernel/qfunctions_wince.cpp
+++ b/src/corelib/kernel/qfunctions_wince.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qfunctions_wince.h b/src/corelib/kernel/qfunctions_wince.h
index 5569b7c777..d634cba67e 100644
--- a/src/corelib/kernel/qfunctions_wince.h
+++ b/src/corelib/kernel/qfunctions_wince.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qmath.cpp b/src/corelib/kernel/qmath.cpp
index 376a707d66..fb5087092c 100644
--- a/src/corelib/kernel/qmath.cpp
+++ b/src/corelib/kernel/qmath.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h
index cc20f96166..793138a5e0 100644
--- a/src/corelib/kernel/qmath.h
+++ b/src/corelib/kernel/qmath.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qmath.qdoc b/src/corelib/kernel/qmath.qdoc
index 5b21740d3a..b2de54ee32 100644
--- a/src/corelib/kernel/qmath.qdoc
+++ b/src/corelib/kernel/qmath.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 3178ee1b26..d7cbab8e3a 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -657,26 +657,17 @@ static const QMetaObject *QMetaObject_findMetaObject(const QMetaObject *self, co
if (strcmp(self->d.stringdata, name) == 0)
return self;
if (self->d.extradata) {
-#ifdef Q_NO_DATA_RELOCATION
- const QMetaObjectAccessor *e;
- Q_ASSERT(priv(self->d.data)->revision >= 2);
-#else
const QMetaObject **e;
if (priv(self->d.data)->revision < 2) {
e = (const QMetaObject**)(self->d.extradata);
} else
-#endif
{
const QMetaObjectExtraData *extra = (const QMetaObjectExtraData*)(self->d.extradata);
e = extra->objects;
}
if (e) {
while (*e) {
-#ifdef Q_NO_DATA_RELOCATION
- if (const QMetaObject *m =QMetaObject_findMetaObject(&((*e)()), name))
-#else
if (const QMetaObject *m =QMetaObject_findMetaObject((*e), name))
-#endif
return m;
++e;
}
@@ -855,7 +846,7 @@ QMetaProperty QMetaObject::property(int index) const
Q_ASSERT(colon <= enum_name || *(colon-1) == ':');
if (colon > enum_name) {
int len = colon-enum_name-1;
- scope_buffer = (char *)qMalloc(len+1);
+ scope_buffer = (char *)malloc(len+1);
qMemCopy(scope_buffer, enum_name, len);
scope_buffer[len] = '\0';
scope_name = scope_buffer;
@@ -870,7 +861,7 @@ QMetaProperty QMetaObject::property(int index) const
if (scope)
result.menum = scope->enumerator(scope->indexOfEnumerator(enum_name));
if (scope_buffer)
- qFree(scope_buffer);
+ free(scope_buffer);
}
}
}
@@ -1644,9 +1635,9 @@ bool QMetaMethod::invoke(QObject *object,
}
int nargs = 1; // include return type
- void **args = (void **) qMalloc(paramCount * sizeof(void *));
+ void **args = (void **) malloc(paramCount * sizeof(void *));
Q_CHECK_PTR(args);
- int *types = (int *) qMalloc(paramCount * sizeof(int));
+ int *types = (int *) malloc(paramCount * sizeof(int));
Q_CHECK_PTR(types);
types[0] = 0; // return type
args[0] = 0;
@@ -1663,8 +1654,8 @@ bool QMetaMethod::invoke(QObject *object,
if (types[x] && args[x])
QMetaType::destroy(types[x], args[x]);
}
- qFree(types);
- qFree(args);
+ free(types);
+ free(args);
return false;
}
}
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index 47ccc9e2b7..61ca373745 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qmetaobject_moc_p.h b/src/corelib/kernel/qmetaobject_moc_p.h
index fd4e5d25c8..abfdc442c0 100644
--- a/src/corelib/kernel/qmetaobject_moc_p.h
+++ b/src/corelib/kernel/qmetaobject_moc_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h
index b99907e822..45fb95495c 100644
--- a/src/corelib/kernel/qmetaobject_p.h
+++ b/src/corelib/kernel/qmetaobject_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qmetaobjectbuilder.cpp b/src/corelib/kernel/qmetaobjectbuilder.cpp
index dd098e8a64..601d52529f 100644
--- a/src/corelib/kernel/qmetaobjectbuilder.cpp
+++ b/src/corelib/kernel/qmetaobjectbuilder.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -265,11 +265,7 @@ public:
QList<QByteArray> classInfoNames;
QList<QByteArray> classInfoValues;
QList<QMetaEnumBuilderPrivate> enumerators;
-#ifdef Q_NO_DATA_RELOCATION
- QList<QMetaObjectAccessor> relatedMetaObjects;
-#else
QList<const QMetaObject *> relatedMetaObjects;
-#endif
int flags;
};
@@ -695,11 +691,7 @@ int QMetaObjectBuilder::addClassInfo(const QByteArray& name, const QByteArray& v
\sa relatedMetaObjectCount(), relatedMetaObject()
\sa removeRelatedMetaObject()
*/
-#ifdef Q_NO_DATA_RELOCATION
-int QMetaObjectBuilder::addRelatedMetaObject(const QMetaObjectAccessor &meta)
-#else
int QMetaObjectBuilder::addRelatedMetaObject(const QMetaObject *meta)
-#endif
{
Q_ASSERT(meta);
int index = d->relatedMetaObjects.size();
@@ -772,14 +764,10 @@ void QMetaObjectBuilder::addMetaObject
}
if ((members & RelatedMetaObjects) != 0) {
-#ifdef Q_NO_DATA_RELOCATION
- const QMetaObjectAccessor *objects = 0;
-#else
const QMetaObject **objects;
if (priv(prototype->d.data)->revision < 2) {
objects = (const QMetaObject **)(prototype->d.extradata);
} else
-#endif
{
const QMetaObjectExtraData *extra = (const QMetaObjectExtraData *)(prototype->d.extradata);
if (extra)
@@ -871,11 +859,7 @@ QMetaEnumBuilder QMetaObjectBuilder::enumerator(int index) const
const QMetaObject *QMetaObjectBuilder::relatedMetaObject(int index) const
{
if (index >= 0 && index < d->relatedMetaObjects.size())
-#ifdef Q_NO_DATA_RELOCATION
- return &((*(d->relatedMetaObjects[index]))());
-#else
return d->relatedMetaObjects[index];
-#endif
else
return 0;
}
@@ -1414,13 +1398,8 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
reinterpret_cast<QMetaObjectExtraData *>(buf + size);
size += sizeof(QMetaObjectExtraData);
ALIGN(size, QMetaObject *);
-#ifdef Q_NO_DATA_RELOCATION
- QMetaObjectAccessor *objects =
- reinterpret_cast<QMetaObjectAccessor *>(buf + size);
-#else
const QMetaObject **objects =
reinterpret_cast<const QMetaObject **>(buf + size);
-#endif
if (buf) {
if (d->relatedMetaObjects.size() > 0) {
extra->objects = objects;
@@ -1444,7 +1423,7 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
/*!
Converts this meta object builder into a concrete QMetaObject.
- The return value should be deallocated using qFree() once it
+ The return value should be deallocated using free() once it
is no longer needed.
The returned meta object is a snapshot of the state of the
@@ -1455,7 +1434,7 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
QMetaObject *QMetaObjectBuilder::toMetaObject() const
{
int size = buildMetaObject(d, 0, false);
- char *buf = reinterpret_cast<char *>(qMalloc(size));
+ char *buf = reinterpret_cast<char *>(malloc(size));
memset(buf, 0, size);
buildMetaObject(d, buf, false);
return reinterpret_cast<QMetaObject *>(buf);
@@ -1619,14 +1598,10 @@ void QMetaObjectBuilder::serialize(QDataStream& stream) const
}
// Write the related meta objects.
-#ifdef Q_NO_DATA_RELOCATION
- //### What do we do here?
-#else
for (index = 0; index < d->relatedMetaObjects.size(); ++index) {
const QMetaObject *meta = d->relatedMetaObjects[index];
stream << QByteArray(meta->className());
}
-#endif
// Add an extra empty QByteArray for additional data in future versions.
// This should help maintain backwards compatibility, allowing older
@@ -1799,9 +1774,6 @@ void QMetaObjectBuilder::deserialize
}
// Read the related meta objects.
-#ifdef Q_NO_DATA_RELOCATION
- //### What do we do here
-#else
for (index = 0; index < relatedMetaObjectCount; ++index) {
if (stream.status() != QDataStream::Ok)
return;
@@ -1813,7 +1785,6 @@ void QMetaObjectBuilder::deserialize
}
addRelatedMetaObject(cl);
}
-#endif
// Read the extra data block, which is reserved for future use.
stream >> name;
diff --git a/src/corelib/kernel/qmetaobjectbuilder_p.h b/src/corelib/kernel/qmetaobjectbuilder_p.h
index a563d6a5cd..bf3fd2499c 100644
--- a/src/corelib/kernel/qmetaobjectbuilder_p.h
+++ b/src/corelib/kernel/qmetaobjectbuilder_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -136,11 +136,7 @@ public:
int addClassInfo(const QByteArray& name, const QByteArray& value);
-#ifdef Q_NO_DATA_RELOCATION
- int addRelatedMetaObject(const QMetaObjectAccessor &meta);
-#else
int addRelatedMetaObject(const QMetaObject *meta);
-#endif
void addMetaObject(const QMetaObject *prototype, QMetaObjectBuilder::AddMembers members = AllMembers);
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 76537c79cb..375c7b75bb 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -50,6 +50,7 @@
#include "qvector.h"
#include "qlocale.h"
#include "qeasingcurve.h"
+#include "quuid.h"
#include "qvariant.h"
#include "qmetatypeswitcher_p.h"
@@ -61,6 +62,7 @@
# include "qbitarray.h"
# include "qurl.h"
# include "qvariant.h"
+# include "qabstractitemmodel.h"
#endif
#ifndef QT_NO_GEOM_VARIANT
@@ -107,6 +109,7 @@ template<> struct TypeDefiniton<QVariant> { static const bool IsAvailable = fals
template<> struct TypeDefiniton<QBitArray> { static const bool IsAvailable = false; };
template<> struct TypeDefiniton<QUrl> { static const bool IsAvailable = false; };
template<> struct TypeDefiniton<QEasingCurve> { static const bool IsAvailable = false; };
+template<> struct TypeDefiniton<QModelIndex> { static const bool IsAvailable = false; };
#endif
#ifdef QT_NO_REGEXP
template<> struct TypeDefiniton<QRegExp> { static const bool IsAvailable = false; };
@@ -240,6 +243,16 @@ template<> struct TypeDefiniton<QRegExp> { static const bool IsAvailable = false
*/
/*!
+ \enum QMetaType::TypeFlags
+
+ The enum describes attributes of a type supported by QMetaType.
+
+ \value NeedsConstruction This type has non-trivial constructors. If the flag is not set instances can be safely initialized with memset to 0.
+ \value NeedsDestruction This type has a non-trivial destructor. If the flag is not set calls to the destructor are not necessary before discarding objects.
+ \value MovableType An instance of a type having this attribute can be safely moved by memcpy.
+*/
+
+/*!
\class QMetaType
\brief The QMetaType class manages named types in the meta-object system.
@@ -297,6 +310,14 @@ public:
int alias;
};
+namespace
+{
+union CheckThatItIsPod
+{ // This should break if QMetaTypeInterface is not a POD type
+ QMetaTypeInterface iface;
+};
+}
+
Q_DECLARE_TYPEINFO(QCustomTypeInfo, Q_MOVABLE_TYPE);
Q_GLOBAL_STATIC(QVector<QCustomTypeInfo>, customTypes)
Q_GLOBAL_STATIC(QReadWriteLock, customTypesLock)
@@ -415,7 +436,7 @@ static int qMetaTypeCustomType_unlocked(const char *typeName, int length)
int QMetaType::registerType(const char *typeName, Deleter deleter,
Creator creator)
{
- return registerType(typeName, deleter, creator, 0, 0, 0);
+ return registerType(typeName, deleter, creator, 0, 0, 0, TypeFlags());
}
/*! \internal
@@ -430,7 +451,7 @@ int QMetaType::registerType(const char *typeName, Deleter deleter,
Creator creator,
Destructor destructor,
Constructor constructor,
- int size)
+ int size, TypeFlags flags)
{
QVector<QCustomTypeInfo> *ct = customTypes();
if (!ct || !typeName || !deleter || !creator)
@@ -454,10 +475,15 @@ int QMetaType::registerType(const char *typeName, Deleter deleter,
inf.typeName = normalizedTypeName;
inf.creator = creator;
inf.deleter = deleter;
+#ifndef QT_NO_DATASTREAM
+ inf.loadOp = 0;
+ inf.saveOp = 0;
+#endif
inf.alias = -1;
inf.constructor = constructor;
inf.destructor = destructor;
inf.size = size;
+ inf.flags = flags;
idx = ct->size() + User;
ct->append(inf);
}
@@ -765,6 +791,9 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data)
return false;
qMetaTypeWidgetsHelper[type - FirstWidgetsType].saveOp(stream, data);
break;
+ case QMetaType::QUuid:
+ stream << *static_cast<const NS(QUuid)*>(data);
+ break;
default: {
const QVector<QCustomTypeInfo> * const ct = customTypes();
if (!ct)
@@ -972,6 +1001,9 @@ bool QMetaType::load(QDataStream &stream, int type, void *data)
return false;
qMetaTypeWidgetsHelper[type - FirstWidgetsType].loadOp(stream, data);
break;
+ case QMetaType::QUuid:
+ stream >> *static_cast< NS(QUuid)*>(data);
+ break;
default: {
const QVector<QCustomTypeInfo> * const ct = customTypes();
if (!ct)
@@ -1092,6 +1124,12 @@ void *QMetaType::create(int type, const void *copy)
case QMetaType::QEasingCurve:
return new NS(QEasingCurve)(*static_cast<const NS(QEasingCurve)*>(copy));
#endif
+ case QMetaType::QUuid:
+ return new NS(QUuid)(*static_cast<const NS(QUuid)*>(copy));
+#ifndef QT_BOOTSTRAPPED
+ case QMetaType::QModelIndex:
+ return new NS(QModelIndex)(*static_cast<const NS(QModelIndex)*>(copy));
+#endif
case QMetaType::Void:
return 0;
default:
@@ -1189,6 +1227,12 @@ void *QMetaType::create(int type, const void *copy)
case QMetaType::QEasingCurve:
return new NS(QEasingCurve);
#endif
+ case QMetaType::QUuid:
+ return new NS(QUuid);
+#ifndef QT_BOOTSTRAPPED
+ case QMetaType::QModelIndex:
+ return new NS(QModelIndex);
+#endif
case QMetaType::Void:
return 0;
default:
@@ -1356,6 +1400,14 @@ void QMetaType::destroy(int type, void *data)
delete static_cast< NS(QEasingCurve)* >(data);
break;
#endif
+ case QMetaType::QUuid:
+ delete static_cast< NS(QUuid)* >(data);
+ break;
+#ifndef QT_BOOTSTRAPPED
+ case QMetaType::QModelIndex:
+ delete static_cast< NS(QModelIndex)* >(data);
+ break;
+#endif
case QMetaType::Void:
break;
default: {
@@ -1387,9 +1439,8 @@ void QMetaType::destroy(int type, void *data)
}
namespace {
-template<class Filter>
class TypeConstructor {
- template<typename T, bool IsAcceptedType = Filter::template Acceptor<T>::IsAccepted>
+ template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted>
struct ConstructorImpl {
static void *Construct(const int /*type*/, void *where, const T *copy) { return qMetaTypeConstructHelper(where, copy); }
};
@@ -1398,13 +1449,11 @@ class TypeConstructor {
static void *Construct(const int type, void *where, const T *copy)
{
QMetaType::Constructor ctor = 0;
- if (type >= QMetaType::FirstGuiType && type <= QMetaType::LastGuiType) {
- Q_ASSERT(qMetaTypeGuiHelper);
+ if (QTypeModuleInfo<T>::IsGui) {
if (!qMetaTypeGuiHelper)
return 0;
ctor = qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].constructor;
- } else if (type >= QMetaType::FirstWidgetsType && type <= QMetaType::LastWidgetsType) {
- Q_ASSERT(qMetaTypeWidgetsHelper);
+ } else if (QTypeModuleInfo<T>::IsWidget) {
if (!qMetaTypeWidgetsHelper)
return 0;
ctor = qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].constructor;
@@ -1474,15 +1523,14 @@ void *QMetaType::construct(int type, void *where, const void *copy)
{
if (!where)
return 0;
- TypeConstructor<DefinedTypesFilter> constructor(type, where);
+ TypeConstructor constructor(type, where);
return QMetaTypeSwitcher::switcher<void*>(constructor, type, copy);
}
namespace {
-template<class Filter>
class TypeDestructor {
- template<typename T, bool IsAcceptedType = Filter::template Acceptor<T>::IsAccepted>
+ template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted>
struct DestructorImpl {
static void Destruct(const int /* type */, T *where) { qMetaTypeDestructHelper(where); }
};
@@ -1491,13 +1539,11 @@ class TypeDestructor {
static void Destruct(const int type, void *where)
{
QMetaType::Destructor dtor = 0;
- if (type >= QMetaType::FirstGuiType && type <= QMetaType::LastGuiType) {
- Q_ASSERT(qMetaTypeGuiHelper);
+ if (QTypeModuleInfo<T>::IsGui) {
if (!qMetaTypeGuiHelper)
return;
dtor = qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].destructor;
- } else if (type >= QMetaType::FirstWidgetsType && type <= QMetaType::LastWidgetsType) {
- Q_ASSERT(qMetaTypeWidgetsHelper);
+ } else if (QTypeModuleInfo<T>::IsWidget) {
if (!qMetaTypeWidgetsHelper)
return;
dtor = qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].destructor;
@@ -1550,15 +1596,14 @@ void QMetaType::destruct(int type, void *where)
{
if (!where)
return;
- TypeDestructor<DefinedTypesFilter> destructor(type);
+ TypeDestructor destructor(type);
QMetaTypeSwitcher::switcher<void>(destructor, type, where);
}
namespace {
-template<class Filter>
class SizeOf {
- template<typename T, bool IsAcceptedType = Filter::template Acceptor<T>::IsAccepted>
+ template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted>
struct SizeOfImpl {
static int Size(const int) { return sizeof(T); }
};
@@ -1566,13 +1611,11 @@ class SizeOf {
struct SizeOfImpl<T, /* IsAcceptedType = */ false> {
static int Size(const int type)
{
- if (type >= QMetaType::FirstGuiType && type <= QMetaType::LastGuiType) {
- Q_ASSERT(qMetaTypeGuiHelper);
+ if (QTypeModuleInfo<T>::IsGui) {
if (!qMetaTypeGuiHelper)
return 0;
return qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].size;
- } else if (type >= QMetaType::FirstWidgetsType && type <= QMetaType::LastWidgetsType) {
- Q_ASSERT(qMetaTypeWidgetsHelper);
+ } else if (QTypeModuleInfo<T>::IsWidget) {
if (!qMetaTypeWidgetsHelper)
return 0;
return qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].size;
@@ -1617,10 +1660,77 @@ private:
*/
int QMetaType::sizeOf(int type)
{
- SizeOf<DefinedTypesFilter> sizeOf(type);
+ SizeOf sizeOf(type);
return QMetaTypeSwitcher::switcher<int>(sizeOf, type, 0);
}
+namespace {
+class Flags
+{
+ template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted>
+ struct FlagsImpl
+ {
+ static quint32 Flags(const int)
+ {
+ return (!QTypeInfo<T>::isStatic * QMetaType::MovableType)
+ | (QTypeInfo<T>::isComplex * QMetaType::NeedsConstruction)
+ | (QTypeInfo<T>::isComplex * QMetaType::NeedsDestruction);
+ }
+ };
+ template<typename T>
+ struct FlagsImpl<T, /* IsAcceptedType = */ false>
+ {
+ static quint32 Flags(const int type)
+ {
+ return Flags::undefinedTypeFlags(type);
+ }
+ };
+public:
+ Flags(const int type)
+ : m_type(type)
+ {}
+ template<typename T>
+ quint32 delegate(const T*) { return FlagsImpl<T>::Flags(m_type); }
+ quint32 delegate(const QMetaTypeSwitcher::UnknownType*) { return customTypeFlags(m_type); }
+private:
+ const int m_type;
+ static quint32 customTypeFlags(const int type)
+ {
+ const QVector<QCustomTypeInfo> * const ct = customTypes();
+ if (!ct)
+ return 0;
+ QReadLocker locker(customTypesLock());
+ if (ct->count() <= type - QMetaType::User)
+ return 0;
+ return ct->at(type - QMetaType::User).flags;
+ }
+ static quint32 undefinedTypeFlags(const int type);
+};
+
+quint32 Flags::undefinedTypeFlags(const int type)
+{
+ if (type >= QMetaType::FirstGuiType && type <= QMetaType::LastGuiType)
+ return qMetaTypeGuiHelper ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].flags : 0;
+ else if (type >= QMetaType::FirstWidgetsType && type <= QMetaType::LastWidgetsType)
+ return qMetaTypeWidgetsHelper ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].flags : 0;
+ return customTypeFlags(type);
+}
+
+} // namespace
+
+/*!
+ \since 5.0
+
+ Returns flags of the given \a type.
+
+ \sa TypeFlags()
+*/
+QMetaType::TypeFlags QMetaType::typeFlags(int type)
+{
+ Flags flags(type);
+ return static_cast<QMetaType::TypeFlags>(QMetaTypeSwitcher::switcher<quint32>(flags, type, 0));
+}
+
/*!
\fn int qRegisterMetaType(const char *typeName)
\relates QMetaType
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 717e72c810..843044eee6 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -98,6 +98,8 @@ QT_MODULE(Core)
F(QPointF, 26, QPointF) \
F(QRegExp, 27, QRegExp) \
F(QEasingCurve, 29, QEasingCurve) \
+ F(QUuid, 30, QUuid) \
+ F(QModelIndex, 31, QModelIndex) \
F(QVariant, 138, QVariant) \
#define QT_FOR_EACH_STATIC_CORE_POINTER(F)\
@@ -182,7 +184,7 @@ public:
// these are merged with QVariant
QT_FOR_EACH_STATIC_TYPE(QT_DEFINE_METATYPE_ID)
- LastCoreType = QEasingCurve,
+ LastCoreType = QModelIndex,
FirstGuiType = QFont,
LastGuiType = QPolygonF,
FirstWidgetsType = QIcon,
@@ -202,6 +204,13 @@ public:
User = 256
};
+ enum TypeFlag {
+ NeedsConstruction = 0x1,
+ NeedsDestruction = 0x2,
+ MovableType = 0x4
+ };
+ Q_DECLARE_FLAGS(TypeFlags, TypeFlag)
+
typedef void (*Deleter)(void *);
typedef void *(*Creator)(const void *);
@@ -222,11 +231,13 @@ public:
Creator creator,
Destructor destructor,
Constructor constructor,
- int size);
+ int size,
+ QMetaType::TypeFlags flags);
static int registerTypedef(const char *typeName, int aliasId);
static int type(const char *typeName);
static const char *typeName(int type);
static int sizeOf(int type);
+ static TypeFlags typeFlags(int type);
static bool isRegistered(int type);
static void *create(int type, const void *copy = 0);
#if QT_DEPRECATED_SINCE(5, 0)
@@ -246,6 +257,8 @@ public:
#undef QT_DEFINE_METATYPE_ID
+Q_DECLARE_OPERATORS_FOR_FLAGS(QMetaType::TypeFlags)
+
template <typename T>
void qMetaTypeDeleteHelper(T *t)
{
@@ -334,11 +347,20 @@ int qRegisterMetaType(const char *typeName
typedef void(*DestructPtr)(T*);
DestructPtr ipdptr = qMetaTypeDestructHelper<T>;
+ QMetaType::TypeFlags flags;
+ if (!QTypeInfo<T>::isStatic)
+ flags |= QMetaType::MovableType;
+ if (QTypeInfo<T>::isComplex) {
+ flags |= QMetaType::NeedsConstruction;
+ flags |= QMetaType::NeedsDestruction;
+ }
+
return QMetaType::registerType(typeName, reinterpret_cast<QMetaType::Deleter>(dptr),
reinterpret_cast<QMetaType::Creator>(cptr),
reinterpret_cast<QMetaType::Destructor>(ipdptr),
reinterpret_cast<QMetaType::Constructor>(ipcptr),
- sizeof(T));
+ sizeof(T),
+ flags);
}
#ifndef QT_NO_DATASTREAM
diff --git a/src/corelib/kernel/qmetatype_p.h b/src/corelib/kernel/qmetatype_p.h
index 92311afc8e..11139288d1 100644
--- a/src/corelib/kernel/qmetatype_p.h
+++ b/src/corelib/kernel/qmetatype_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -57,11 +57,22 @@
QT_BEGIN_NAMESPACE
-enum { /* TYPEMODULEINFO flags */
- Q_CORE_TYPE = 1,
- Q_GUI_TYPE = 2,
- Q_WIDGET_TYPE = 3
-};
+namespace QModulesPrivate {
+enum Names { Core, Gui, Widgets, Unknown, ModulesCount /* ModulesCount has to be at the end */ };
+
+static inline int moduleForType(const int typeId)
+{
+ if (typeId <= QMetaType::LastCoreType)
+ return Core;
+ if (typeId <= QMetaType::LastGuiType)
+ return Gui;
+ if (typeId <= QMetaType::LastWidgetsType)
+ return Widgets;
+ if (typeId <= QMetaType::LastCoreExtType)
+ return Core;
+ return Unknown;
+}
+}
template <typename T>
class QTypeModuleInfo
@@ -73,7 +84,6 @@ public:
IsGui = false,
IsUnknown = !IsCore
};
- static inline int module() { return IsCore ? Q_CORE_TYPE : 0; }
};
#define QT_ASSIGN_TYPE_TO_MODULE(TYPE, MODULE) \
@@ -82,9 +92,9 @@ class QTypeModuleInfo<TYPE > \
{ \
public: \
enum Module { \
- IsCore = (((MODULE) == (Q_CORE_TYPE))), \
- IsWidget = (((MODULE) == (Q_WIDGET_TYPE))), \
- IsGui = (((MODULE) == (Q_GUI_TYPE))), \
+ IsCore = (((MODULE) == (QModulesPrivate::Core))), \
+ IsWidget = (((MODULE) == (QModulesPrivate::Widgets))), \
+ IsGui = (((MODULE) == (QModulesPrivate::Gui))), \
IsUnknown = !(IsCore || IsWidget || IsGui) \
}; \
static inline int module() { return MODULE; } \
@@ -96,11 +106,11 @@ public: \
#define QT_DECLARE_CORE_MODULE_TYPES_ITER(TypeName, TypeId, Name) \
- QT_ASSIGN_TYPE_TO_MODULE(Name, Q_CORE_TYPE);
+ QT_ASSIGN_TYPE_TO_MODULE(Name, QModulesPrivate::Core);
#define QT_DECLARE_GUI_MODULE_TYPES_ITER(TypeName, TypeId, Name) \
- QT_ASSIGN_TYPE_TO_MODULE(Name, Q_GUI_TYPE);
+ QT_ASSIGN_TYPE_TO_MODULE(Name, QModulesPrivate::Gui);
#define QT_DECLARE_WIDGETS_MODULE_TYPES_ITER(TypeName, TypeId, Name) \
- QT_ASSIGN_TYPE_TO_MODULE(Name, Q_WIDGET_TYPE);
+ QT_ASSIGN_TYPE_TO_MODULE(Name, QModulesPrivate::Widgets);
QT_FOR_EACH_STATIC_CORE_CLASS(QT_DECLARE_CORE_MODULE_TYPES_ITER)
QT_FOR_EACH_STATIC_CORE_TEMPLATE(QT_DECLARE_CORE_MODULE_TYPES_ITER)
@@ -113,7 +123,7 @@ QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_DECLARE_WIDGETS_MODULE_TYPES_ITER)
class QMetaTypeInterface
{
-private:
+public:
template<typename T>
struct Impl {
static void *creator(const T *t)
@@ -140,31 +150,6 @@ private:
return new (where) T;
}
};
-public:
- template<typename T>
- explicit QMetaTypeInterface(T *)
- : creator(reinterpret_cast<QMetaType::Creator>(Impl<T>::creator))
- , deleter(reinterpret_cast<QMetaType::Deleter>(Impl<T>::deleter))
- #ifndef QT_NO_DATASTREAM
- , saveOp(reinterpret_cast<QMetaType::SaveOperator>(Impl<T>::saver))
- , loadOp(reinterpret_cast<QMetaType::LoadOperator>(Impl<T>::loader))
- #endif
- , constructor(reinterpret_cast<QMetaType::Constructor>(Impl<T>::constructor))
- , destructor(reinterpret_cast<QMetaType::Destructor>(Impl<T>::destructor))
- , size(sizeof(T))
- {}
-
- QMetaTypeInterface()
- : creator(0)
- , deleter(0)
- #ifndef QT_NO_DATASTREAM
- , saveOp(0)
- , loadOp(0)
- #endif
- , constructor(0)
- , destructor(0)
- , size(0)
- {}
QMetaType::Creator creator;
QMetaType::Deleter deleter;
@@ -175,8 +160,30 @@ public:
QMetaType::Constructor constructor;
QMetaType::Destructor destructor;
int size;
+ quint32 flags; // same as QMetaType::TypeFlags
};
+#ifndef QT_NO_DATASTREAM
+# define QT_METATYPE_INTERFACE_INIT_DATASTREAM_IMPL(Type) \
+ /*saveOp*/(reinterpret_cast<QMetaType::SaveOperator>(QMetaTypeInterface::Impl<Type>::saver)), \
+ /*loadOp*/(reinterpret_cast<QMetaType::LoadOperator>(QMetaTypeInterface::Impl<Type>::loader)),
+#else
+# define QT_METATYPE_INTERFACE_INIT_DATASTREAM_IMPL(Type)
+#endif
+
+#define QT_METATYPE_INTERFACE_INIT(Type) \
+{ \
+ /*creator*/(reinterpret_cast<QMetaType::Creator>(QMetaTypeInterface::Impl<Type>::creator)), \
+ /*deleter*/(reinterpret_cast<QMetaType::Deleter>(QMetaTypeInterface::Impl<Type>::deleter)), \
+ QT_METATYPE_INTERFACE_INIT_DATASTREAM_IMPL(Type) \
+ /*constructor*/(reinterpret_cast<QMetaType::Constructor>(QMetaTypeInterface::Impl<Type>::constructor)), \
+ /*destructor*/(reinterpret_cast<QMetaType::Destructor>(QMetaTypeInterface::Impl<Type>::destructor)), \
+ /*size*/(sizeof(Type)), \
+ /*flags*/(!QTypeInfo<Type>::isStatic * QMetaType::MovableType) \
+ | (QTypeInfo<Type>::isComplex * QMetaType::NeedsConstruction) \
+ | (QTypeInfo<Type>::isComplex * QMetaType::NeedsDestruction) \
+}
+
QT_END_NAMESPACE
#endif // QMETATYPE_P_H
diff --git a/src/corelib/kernel/qmetatypeswitcher_p.h b/src/corelib/kernel/qmetatypeswitcher_p.h
index cba6504956..d3cf1024c3 100644
--- a/src/corelib/kernel/qmetatypeswitcher_p.h
+++ b/src/corelib/kernel/qmetatypeswitcher_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp
index 9d1e03e9e8..c43ef505fb 100644
--- a/src/corelib/kernel/qmimedata.cpp
+++ b/src/corelib/kernel/qmimedata.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qmimedata.h b/src/corelib/kernel/qmimedata.h
index e8f32ed43c..60498b7ab8 100644
--- a/src/corelib/kernel/qmimedata.h
+++ b/src/corelib/kernel/qmimedata.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index e4ef826ffd..bebdcac662 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -44,6 +44,7 @@
#include "qmetaobject_p.h"
#include "qabstracteventdispatcher.h"
+#include "qabstracteventdispatcher_p.h"
#include "qcoreapplication.h"
#include "qcoreapplication_p.h"
#include "qvariant.h"
@@ -162,30 +163,28 @@ QObjectPrivate::QObjectPrivate(int version)
q_ptr = 0;
parent = 0; // no parent yet. It is set by setParent()
isWidget = false; // assume not a widget object
- pendTimer = false; // no timers yet
blockSig = false; // not blocking signals
wasDeleted = false; // double-delete catcher
+ isDeletingChildren = false; // set by deleteChildren()
sendChildEvents = true; // if we should send ChildInsert and ChildRemove events to parent
receiveChildEvents = true;
postedEvents = 0;
extraData = 0;
connectedSignals[0] = connectedSignals[1] = 0;
- inThreadChangeEvent = false;
-#ifdef QT_JAMBI_BUILD
- inEventHandler = false;
- deleteWatch = 0;
-#endif
metaObject = 0;
- hasGuards = false;
isWindow = false;
}
QObjectPrivate::~QObjectPrivate()
{
- if (pendTimer) {
+ if (!runningTimers.isEmpty()) {
// unregister pending timers
if (threadData->eventDispatcher)
threadData->eventDispatcher->unregisterTimers(q_ptr);
+
+ // release the timer ids back to the pool
+ for (int i = 0; i < runningTimers.size(); ++i)
+ QAbstractEventDispatcherPrivate::releaseTimerId(runningTimers.at(i));
}
if (postedEvents)
@@ -194,10 +193,6 @@ QObjectPrivate::~QObjectPrivate()
threadData->deref();
delete static_cast<QAbstractDynamicMetaObject*>(metaObject);
-#ifdef QT_JAMBI_BUILD
- if (deleteWatch)
- *deleteWatch = 1;
-#endif
#ifndef QT_NO_USERDATA
if (extraData)
qDeleteAll(extraData->userData);
@@ -205,25 +200,6 @@ QObjectPrivate::~QObjectPrivate()
#endif
}
-
-#ifdef QT_JAMBI_BUILD
-int *QObjectPrivate::setDeleteWatch(QObjectPrivate *d, int *w) {
- int *old = d->deleteWatch;
- d->deleteWatch = w;
- return old;
-}
-
-
-void QObjectPrivate::resetDeleteWatch(QObjectPrivate *d, int *oldWatch, int deleteWatch) {
- if (!deleteWatch)
- d->deleteWatch = oldWatch;
-
- if (oldWatch)
- *oldWatch = deleteWatch;
-}
-#endif
-
-
/*!\internal
For a given metaobject, compute the signal offset, and the method offset (including signals)
*/
@@ -408,113 +384,6 @@ void QObjectPrivate::cleanConnectionLists()
}
}
-typedef QMultiHash<QObject *, QObject **> GuardHash;
-Q_GLOBAL_STATIC(GuardHash, guardHash)
-Q_GLOBAL_STATIC(QMutex, guardHashLock)
-
-/*!\internal
- */
-void QMetaObject::addGuard(QObject **ptr)
-{
- if (!*ptr)
- return;
- GuardHash *hash = guardHash();
- if (!hash) {
- *ptr = 0;
- return;
- }
- QMutexLocker locker(guardHashLock());
- QObjectPrivate::get(*ptr)->hasGuards = true;
- hash->insert(*ptr, ptr);
-}
-
-/*!\internal
- */
-void QMetaObject::removeGuard(QObject **ptr)
-{
- if (!*ptr)
- return;
- GuardHash *hash = guardHash();
- /* check that the hash is empty - otherwise we might detach
- the shared_null hash, which will alloc, which is not nice */
- if (!hash || hash->isEmpty())
- return;
- QMutexLocker locker(guardHashLock());
- if (!*ptr) //check again, under the lock
- return;
- GuardHash::iterator it = hash->find(*ptr);
- const GuardHash::iterator end = hash->end();
- bool more = false; //if the QObject has more pointer attached to it.
- for (; it.key() == *ptr && it != end; ++it) {
- if (it.value() == ptr) {
- it = hash->erase(it);
- if (!more) more = (it != end && it.key() == *ptr);
- break;
- }
- more = true;
- }
- if (!more)
- QObjectPrivate::get(*ptr)->hasGuards = false;
-}
-
-/*!\internal
- */
-void QMetaObject::changeGuard(QObject **ptr, QObject *o)
-{
- GuardHash *hash = guardHash();
- if (!hash) {
- *ptr = 0;
- return;
- }
- QMutexLocker locker(guardHashLock());
- if (o) {
- hash->insert(o, ptr);
- QObjectPrivate::get(o)->hasGuards = true;
- }
- if (*ptr) {
- bool more = false; //if the QObject has more pointer attached to it.
- GuardHash::iterator it = hash->find(*ptr);
- const GuardHash::iterator end = hash->end();
- for (; it.key() == *ptr && it != end; ++it) {
- if (it.value() == ptr) {
- it = hash->erase(it);
- if (!more) more = (it != end && it.key() == *ptr);
- break;
- }
- more = true;
- }
- if (!more)
- QObjectPrivate::get(*ptr)->hasGuards = false;
- }
- *ptr = o;
-}
-
-/*! \internal
- */
-void QObjectPrivate::clearGuards(QObject *object)
-{
- GuardHash *hash = 0;
- QMutex *mutex = 0;
- QT_TRY {
- hash = guardHash();
- mutex = guardHashLock();
- } QT_CATCH(const std::bad_alloc &) {
- // do nothing in case of OOM - code below is safe
- }
-
- /* check that the hash is empty - otherwise we might detach
- the shared_null hash, which will alloc, which is not nice */
- if (hash && !hash->isEmpty()) {
- QMutexLocker locker(mutex);
- GuardHash::iterator it = hash->find(object);
- const GuardHash::iterator end = hash->end();
- while (it.key() == object && it != end) {
- *it.value() = 0;
- it = hash->erase(it);
- }
- }
-}
-
/*! \internal
*/
QMetaCallEvent::QMetaCallEvent(ushort method_offset, ushort method_relative, QObjectPrivate::StaticMetaCallFunction callFunction,
@@ -546,8 +415,8 @@ QMetaCallEvent::~QMetaCallEvent()
if (types_[i] && args_[i])
QMetaType::destroy(types_[i], args_[i]);
}
- qFree(types_);
- qFree(args_);
+ free(types_);
+ free(args_);
}
#ifndef QT_NO_THREAD
if (semaphore_)
@@ -563,7 +432,7 @@ void QMetaCallEvent::placeMetaCall(QObject *object)
{
if (slotObj_) {
slotObj_->call(object, args_);
- } else if (callFunction_) {
+ } else if (callFunction_ && method_offset_ <= object->metaObject()->methodOffset()) {
callFunction_(object, QMetaObject::InvokeMetaMethod, method_relative_, args_);
} else {
QMetaObject::metacall(object, QMetaObject::InvokeMetaMethod, method_offset_ + method_relative_, args_);
@@ -839,12 +708,6 @@ QObject::~QObject()
d->wasDeleted = true;
d->blockSig = 0; // unblock signals so we always emit destroyed()
- if (d->hasGuards && !d->isWidget) {
- // set all QPointers for this object to zero - note that
- // ~QWidget() does this for us, so we don't have to do it twice
- QObjectPrivate::clearGuards(this);
- }
-
QtSharedPointer::ExternalRefCountData *sharedRefcount = d->sharedRefcount.load();
if (sharedRefcount) {
if (sharedRefcount->strongref.load() > 0) {
@@ -950,13 +813,6 @@ QObject::~QObject()
if (d->parent) // remove it from parent object
d->setParent_helper(0);
-
-#ifdef QT_JAMBI_BUILD
- if (d->inEventHandler) {
- qWarning("QObject: Do not delete object, '%s', during its event handler!",
- objectName().isNull() ? "unnamed" : qPrintable(objectName()));
- }
-#endif
}
QObjectPrivate::Connection::~Connection()
@@ -1096,13 +952,20 @@ QString QObject::objectName() const
void QObject::setObjectName(const QString &name)
{
Q_D(QObject);
- bool objectNameChanged = d->declarativeData && d->objectName != name;
+ if (d->objectName != name) {
+ d->objectName = name;
+ if (d->declarativeData)
+ d->declarativeData->objectNameChanged(d->declarativeData, this);
+ emit objectNameChanged(d->objectName);
+ }
+}
- d->objectName = name;
+/*! \fn void QObject::objectNameChanged(const QString &objectName)
- if (objectNameChanged)
- d->declarativeData->objectNameChanged(d->declarativeData, this);
-}
+ This signal is emitted after the object's name has been changed. The new object name is passed as \a objectName.
+
+ \sa QObject::objectName
+*/
/*!
\fn bool QObject::isWidgetType() const
@@ -1144,9 +1007,6 @@ bool QObject::event(QEvent *e)
case QEvent::MetaCall:
{
-#ifdef QT_JAMBI_BUILD
- d_func()->inEventHandler = false;
-#endif
QMetaCallEvent *mce = static_cast<QMetaCallEvent*>(e);
QConnectionSenderSwitcher sw(this, const_cast<QObject*>(mce->sender()), mce->signalId());
@@ -1160,15 +1020,12 @@ bool QObject::event(QEvent *e)
QThreadData *threadData = d->threadData;
QAbstractEventDispatcher *eventDispatcher = threadData->eventDispatcher;
if (eventDispatcher) {
- QList<QPair<int, int> > timers = eventDispatcher->registeredTimers(this);
+ QList<QAbstractEventDispatcher::TimerInfo> timers = eventDispatcher->registeredTimers(this);
if (!timers.isEmpty()) {
- // set inThreadChangeEvent to true to tell the dispatcher not to release out timer ids
- // back to the pool (since the timer ids are moving to a new thread).
- d->inThreadChangeEvent = true;
+ // do not to release our timer ids back to the pool (since the timer ids are moving to a new thread).
eventDispatcher->unregisterTimers(this);
- d->inThreadChangeEvent = false;
QMetaObject::invokeMethod(this, "_q_reregisterTimers", Qt::QueuedConnection,
- Q_ARG(void*, (new QList<QPair<int, int> >(timers))));
+ Q_ARG(void*, (new QList<QAbstractEventDispatcher::TimerInfo>(timers))));
}
}
break;
@@ -1451,15 +1308,6 @@ void QObjectPrivate::setThreadData_helper(QThreadData *currentData, QThreadData
currentSender->ref = 0;
currentSender = 0;
-#ifdef QT_JAMBI_BUILD
- // the current event thread also shouldn't restore the delete watch
- inEventHandler = false;
-
- if (deleteWatch)
- *deleteWatch = 1;
- deleteWatch = 0;
-#endif
-
// set new thread data
targetData->ref();
threadData->deref();
@@ -1474,11 +1322,11 @@ void QObjectPrivate::setThreadData_helper(QThreadData *currentData, QThreadData
void QObjectPrivate::_q_reregisterTimers(void *pointer)
{
Q_Q(QObject);
- QList<QPair<int, int> > *timerList = reinterpret_cast<QList<QPair<int, int> > *>(pointer);
+ QList<QAbstractEventDispatcher::TimerInfo> *timerList = reinterpret_cast<QList<QAbstractEventDispatcher::TimerInfo> *>(pointer);
QAbstractEventDispatcher *eventDispatcher = threadData->eventDispatcher;
for (int i = 0; i < timerList->size(); ++i) {
- const QPair<int, int> &pair = timerList->at(i);
- eventDispatcher->registerTimer(pair.first, pair.second, q);
+ const QAbstractEventDispatcher::TimerInfo &ti = timerList->at(i);
+ eventDispatcher->registerTimer(ti.timerId, ti.interval, ti.timerType, q);
}
delete timerList;
}
@@ -1510,10 +1358,12 @@ void QObjectPrivate::_q_reregisterTimers(void *pointer)
\snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 8
- Note that QTimer's accuracy depends on the underlying operating
- system and hardware. Most platforms support an accuracy of 20
- milliseconds; some provide more. If Qt is unable to deliver the
- requested number of timer events, it will silently discard some.
+ Note that QTimer's accuracy depends on the underlying operating system and
+ hardware. The \a timerType argument allows you to customize the accuracy of
+ the timer. See Qt::TimerType for information on the different timer types.
+ Most platforms support an accuracy of 20 milliseconds; some provide more.
+ If Qt is unable to deliver the requested number of timer events, it will
+ silently discard some.
The QTimer class provides a high-level programming interface with
single-shot timers and timer signals instead of events. There is
@@ -1523,7 +1373,7 @@ void QObjectPrivate::_q_reregisterTimers(void *pointer)
\sa timerEvent(), killTimer(), QTimer::singleShot()
*/
-int QObject::startTimer(int interval)
+int QObject::startTimer(int interval, Qt::TimerType timerType)
{
Q_D(QObject);
@@ -1532,13 +1382,13 @@ int QObject::startTimer(int interval)
return 0;
}
- d->pendTimer = true; // set timer flag
-
if (!d->threadData->eventDispatcher) {
qWarning("QObject::startTimer: QTimer can only be used with threads started with QThread");
return 0;
}
- return d->threadData->eventDispatcher->registerTimer(interval, this);
+ int timerId = d->threadData->eventDispatcher->registerTimer(interval, timerType, this);
+ d->runningTimers.append(timerId);
+ return timerId;
}
/*!
@@ -1553,8 +1403,23 @@ int QObject::startTimer(int interval)
void QObject::killTimer(int id)
{
Q_D(QObject);
- if (d->threadData->eventDispatcher)
- d->threadData->eventDispatcher->unregisterTimer(id);
+ if (id) {
+ int at = d->runningTimers.indexOf(id);
+ if (at == -1) {
+ // timer isn't owned by this object
+ qWarning("QObject::killTimer(): Error: timer id %d is not valid for object %p (%s), timer has not been killed",
+ id,
+ this,
+ qPrintable(objectName()));
+ return;
+ }
+
+ if (d->threadData->eventDispatcher)
+ d->threadData->eventDispatcher->unregisterTimer(id);
+
+ d->runningTimers.remove(at);
+ QAbstractEventDispatcherPrivate::releaseTimerId(id);
+ }
}
@@ -1774,8 +1639,8 @@ void QObject::setParent(QObject *parent)
void QObjectPrivate::deleteChildren()
{
- const bool reallyWasDeleted = wasDeleted;
- wasDeleted = true;
+ Q_ASSERT_X(!isDeletingChildren, "QObjectPrivate::deleteChildren()", "isDeletingChildren already set, did this function recurse?");
+ isDeletingChildren = true;
// delete children objects
// don't use qDeleteAll as the destructor of the child might
// delete siblings
@@ -1786,7 +1651,7 @@ void QObjectPrivate::deleteChildren()
}
children.clear();
currentChildBeingDeleted = 0;
- wasDeleted = reallyWasDeleted;
+ isDeletingChildren = false;
}
void QObjectPrivate::setParent_helper(QObject *o)
@@ -1796,13 +1661,13 @@ void QObjectPrivate::setParent_helper(QObject *o)
return;
if (parent) {
QObjectPrivate *parentD = parent->d_func();
- if (parentD->wasDeleted && wasDeleted
+ if (parentD->isDeletingChildren && wasDeleted
&& parentD->currentChildBeingDeleted == q) {
// don't do anything since QObjectPrivate::deleteChildren() already
// cleared our entry in parentD->children.
} else {
const int index = parentD->children.indexOf(q);
- if (parentD->wasDeleted) {
+ if (parentD->isDeletingChildren) {
parentD->children[index] = 0;
} else {
parentD->children.removeAt(index);
@@ -1829,7 +1694,7 @@ void QObjectPrivate::setParent_helper(QObject *o)
}
}
}
- if (!wasDeleted && declarativeData)
+ if (!isDeletingChildren && declarativeData)
QAbstractDeclarativeData::parentChanged(declarativeData, q, o);
}
@@ -2060,10 +1925,10 @@ static bool check_signal_macro(const QObject *sender, const char *signal,
int sigcode = extract_code(signal);
if (sigcode != QSIGNAL_CODE) {
if (sigcode == QSLOT_CODE)
- qWarning("Object::%s: Attempt to %s non-signal %s::%s",
+ qWarning("QObject::%s: Attempt to %s non-signal %s::%s",
func, op, sender->metaObject()->className(), signal+1);
else
- qWarning("Object::%s: Use the SIGNAL macro to %s %s::%s",
+ qWarning("QObject::%s: Use the SIGNAL macro to %s %s::%s",
func, op, sender->metaObject()->className(), signal);
return false;
}
@@ -2074,7 +1939,7 @@ static bool check_method_code(int code, const QObject *object,
const char *method, const char *func)
{
if (code != QSLOT_CODE && code != QSIGNAL_CODE) {
- qWarning("Object::%s: Use the SLOT or SIGNAL macro to "
+ qWarning("QObject::%s: Use the SLOT or SIGNAL macro to "
"%s %s::%s", func, func, object->metaObject()->className(), method);
return false;
}
@@ -2091,11 +1956,11 @@ static void err_method_notfound(const QObject *object,
}
const char *loc = extract_location(method);
if (strchr(method,')') == 0) // common typing mistake
- qWarning("Object::%s: Parentheses expected, %s %s::%s%s%s",
+ qWarning("QObject::%s: Parentheses expected, %s %s::%s%s%s",
func, type, object->metaObject()->className(), method+1,
loc ? " in ": "", loc ? loc : "");
else
- qWarning("Object::%s: No such %s %s::%s%s%s",
+ qWarning("QObject::%s: No such %s %s::%s%s%s",
func, type, object->metaObject()->className(), method+1,
loc ? " in ": "", loc ? loc : "");
@@ -2109,9 +1974,9 @@ static void err_info_about_objects(const char * func,
QString a = sender ? sender->objectName() : QString();
QString b = receiver ? receiver->objectName() : QString();
if (!a.isEmpty())
- qWarning("Object::%s: (sender name: '%s')", func, a.toLocal8Bit().data());
+ qWarning("QObject::%s: (sender name: '%s')", func, a.toLocal8Bit().data());
if (!b.isEmpty())
- qWarning("Object::%s: (receiver name: '%s')", func, b.toLocal8Bit().data());
+ qWarning("QObject::%s: (receiver name: '%s')", func, b.toLocal8Bit().data());
}
/*!
@@ -2691,7 +2556,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal,
const QObject *receiver, const char *method)
{
if (sender == 0 || (receiver == 0 && method != 0)) {
- qWarning("Object::disconnect: Unexpected null parameter");
+ qWarning("QObject::disconnect: Unexpected null parameter");
return false;
}
@@ -2816,12 +2681,12 @@ bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal,
const QObject *receiver, const QMetaMethod &method)
{
if (sender == 0 || (receiver == 0 && method.mobj != 0)) {
- qWarning("Object::disconnect: Unexpected null parameter");
+ qWarning("QObject::disconnect: Unexpected null parameter");
return false;
}
if (signal.mobj) {
if(signal.methodType() != QMetaMethod::Signal) {
- qWarning("Object::%s: Attempt to %s non-signal %s::%s",
+ qWarning("QObject::%s: Attempt to %s non-signal %s::%s",
"disconnect","unbind",
sender->metaObject()->className(), signal.signature());
return false;
@@ -3239,9 +3104,9 @@ static void queued_activate(QObject *sender, int signal, QObjectPrivate::Connect
int nargs = 1; // include return type
while (argumentTypes[nargs-1])
++nargs;
- int *types = (int *) qMalloc(nargs*sizeof(int));
+ int *types = (int *) malloc(nargs*sizeof(int));
Q_CHECK_PTR(types);
- void **args = (void **) qMalloc(nargs*sizeof(void *));
+ void **args = (void **) malloc(nargs*sizeof(void *));
Q_CHECK_PTR(args);
types[0] = 0; // return type
args[0] = 0; // return value
@@ -4004,11 +3869,6 @@ QDebug operator<<(QDebug dbg, const QObject *o) {
void qDeleteInEventHandler(QObject *o)
{
-#ifdef QT_JAMBI_BUILD
- if (!o)
- return;
- QObjectPrivate::get(o)->inEventHandler = false;
-#endif
delete o;
}
@@ -4273,7 +4133,7 @@ bool QObject::disconnect(const QMetaObject::Connection &connection)
bool QObject::disconnectImpl(const QObject *sender, void **signal, const QObject *receiver, void **slot, const QMetaObject *senderMetaObject)
{
if (sender == 0 || (receiver == 0 && slot != 0)) {
- qWarning("Object::disconnect: Unexpected null parameter");
+ qWarning("QObject::disconnect: Unexpected null parameter");
return false;
}
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h
index 307518d81e..11f524180c 100644
--- a/src/corelib/kernel/qobject.h
+++ b/src/corelib/kernel/qobject.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -96,17 +96,13 @@ public:
QObjectList children;
uint isWidget : 1;
- uint pendTimer : 1;
uint blockSig : 1;
uint wasDeleted : 1;
- uint ownObjectName : 1;
+ uint isDeletingChildren : 1;
uint sendChildEvents : 1;
uint receiveChildEvents : 1;
- uint inEventHandler : 1; //only used if QT_JAMBI_BUILD
- uint inThreadChangeEvent : 1;
- uint hasGuards : 1; //true iff there is one or more QPointer attached to this object
uint isWindow : 1; //for QWindow
- uint unused : 21;
+ uint unused : 25;
int postedEvents;
QMetaObject *metaObject; // assert dynamic
};
@@ -115,7 +111,7 @@ public:
class Q_CORE_EXPORT QObject
{
Q_OBJECT
- Q_PROPERTY(QString objectName READ objectName WRITE setObjectName)
+ Q_PROPERTY(QString objectName READ objectName WRITE setObjectName NOTIFY objectNameChanged)
Q_DECLARE_PRIVATE(QObject)
public:
@@ -152,7 +148,7 @@ public:
QThread *thread() const;
void moveToThread(QThread *thread);
- int startTimer(int interval);
+ int startTimer(int interval, Qt::TimerType timerType = Qt::CoarseTimer);
void killTimer(int id);
template<typename T>
@@ -214,7 +210,12 @@ public:
reinterpret_cast<typename SignalType::Object *>(0)->qt_check_for_QOBJECT_macro(*reinterpret_cast<typename SignalType::Object *>(0));
//compilation error if the arguments does not match.
- typedef typename QtPrivate::CheckCompatibleArguments<typename SignalType::Arguments, typename SlotType::Arguments>::IncompatibleSignalSlotArguments EnsureCompatibleArguments;
+ Q_STATIC_ASSERT_X(int(SignalType::ArgumentCount) >= int(SlotType::ArgumentCount),
+ "The slot requires more arguments than the signal provides.");
+ Q_STATIC_ASSERT_X((QtPrivate::CheckCompatibleArguments<typename SignalType::Arguments, typename SlotType::Arguments>::value),
+ "Signal and slot arguments are not compatible.");
+ Q_STATIC_ASSERT_X((QtPrivate::AreArgumentsCompatible<typename SlotType::ReturnType, typename SignalType::ReturnType>::value),
+ "Return type of the slot is not compatible with the return type of the signal.");
const int *types = 0;
if (type == Qt::QueuedConnection || type == Qt::BlockingQueuedConnection)
@@ -236,8 +237,12 @@ public:
typedef QtPrivate::FunctionPointer<Func2> SlotType;
//compilation error if the arguments does not match.
- typedef typename QtPrivate::CheckCompatibleArguments<typename SignalType::Arguments, typename SlotType::Arguments>::IncompatibleSignalSlotArguments EnsureCompatibleArguments;
- typedef typename QtPrivate::QEnableIf<(int(SignalType::ArgumentCount) >= int(SlotType::ArgumentCount))>::Type EnsureArgumentsCount;
+ Q_STATIC_ASSERT_X(int(SignalType::ArgumentCount) >= int(SlotType::ArgumentCount),
+ "The slot requires more arguments than the signal provides.");
+ Q_STATIC_ASSERT_X((QtPrivate::CheckCompatibleArguments<typename SignalType::Arguments, typename SlotType::Arguments>::value),
+ "Signal and slot arguments are not compatible.");
+ Q_STATIC_ASSERT_X((QtPrivate::AreArgumentsCompatible<typename SlotType::ReturnType, typename SignalType::ReturnType>::value),
+ "Return type of the slot is not compatible with the return type of the signal.");
return connectImpl(sender, reinterpret_cast<void **>(&signal), sender, 0,
new QStaticSlotObject<Func2,
@@ -278,7 +283,9 @@ public:
reinterpret_cast<typename SignalType::Object *>(0)->qt_check_for_QOBJECT_macro(*reinterpret_cast<typename SignalType::Object *>(0));
//compilation error if the arguments does not match.
- typedef typename QtPrivate::CheckCompatibleArguments<typename SignalType::Arguments, typename SlotType::Arguments>::IncompatibleSignalSlotArguments EnsureCompatibleArguments;
+ Q_STATIC_ASSERT_X((QtPrivate::CheckCompatibleArguments<typename SignalType::Arguments, typename SlotType::Arguments>::value),
+ "Signal and slot arguments are not compatible.");
+
return disconnectImpl(sender, reinterpret_cast<void **>(&signal), receiver, reinterpret_cast<void **>(&slot),
&SignalType::Object::staticMetaObject);
}
@@ -287,8 +294,8 @@ public:
const QObject *receiver, void **zero)
{
// This is the overload for when one wish to disconnect a signal from any slot. (slot=0)
- // Since the function template parametter cannot be deduced from '0', we use a
- // dummy void ** parametter that must be equal to 0
+ // Since the function template parameter cannot be deduced from '0', we use a
+ // dummy void ** parameter that must be equal to 0
Q_ASSERT(!zero);
typedef QtPrivate::FunctionPointer<Func1> SignalType;
return disconnectImpl(sender, reinterpret_cast<void **>(&signal), receiver, zero,
@@ -313,6 +320,7 @@ public:
Q_SIGNALS:
void destroyed(QObject * = 0);
+ void objectNameChanged(const QString &objectName);
public:
inline QObject *parent() const { return d_ptr->parent; }
diff --git a/src/corelib/kernel/qobject_impl.h b/src/corelib/kernel/qobject_impl.h
index 660294b956..44aaa9a218 100644
--- a/src/corelib/kernel/qobject_impl.h
+++ b/src/corelib/kernel/qobject_impl.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -441,36 +441,40 @@ namespace QtPrivate {
/*
Logic that check if the arguments of the slot matches the argument of the signal.
To be used like this:
- CheckCompatibleArguments<FunctionPointer<Signal>::Arguments, FunctionPointer<Slot>::Arguments>::IncompatibleSignalSlotArguments
- The IncompatibleSignalSlotArguments type do not exist if the argument are incompatible and can
- then produce error message.
+ Q_STATIC_ASSERT(CheckCompatibleArguments<FunctionPointer<Signal>::Arguments, FunctionPointer<Slot>::Arguments>::value)
*/
- template<typename T, bool B> struct CheckCompatibleArgumentsHelper {};
- template<typename T> struct CheckCompatibleArgumentsHelper<T, true> : T {};
template<typename A1, typename A2> struct AreArgumentsCompatible {
static int test(A2);
static char test(...);
- static A2 dummy();
+ static A1 dummy();
enum { value = sizeof(test(dummy())) == sizeof(int) };
};
template<typename A1, typename A2> struct AreArgumentsCompatible<A1, A2&> { enum { value = false }; };
template<typename A> struct AreArgumentsCompatible<A&, A&> { enum { value = true }; };
+ // void as a return value
+ template<typename A> struct AreArgumentsCompatible<void, A> { enum { value = true }; };
+ template<typename A> struct AreArgumentsCompatible<A, void> { enum { value = true }; };
+ template<> struct AreArgumentsCompatible<void, void> { enum { value = true }; };
#ifndef Q_COMPILER_VARIADIC_TEMPLATES
- template <typename List1, typename List2> struct CheckCompatibleArguments{};
- template <> struct CheckCompatibleArguments<void, void> { typedef bool IncompatibleSignalSlotArguments; };
- template <typename List1> struct CheckCompatibleArguments<List1, void> { typedef bool IncompatibleSignalSlotArguments; };
+ template <typename List1, typename List2> struct CheckCompatibleArguments { enum { value = false }; };
+ template <> struct CheckCompatibleArguments<void, void> { enum { value = true }; };
+ template <typename List1> struct CheckCompatibleArguments<List1, void> { enum { value = true }; };
template <typename Arg1, typename Arg2, typename Tail1, typename Tail2> struct CheckCompatibleArguments<List<Arg1, Tail1>, List<Arg2, Tail2> >
- : CheckCompatibleArgumentsHelper<CheckCompatibleArguments<Tail1, Tail2>, AreArgumentsCompatible<
- typename RemoveConstRef<Arg1>::Type, typename RemoveConstRef<Arg2>::Type>::value > {};
+ {
+ enum { value = AreArgumentsCompatible<typename RemoveConstRef<Arg1>::Type, typename RemoveConstRef<Arg2>::Type>::value
+ && CheckCompatibleArguments<Tail1, Tail2>::value };
+ };
#else
- template <typename List1, typename List2> struct CheckCompatibleArguments{};
- template <> struct CheckCompatibleArguments<List<>, List<>> { typedef bool IncompatibleSignalSlotArguments; };
- template <typename List1> struct CheckCompatibleArguments<List1, List<>> { typedef bool IncompatibleSignalSlotArguments; };
+ template <typename List1, typename List2> struct CheckCompatibleArguments { enum { value = false }; };
+ template <> struct CheckCompatibleArguments<List<>, List<>> { enum { value = true }; };
+ template <typename List1> struct CheckCompatibleArguments<List1, List<>> { enum { value = true }; };
template <typename Arg1, typename Arg2, typename... Tail1, typename... Tail2>
struct CheckCompatibleArguments<List<Arg1, Tail1...>, List<Arg2, Tail2...>>
- : CheckCompatibleArgumentsHelper<CheckCompatibleArguments<List<Tail1...>, List<Tail2...>>, AreArgumentsCompatible<
- typename RemoveConstRef<Arg1>::Type, typename RemoveConstRef<Arg2>::Type>::value > {};
+ {
+ enum { value = AreArgumentsCompatible<typename RemoveConstRef<Arg1>::Type, typename RemoveConstRef<Arg2>::Type>::value
+ && CheckCompatibleArguments<List<Tail1...>, List<Tail2...>>::value };
+ };
#endif
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index 5519a69c34..dbd2e4fa37 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -179,11 +179,6 @@ public:
static inline void resetCurrentSender(QObject *receiver,
Sender *currentSender,
Sender *previousSender);
-#ifdef QT_JAMBI_BUILD
- static int *setDeleteWatch(QObjectPrivate *d, int *newWatch);
- static void resetDeleteWatch(QObjectPrivate *d, int *oldWatch, int deleteWatch);
-#endif
- static void clearGuards(QObject *);
static QObjectPrivate *get(QObject *o) {
return o->d_func();
@@ -203,6 +198,7 @@ public:
Sender *currentSender; // object currently activating the object
mutable quint32 connectedSignals[2];
+ QVector<int> runningTimers;
QList<QPointer<QObject> > eventFilters;
union {
QObject *currentChildBeingDeleted;
@@ -212,9 +208,6 @@ public:
// these objects are all used to indicate that a QObject was deleted
// plus QPointer, which keeps a separate list
QAtomicPointer<QtSharedPointer::ExternalRefCountData> sharedRefcount;
-#ifdef QT_JAMBI_BUILD
- int *deleteWatch;
-#endif
};
diff --git a/src/corelib/kernel/qobjectcleanuphandler.cpp b/src/corelib/kernel/qobjectcleanuphandler.cpp
index 512aa097ee..8a0cc2840e 100644
--- a/src/corelib/kernel/qobjectcleanuphandler.cpp
+++ b/src/corelib/kernel/qobjectcleanuphandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qobjectcleanuphandler.h b/src/corelib/kernel/qobjectcleanuphandler.h
index 601164f784..5997f0e250 100644
--- a/src/corelib/kernel/qobjectcleanuphandler.h
+++ b/src/corelib/kernel/qobjectcleanuphandler.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index bfb6808ad5..dfcc81be03 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -136,18 +136,11 @@ template <typename T1, typename T2>
inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {}
#endif // QT_NO_QOBJECT_CHECK
-#ifdef Q_NO_DATA_RELOCATION
-#define Q_OBJECT_GETSTATICMETAOBJECT static const QMetaObject &getStaticMetaObject();
-#else
-#define Q_OBJECT_GETSTATICMETAOBJECT
-#endif
-
/* tmake ignore Q_OBJECT */
#define Q_OBJECT \
public: \
Q_OBJECT_CHECK \
static const QMetaObject staticMetaObject; \
- Q_OBJECT_GETSTATICMETAOBJECT \
virtual const QMetaObject *metaObject() const; \
virtual void *qt_metacast(const char *); \
QT_TR_FUNCTIONS \
@@ -162,8 +155,8 @@ private: \
#define Q_GADGET \
public: \
static const QMetaObject staticMetaObject; \
- Q_OBJECT_GETSTATICMETAOBJECT \
private:
+
#else // Q_MOC_RUN
#define slots slots
#define signals signals
@@ -341,11 +334,6 @@ struct Q_CORE_EXPORT QMetaObject
static void activate(QObject *sender, int signal_index, void **argv);
static void activate(QObject *sender, const QMetaObject *, int local_signal_index, void **argv);
- // internal guarded pointers
- static void addGuard(QObject **ptr);
- static void removeGuard(QObject **ptr);
- static void changeGuard(QObject **ptr, QObject *o);
-
static bool invokeMethod(QObject *obj, const char *member,
Qt::ConnectionType,
QGenericReturnArgument ret,
@@ -474,11 +462,7 @@ typedef const QMetaObject& (*QMetaObjectAccessor)();
struct QMetaObjectExtraData
{
-#ifdef Q_NO_DATA_RELOCATION
- const QMetaObjectAccessor *objects;
-#else
const QMetaObject **objects;
-#endif
typedef void (*StaticMetacallFunction)(QObject *, QMetaObject::Call, int, void **); //from revision 6
//typedef int (*StaticMetaCall)(QMetaObject::Call, int, void **); //used from revison 2 until revison 5
diff --git a/src/corelib/kernel/qpointer.cpp b/src/corelib/kernel/qpointer.cpp
index c7fcf4f1e8..575dad9ed8 100644
--- a/src/corelib/kernel/qpointer.cpp
+++ b/src/corelib/kernel/qpointer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -44,7 +44,7 @@
\brief The QPointer class is a template class that provides guarded pointers to QObject.
\ingroup objectmodel
-
+ \obsolete Use QWeakPointer instead.
A guarded pointer, QPointer<T>, behaves like a normal C++
pointer \c{T *}, except that it is automatically set to 0 when the
@@ -57,6 +57,24 @@
destroyed while you still hold a reference to it. You can safely
test the pointer for validity.
+ Note that Qt 5 introduces two slight changes in behavior when using QPointer.
+
+ \list
+
+ \i When using QPointer on a QWidget (or a subclass of QWidget), previously
+ the QPointer would be cleared by the QWidget destructor. Now, the QPointer
+ is cleared by the QObject destructor (since this is when QWeakPointers are
+ cleared). Any QPointers tracking a widget will \b NOT be cleared before the
+ QWidget destructor destroys the children for the widget being tracked.
+
+ \i When constructing a QSharedPointer to take ownership of an object after a
+ QPointer is already tracking the object. Previously, the shared pointer
+ construction would not be affected by the QPointer, but now that QPointer
+ is implemented using QWeakPoiner, constructing the QSharedPointer will
+ cause an \c abort().
+
+ \endlist
+
Qt also provides QSharedPointer, an implementation of a reference-counted
shared pointer object, which can be used to maintain a collection of
references to an individual pointer.
diff --git a/src/corelib/kernel/qpointer.h b/src/corelib/kernel/qpointer.h
index e9f302e317..4c0aebb41d 100644
--- a/src/corelib/kernel/qpointer.h
+++ b/src/corelib/kernel/qpointer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,7 +42,7 @@
#ifndef QPOINTER_H
#define QPOINTER_H
-#include <QtCore/qobject.h>
+#include <QtCore/qsharedpointer.h>
QT_BEGIN_HEADER
@@ -50,34 +50,35 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#if QT_DEPRECATED_SINCE(5,0)
+
template <class T>
-class QPointer
+class QT_DEPRECATED QPointer
{
- QObject *o;
+ QWeakPointer<T> wp;
+
public:
- inline QPointer() : o(0) {}
- inline QPointer(T *p) : o(p)
- { QMetaObject::addGuard(&o); }
- inline QPointer(const QPointer<T> &p) : o(p.o)
- { QMetaObject::addGuard(&o); }
- inline ~QPointer()
- { QMetaObject::removeGuard(&o); }
+ inline QPointer() : wp() { }
+ inline QPointer(T *p) : wp(p) { }
+ inline QPointer(const QPointer<T> &p) : wp(p.wp) { }
+ inline ~QPointer() { }
+
inline QPointer<T> &operator=(const QPointer<T> &p)
- { if (this != &p) QMetaObject::changeGuard(&o, p.o); return *this; }
+ { wp = p.wp; return *this; }
inline QPointer<T> &operator=(T* p)
- { if (o != p) QMetaObject::changeGuard(&o, p); return *this; }
+ { wp = p; return *this; }
inline bool isNull() const
- { return !o; }
+ { return wp.isNull(); }
inline T* operator->() const
- { return static_cast<T*>(const_cast<QObject*>(o)); }
+ { return wp.data(); }
inline T& operator*() const
- { return *static_cast<T*>(const_cast<QObject*>(o)); }
+ { return *wp.data(); }
inline operator T*() const
- { return static_cast<T*>(const_cast<QObject*>(o)); }
+ { return wp.data(); }
inline T* data() const
- { return static_cast<T*>(const_cast<QObject*>(o)); }
+ { return wp.data(); }
};
@@ -161,6 +162,8 @@ inline bool operator!= (int i, const QPointer<T> &p)
{ Q_ASSERT(i == 0); return !i && !p.isNull(); }
#endif
+#endif // QT_DEPRECATED_SINCE(5,0)
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/kernel/qsharedmemory.cpp b/src/corelib/kernel/qsharedmemory.cpp
index acb6044bac..c5b1b56747 100644
--- a/src/corelib/kernel/qsharedmemory.cpp
+++ b/src/corelib/kernel/qsharedmemory.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qsharedmemory.h b/src/corelib/kernel/qsharedmemory.h
index b2ce7e20f4..d536e94fa1 100644
--- a/src/corelib/kernel/qsharedmemory.h
+++ b/src/corelib/kernel/qsharedmemory.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qsharedmemory_p.h b/src/corelib/kernel/qsharedmemory_p.h
index d5fafeff97..d3d3c023ba 100644
--- a/src/corelib/kernel/qsharedmemory_p.h
+++ b/src/corelib/kernel/qsharedmemory_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qsharedmemory_symbian.cpp b/src/corelib/kernel/qsharedmemory_symbian.cpp
deleted file mode 100644
index fdd513a475..0000000000
--- a/src/corelib/kernel/qsharedmemory_symbian.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsharedmemory.h"
-#include "qsharedmemory_p.h"
-#include "qsystemsemaphore.h"
-#include "qcore_symbian_p.h"
-#include <qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_SHAREDMEMORY
-
-#define QSHAREDMEMORY_DEBUG
-
-QSharedMemoryPrivate::QSharedMemoryPrivate() : QObjectPrivate(),
- memory(0), size(0), error(QSharedMemory::NoError),
- systemSemaphore(QString()), lockedByMe(false)
-{
-}
-
-void QSharedMemoryPrivate::setErrorString(const QString &function, TInt errorCode)
-{
- if (errorCode == KErrNone)
- return;
- switch (errorCode) {
- case KErrAlreadyExists:
- error = QSharedMemory::AlreadyExists;
- errorString = QSharedMemory::tr("%1: already exists").arg(function);
- break;
- case KErrNotFound:
- error = QSharedMemory::NotFound;
- errorString = QSharedMemory::tr("%1: doesn't exists").arg(function);
- break;
- case KErrArgument:
- error = QSharedMemory::InvalidSize;
- errorString = QSharedMemory::tr("%1: invalid size").arg(function);
- break;
- case KErrNoMemory:
- error = QSharedMemory::OutOfResources;
- errorString = QSharedMemory::tr("%1: out of resources").arg(function);
- break;
- case KErrPermissionDenied:
- error = QSharedMemory::PermissionDenied;
- errorString = QSharedMemory::tr("%1: permission denied").arg(function);
- break;
- default:
- errorString = QSharedMemory::tr("%1: unknown error %2").arg(function).arg(errorCode);
- error = QSharedMemory::UnknownError;
-#if defined QSHAREDMEMORY_DEBUG
- qDebug() << errorString << "key" << key;
-#endif
- }
-}
-
-key_t QSharedMemoryPrivate::handle()
-{
- // Not really cost effective to check here if shared memory is attachable, as it requires
- // exactly the same call as attaching, so always assume handle is valid and return failure
- // from attach.
- return 1;
-}
-
-bool QSharedMemoryPrivate::cleanHandle()
-{
- chunk.Close();
- return true;
-}
-
-bool QSharedMemoryPrivate::create(int size)
-{
- QString function = QLatin1String("QSharedMemory::create");
- if (nativeKey.isEmpty()) {
- error = QSharedMemory::KeyError;
- errorString = QSharedMemory::tr("%1: key error").arg(function);
- return false;
- }
-
- TPtrC ptr(qt_QString2TPtrC(nativeKey));
-
- TInt err = chunk.CreateGlobal(ptr, size, size);
-
- setErrorString(function, err);
-
- if (err != KErrNone)
- return false;
-
- // Zero out the created chunk
- Mem::FillZ(chunk.Base(), chunk.Size());
-
- return true;
-}
-
-bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode /* mode */)
-{
- // Grab a pointer to the memory block
- if (!chunk.Handle()) {
- QString function = QLatin1String("QSharedMemory::handle");
- if (nativeKey.isEmpty()) {
- error = QSharedMemory::KeyError;
- errorString = QSharedMemory::tr("%1: unable to make key").arg(function);
- return false;
- }
-
- TPtrC ptr(qt_QString2TPtrC(nativeKey));
-
- TInt err = KErrNoMemory;
-
- err = chunk.OpenGlobal(ptr, false);
-
- if (err != KErrNone) {
- setErrorString(function, err);
- return false;
- }
- }
-
- size = chunk.Size();
- memory = chunk.Base();
-
- return true;
-}
-
-bool QSharedMemoryPrivate::detach()
-{
- chunk.Close();
-
- memory = 0;
- size = 0;
-
- return true;
-}
-
-#endif //QT_NO_SHAREDMEMORY
-
-QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp
index 2bbda4933f..fd435d7b97 100644
--- a/src/corelib/kernel/qsharedmemory_unix.cpp
+++ b/src/corelib/kernel/qsharedmemory_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qsharedmemory_win.cpp b/src/corelib/kernel/qsharedmemory_win.cpp
index 3cc14fe512..c02ab15c88 100644
--- a/src/corelib/kernel/qsharedmemory_win.cpp
+++ b/src/corelib/kernel/qsharedmemory_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qsignalmapper.cpp b/src/corelib/kernel/qsignalmapper.cpp
index 665b9e22b5..7bdffd4153 100644
--- a/src/corelib/kernel/qsignalmapper.cpp
+++ b/src/corelib/kernel/qsignalmapper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qsignalmapper.h b/src/corelib/kernel/qsignalmapper.h
index 72593679a9..04278b491c 100644
--- a/src/corelib/kernel/qsignalmapper.h
+++ b/src/corelib/kernel/qsignalmapper.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qsocketnotifier.cpp b/src/corelib/kernel/qsocketnotifier.cpp
index 5e99d1d483..60970f1cd2 100644
--- a/src/corelib/kernel/qsocketnotifier.cpp
+++ b/src/corelib/kernel/qsocketnotifier.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -168,7 +168,7 @@ QT_BEGIN_NAMESPACE
\sa setEnabled(), isEnabled()
*/
-QSocketNotifier::QSocketNotifier(int socket, Type type, QObject *parent)
+QSocketNotifier::QSocketNotifier(qintptr socket, Type type, QObject *parent)
: QObject(parent)
{
if (socket < 0)
diff --git a/src/corelib/kernel/qsocketnotifier.h b/src/corelib/kernel/qsocketnotifier.h
index 07dc129825..186979db4c 100644
--- a/src/corelib/kernel/qsocketnotifier.h
+++ b/src/corelib/kernel/qsocketnotifier.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -58,7 +58,7 @@ class Q_CORE_EXPORT QSocketNotifier : public QObject
public:
enum Type { Read, Write, Exception };
- QSocketNotifier(int socket, Type, QObject *parent = 0);
+ QSocketNotifier(qintptr socket, Type, QObject *parent = 0);
~QSocketNotifier();
inline int socket() const { return sockfd; }
@@ -78,7 +78,7 @@ protected:
private:
Q_DISABLE_COPY(QSocketNotifier)
- int sockfd;
+ qintptr sockfd;
Type sntype;
bool snenabled;
};
diff --git a/src/corelib/kernel/qsystemerror.cpp b/src/corelib/kernel/qsystemerror.cpp
index 71c2807341..708eba89a6 100644
--- a/src/corelib/kernel/qsystemerror.cpp
+++ b/src/corelib/kernel/qsystemerror.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -46,6 +46,10 @@
# if defined(Q_CC_MSVC)
# include <crtdbg.h>
# endif
+#else
+# if (_WIN32_WCE >= 0x700)
+# include <errno.h>
+# endif
#endif
#ifdef Q_OS_WIN
#include <windows.h>
@@ -76,6 +80,27 @@ namespace {
}
#endif
+#ifdef Q_OS_WIN
+static QString windowsErrorString(int errorCode)
+{
+ QString ret;
+ wchar_t *string = 0;
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ errorCode,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPWSTR)&string,
+ 0,
+ NULL);
+ ret = QString::fromWCharArray(string);
+ LocalFree((HLOCAL)string);
+
+ if (ret.isEmpty() && errorCode == ERROR_MOD_NOT_FOUND)
+ ret = QString::fromLatin1("The specified module could not be found.");
+ return ret;
+}
+#endif
+
static QString standardLibraryErrorString(int errorCode)
{
const char *s = 0;
@@ -96,11 +121,15 @@ static QString standardLibraryErrorString(int errorCode)
s = QT_TRANSLATE_NOOP("QIODevice", "No space left on device");
break;
default: {
- #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX)
- QByteArray buf(1024, '\0');
- ret = fromstrerror_helper(strerror_r(errorCode, buf.data(), buf.size()), buf);
+ #ifdef Q_OS_WINCE
+ ret = windowsErrorString(errorCode);
#else
- ret = QString::fromLocal8Bit(strerror(errorCode));
+ #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX)
+ QByteArray buf(1024, '\0');
+ ret = fromstrerror_helper(strerror_r(errorCode, buf.data(), buf.size()), buf);
+ #else
+ ret = QString::fromLocal8Bit(strerror(errorCode));
+ #endif
#endif
break; }
}
@@ -112,27 +141,6 @@ static QString standardLibraryErrorString(int errorCode)
return ret.trimmed();
}
-#ifdef Q_OS_WIN
-static QString windowsErrorString(int errorCode)
-{
- QString ret;
- wchar_t *string = 0;
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- errorCode,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPWSTR)&string,
- 0,
- NULL);
- ret = QString::fromWCharArray(string);
- LocalFree((HLOCAL)string);
-
- if (ret.isEmpty() && errorCode == ERROR_MOD_NOT_FOUND)
- ret = QString::fromLatin1("The specified module could not be found.");
- return ret;
-}
-#endif
-
#ifdef Q_OS_SYMBIAN
static QString symbianErrorString(int errorCode)
{
diff --git a/src/corelib/kernel/qsystemerror_p.h b/src/corelib/kernel/qsystemerror_p.h
index 0bcada7350..2a90760197 100644
--- a/src/corelib/kernel/qsystemerror_p.h
+++ b/src/corelib/kernel/qsystemerror_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qsystemsemaphore.cpp b/src/corelib/kernel/qsystemsemaphore.cpp
index 98ee6f4231..690a4e8b92 100644
--- a/src/corelib/kernel/qsystemsemaphore.cpp
+++ b/src/corelib/kernel/qsystemsemaphore.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qsystemsemaphore.h b/src/corelib/kernel/qsystemsemaphore.h
index 1623215ec5..0cb69d5e7c 100644
--- a/src/corelib/kernel/qsystemsemaphore.h
+++ b/src/corelib/kernel/qsystemsemaphore.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qsystemsemaphore_p.h b/src/corelib/kernel/qsystemsemaphore_p.h
index d4e86e8866..31fd596fd5 100644
--- a/src/corelib/kernel/qsystemsemaphore_p.h
+++ b/src/corelib/kernel/qsystemsemaphore_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qsystemsemaphore_symbian.cpp b/src/corelib/kernel/qsystemsemaphore_symbian.cpp
deleted file mode 100644
index 96c19afcfc..0000000000
--- a/src/corelib/kernel/qsystemsemaphore_symbian.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsystemsemaphore.h"
-#include "qsystemsemaphore_p.h"
-#include "qcoreapplication.h"
-#include <qdebug.h>
-
-#include "qcore_symbian_p.h"
-#include <e32cmn.h>
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_SYSTEMSEMAPHORE
-
-QSystemSemaphorePrivate::QSystemSemaphorePrivate() :
- error(QSystemSemaphore::NoError)
-{
-}
-
-void QSystemSemaphorePrivate::setErrorString(const QString &function, int err)
-{
- if (err == KErrNone){
- return;
- }
- switch(err){
- case KErrAlreadyExists:
- errorString = QCoreApplication::tr("%1: already exists", "QSystemSemaphore").arg(function);
- error = QSystemSemaphore::AlreadyExists;
- break;
- case KErrNotFound:
- errorString = QCoreApplication::tr("%1: does not exist", "QSystemSemaphore").arg(function);
- error = QSystemSemaphore::NotFound;
- break;
- case KErrNoMemory:
- case KErrInUse:
- errorString = QCoreApplication::tr("%1: out of resources", "QSystemSemaphore").arg(function);
- error = QSystemSemaphore::OutOfResources;
- break;
- case KErrPermissionDenied:
- errorString = QCoreApplication::tr("%1: permission denied", "QSystemSemaphore").arg(function);
- error = QSystemSemaphore::PermissionDenied;
- break;
-default:
- errorString = QCoreApplication::tr("%1: unknown error %2", "QSystemSemaphore").arg(function).arg(err);
- error = QSystemSemaphore::UnknownError;
- }
-
-#if defined QSYSTEMSEMAPHORE_DEBUG
- qDebug() << errorString << "key" << key;
-#endif
-}
-
-int QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode)
-{
- if (semaphore.Handle()) {
- return semaphore.Handle();
- }
-
- // don't allow making handles on empty keys
- if (key.isEmpty())
- return 0;
-
- TPtrC name(qt_QString2TPtrC(fileName));
- int err = KErrAlreadyExists;
- int tryCount = 10;
- // Sort out race conditions by retrying several times until existing handle is acquired.
- // Sometimes opening can fail inexplicably with KErrPermissionDenied many times in a row.
- while (err != KErrNoMemory && err != KErrNone && tryCount-- >= 0) {
- err = semaphore.CreateGlobal(name, initialValue, EOwnerProcess);
- if (err != KErrNoMemory && err != KErrNone)
- err = semaphore.OpenGlobal(name,EOwnerProcess);
- }
- if (err){
- setErrorString(QLatin1String("QSystemSemaphore::handle"),err);
- return 0;
- }
- return semaphore.Handle();
-}
-
-void QSystemSemaphorePrivate::cleanHandle()
-{
- semaphore.Close();
-}
-
-bool QSystemSemaphorePrivate::modifySemaphore(int count)
-{
- if (0 == handle())
- return false;
-
- if (count > 0) {
- semaphore.Signal(count);
- } else {
- semaphore.Wait();
- }
- return true;
-}
-
-#endif //QT_NO_SYSTEMSEMAPHORE
-
-QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qsystemsemaphore_unix.cpp b/src/corelib/kernel/qsystemsemaphore_unix.cpp
index 5e533e7f0e..cc86e335e5 100644
--- a/src/corelib/kernel/qsystemsemaphore_unix.cpp
+++ b/src/corelib/kernel/qsystemsemaphore_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qsystemsemaphore_win.cpp b/src/corelib/kernel/qsystemsemaphore_win.cpp
index 30cab7ebfe..aad78459d7 100644
--- a/src/corelib/kernel/qsystemsemaphore_win.cpp
+++ b/src/corelib/kernel/qsystemsemaphore_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qtcore_eval.cpp b/src/corelib/kernel/qtcore_eval.cpp
index 927aa672a1..2f9ccdae46 100644
--- a/src/corelib/kernel/qtcore_eval.cpp
+++ b/src/corelib/kernel/qtcore_eval.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
static const char boilerplate_unsuported[] =
"\nQt %1 Evaluation License\n"
- "Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).\n"
+ "Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).\n"
"All rights reserved.\n\n"
"This trial version may only be used for evaluation purposes\n"
"and will shut down after 120 minutes.\n"
@@ -65,7 +65,7 @@ static const char boilerplate_unsuported[] =
static const char boilerplate_supported[] =
"\nQt %1 Evaluation License\n"
- "Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).\n"
+ "Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).\n"
"All rights reserved.\n\n"
"This trial version may only be used for evaluation purposes\n"
"Registered to:\n"
diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp
index 9be661e42f..da1cfe91b2 100644
--- a/src/corelib/kernel/qtimer.cpp
+++ b/src/corelib/kernel/qtimer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -134,7 +134,6 @@ QT_BEGIN_NAMESPACE
{Analog Clock Example}, {Wiggly Example}
*/
-
static const int INV_TIMER = -1; // invalid timer id
/*!
@@ -142,7 +141,7 @@ static const int INV_TIMER = -1; // invalid timer id
*/
QTimer::QTimer(QObject *parent)
- : QObject(parent), id(INV_TIMER), inter(0), del(0), single(0), nulltimer(0)
+ : QObject(parent), id(INV_TIMER), inter(0), del(0), single(0), nulltimer(0), type(Qt::CoarseTimer)
{
}
@@ -203,7 +202,7 @@ void QTimer::start()
if (id != INV_TIMER) // stop running timer
stop();
nulltimer = (!inter && single);
- id = QObject::startTimer(inter);
+ id = QObject::startTimer(inter, Qt::TimerType(type));
}
/*!
@@ -257,18 +256,18 @@ class QSingleShotTimer : public QObject
int timerId;
public:
~QSingleShotTimer();
- QSingleShotTimer(int msec, QObject *r, const char * m);
+ QSingleShotTimer(int msec, Qt::TimerType timerType, QObject *r, const char * m);
Q_SIGNALS:
void timeout();
protected:
void timerEvent(QTimerEvent *);
};
-QSingleShotTimer::QSingleShotTimer(int msec, QObject *receiver, const char *member)
+QSingleShotTimer::QSingleShotTimer(int msec, Qt::TimerType timerType, QObject *receiver, const char *member)
: QObject(QAbstractEventDispatcher::instance())
{
connect(this, SIGNAL(timeout()), receiver, member);
- timerId = startTimer(msec);
+ timerId = startTimer(msec, timerType);
}
QSingleShotTimer::~QSingleShotTimer()
@@ -318,6 +317,28 @@ QT_END_INCLUDE_NAMESPACE
void QTimer::singleShot(int msec, QObject *receiver, const char *member)
{
+ // coarse timers are worst in their first firing
+ // so we prefer a high precision timer for something that happens only once
+ // unless the timeout is too big, in which case we go for coarse anyway
+ singleShot(msec, msec >= 2000 ? Qt::CoarseTimer : Qt::PreciseTimer, receiver, member);
+}
+
+/*! \overload
+ \reentrant
+ This static function calls a slot after a given time interval.
+
+ It is very convenient to use this function because you do not need
+ to bother with a \link QObject::timerEvent() timerEvent\endlink or
+ create a local QTimer object.
+
+ The \a receiver is the receiving object and the \a member is the slot. The
+ time interval is \a msec milliseconds. The \a timerType affects the
+ accuracy of the timer.
+
+ \sa start()
+*/
+void QTimer::singleShot(int msec, Qt::TimerType timerType, QObject *receiver, const char *member)
+{
if (receiver && member) {
if (msec == 0) {
// special code shortpath for 0-timers
@@ -330,7 +351,7 @@ void QTimer::singleShot(int msec, QObject *receiver, const char *member)
QMetaObject::invokeMethod(receiver, methodName.constData(), Qt::QueuedConnection);
return;
}
- (void) new QSingleShotTimer(msec, receiver, member);
+ (void) new QSingleShotTimer(msec, timerType, receiver, member);
}
}
@@ -361,8 +382,17 @@ void QTimer::setInterval(int msec)
inter = msec;
if (id != INV_TIMER) { // create new timer
QObject::killTimer(id); // restart timer
- id = QObject::startTimer(msec);
+ id = QObject::startTimer(msec, Qt::TimerType(type));
}
}
+/*!
+ \property QTimer::timerType
+ \brief controls the accuracy of the timer
+
+ The default value for this property is \c Qt::CoarseTimer.
+
+ \sa Qt::TimerType
+*/
+
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h
index 707bc83d3c..6fb32f9bde 100644
--- a/src/corelib/kernel/qtimer.h
+++ b/src/corelib/kernel/qtimer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -58,6 +58,7 @@ class Q_CORE_EXPORT QTimer : public QObject
Q_OBJECT
Q_PROPERTY(bool singleShot READ isSingleShot WRITE setSingleShot)
Q_PROPERTY(int interval READ interval WRITE setInterval)
+ Q_PROPERTY(Qt::TimerType timerType READ timerType WRITE setTimerType)
Q_PROPERTY(bool active READ isActive)
public:
explicit QTimer(QObject *parent = 0);
@@ -69,10 +70,14 @@ public:
void setInterval(int msec);
int interval() const { return inter; }
+ void setTimerType(Qt::TimerType atype) { this->type = atype; }
+ Qt::TimerType timerType() const { return Qt::TimerType(type); }
+
inline void setSingleShot(bool singleShot);
inline bool isSingleShot() const { return single; }
static void singleShot(int msec, QObject *receiver, const char *member);
+ static void singleShot(int msec, Qt::TimerType timerType, QObject *receiver, const char *member);
public Q_SLOTS:
void start(int msec);
@@ -95,6 +100,8 @@ private:
int id, inter, del;
uint single : 1;
uint nulltimer : 1;
+ uint type : 2;
+ // reserved : 28
};
inline void QTimer::setSingleShot(bool asingleShot) { single = asingleShot; }
diff --git a/src/corelib/kernel/qtimerinfo_unix.cpp b/src/corelib/kernel/qtimerinfo_unix.cpp
new file mode 100644
index 0000000000..b89d4ccb30
--- /dev/null
+++ b/src/corelib/kernel/qtimerinfo_unix.cpp
@@ -0,0 +1,625 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qelapsedtimer.h>
+#include <qcoreapplication.h>
+
+#include "private/qcore_unix_p.h"
+#include "private/qtimerinfo_unix_p.h"
+#include "private/qobject_p.h"
+#include "private/qabstracteventdispatcher_p.h"
+
+#ifdef QTIMERINFO_DEBUG
+# include <QDebug>
+# include <QThread>
+#endif
+
+#include <sys/times.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_CORE_EXPORT bool qt_disable_lowpriority_timers=false;
+
+/*
+ * Internal functions for manipulating timer data structures. The
+ * timerBitVec array is used for keeping track of timer identifiers.
+ */
+
+QTimerInfoList::QTimerInfoList()
+{
+#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC) && !defined(Q_OS_NACL)
+ if (!QElapsedTimer::isMonotonic()) {
+ // not using monotonic timers, initialize the timeChanged() machinery
+ previousTime = qt_gettime();
+
+ tms unused;
+ previousTicks = times(&unused);
+
+ ticksPerSecond = sysconf(_SC_CLK_TCK);
+ msPerTick = 1000/ticksPerSecond;
+ } else {
+ // detected monotonic timers
+ previousTime.tv_sec = previousTime.tv_usec = 0;
+ previousTicks = 0;
+ ticksPerSecond = 0;
+ msPerTick = 0;
+ }
+#endif
+
+ firstTimerInfo = 0;
+}
+
+timeval QTimerInfoList::updateCurrentTime()
+{
+ return (currentTime = qt_gettime());
+}
+
+#if ((_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC) && !defined(Q_OS_INTEGRITY)) || defined(QT_BOOTSTRAPPED)
+
+template <>
+timeval qAbs(const timeval &t)
+{
+ timeval tmp = t;
+ if (tmp.tv_sec < 0) {
+ tmp.tv_sec = -tmp.tv_sec - 1;
+ tmp.tv_usec -= 1000000;
+ }
+ if (tmp.tv_sec == 0 && tmp.tv_usec < 0) {
+ tmp.tv_usec = -tmp.tv_usec;
+ }
+ return normalizedTimeval(tmp);
+}
+
+/*
+ Returns true if the real time clock has changed by more than 10%
+ relative to the processor time since the last time this function was
+ called. This presumably means that the system time has been changed.
+
+ If /a delta is nonzero, delta is set to our best guess at how much the system clock was changed.
+*/
+bool QTimerInfoList::timeChanged(timeval *delta)
+{
+#ifdef Q_OS_NACL
+ Q_UNUSED(delta)
+ return false; // Calling "times" crashes.
+#endif
+ struct tms unused;
+ clock_t currentTicks = times(&unused);
+
+ clock_t elapsedTicks = currentTicks - previousTicks;
+ timeval elapsedTime = currentTime - previousTime;
+
+ timeval elapsedTimeTicks;
+ elapsedTimeTicks.tv_sec = elapsedTicks / ticksPerSecond;
+ elapsedTimeTicks.tv_usec = (((elapsedTicks * 1000) / ticksPerSecond) % 1000) * 1000;
+
+ timeval dummy;
+ if (!delta)
+ delta = &dummy;
+ *delta = elapsedTime - elapsedTimeTicks;
+
+ previousTicks = currentTicks;
+ previousTime = currentTime;
+
+ // If tick drift is more than 10% off compared to realtime, we assume that the clock has
+ // been set. Of course, we have to allow for the tick granularity as well.
+ timeval tickGranularity;
+ tickGranularity.tv_sec = 0;
+ tickGranularity.tv_usec = msPerTick * 1000;
+ return elapsedTimeTicks < ((qAbs(*delta) - tickGranularity) * 10);
+}
+
+/*
+ repair broken timer
+*/
+void QTimerInfoList::timerRepair(const timeval &diff)
+{
+ // repair all timers
+ for (int i = 0; i < size(); ++i) {
+ register QTimerInfo *t = at(i);
+ t->timeout = t->timeout + diff;
+ }
+}
+
+void QTimerInfoList::repairTimersIfNeeded()
+{
+ if (QElapsedTimer::isMonotonic())
+ return;
+ timeval delta;
+ if (timeChanged(&delta))
+ timerRepair(delta);
+}
+
+#else // !(_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(QT_BOOTSTRAPPED)
+
+void QTimerInfoList::repairTimersIfNeeded()
+{
+}
+
+#endif
+
+/*
+ insert timer info into list
+*/
+void QTimerInfoList::timerInsert(QTimerInfo *ti)
+{
+ int index = size();
+ while (index--) {
+ register const QTimerInfo * const t = at(index);
+ if (!(ti->timeout < t->timeout))
+ break;
+ }
+ insert(index+1, ti);
+}
+
+inline timeval &operator+=(timeval &t1, int ms)
+{
+ t1.tv_sec += ms / 1000;
+ t1.tv_usec += ms % 1000 * 1000;
+ return normalizedTimeval(t1);
+}
+
+inline timeval operator+(const timeval &t1, int ms)
+{
+ timeval t2 = t1;
+ return t2 += ms;
+}
+
+static timeval roundToMillisecond(timeval val)
+{
+ // always round up
+ // worst case scenario is that the first trigger of a 1-ms timer is 0.999 ms late
+
+ int us = val.tv_usec % 1000;
+ val.tv_usec += 1000 - us;
+ return normalizedTimeval(val);
+}
+
+#ifdef QTIMERINFO_DEBUG
+QDebug operator<<(QDebug s, timeval tv)
+{
+ s.nospace() << tv.tv_sec << "." << qSetFieldWidth(6) << qSetPadChar(QChar(48)) << tv.tv_usec << reset;
+ return s.space();
+}
+QDebug operator<<(QDebug s, Qt::TimerType t)
+{
+ s << (t == Qt::PreciseTimer ? "P" :
+ t == Qt::CoarseTimer ? "C" : "VC");
+ return s;
+}
+#endif
+
+static void calculateCoarseTimerTimeout(QTimerInfo *t, timeval currentTime)
+{
+ // The coarse timer works like this:
+ // - interval under 40 ms: round to even
+ // - between 40 and 99 ms: round to multiple of 4
+ // - otherwise: try to wake up at a multiple of 25 ms, with a maximum error of 5%
+ //
+ // We try to wake up at the following second-fraction, in order of preference:
+ // 0 ms
+ // 500 ms
+ // 250 ms or 750 ms
+ // 200, 400, 600, 800 ms
+ // other multiples of 100
+ // other multiples of 50
+ // other multiples of 25
+ //
+ // The objective is to make most timers wake up at the same time, thereby reducing CPU wakeups.
+
+ register uint interval = uint(t->interval);
+ register uint msec = uint(t->timeout.tv_usec) / 1000;
+ Q_ASSERT(interval >= 20);
+
+ // Calculate how much we can round and still keep within 5% error
+ uint absMaxRounding = interval / 20;
+
+ if (interval < 100 && interval != 25 && interval != 50 && interval != 75) {
+ // special mode for timers of less than 100 ms
+ if (interval < 50) {
+ // round to even
+ // round towards multiples of 50 ms
+ register bool roundUp = (msec % 50) >= 25;
+ msec >>= 1;
+ msec |= uint(roundUp);
+ msec <<= 1;
+ } else {
+ // round to multiple of 4
+ // round towards multiples of 100 ms
+ register bool roundUp = (msec % 100) >= 50;
+ msec >>= 2;
+ msec |= uint(roundUp);
+ msec <<= 2;
+ }
+ } else {
+ uint min = qMax<int>(0, msec - absMaxRounding);
+ uint max = qMin(1000u, msec + absMaxRounding);
+
+ // find the boundary that we want, according to the rules above
+ // extra rules:
+ // 1) whatever the interval, we'll take any round-to-the-second timeout
+ if (min == 0) {
+ msec = 0;
+ goto recalculate;
+ } else if (max == 1000) {
+ msec = 1000;
+ goto recalculate;
+ }
+
+ uint wantedBoundaryMultiple;
+
+ // 2) if the interval is a multiple of 500 ms and > 5000 ms, we'll always round
+ // towards a round-to-the-second
+ // 3) if the interval is a multiple of 500 ms, we'll round towards the nearest
+ // multiple of 500 ms
+ if ((interval % 500) == 0) {
+ if (interval >= 5000) {
+ msec = msec >= 500 ? max : min;
+ goto recalculate;
+ } else {
+ wantedBoundaryMultiple = 500;
+ }
+ } else if ((interval % 50) == 0) {
+ // 4) same for multiples of 250, 200, 100, 50
+ uint mult50 = interval / 50;
+ if ((mult50 % 4) == 0) {
+ // multiple of 200
+ wantedBoundaryMultiple = 200;
+ } else if ((mult50 % 2) == 0) {
+ // multiple of 100
+ wantedBoundaryMultiple = 100;
+ } else if ((mult50 % 5) == 0) {
+ // multiple of 250
+ wantedBoundaryMultiple = 250;
+ } else {
+ // multiple of 50
+ wantedBoundaryMultiple = 50;
+ }
+ } else {
+ wantedBoundaryMultiple = 25;
+ }
+
+ uint base = msec / wantedBoundaryMultiple * wantedBoundaryMultiple;
+ uint middlepoint = base + wantedBoundaryMultiple / 2;
+ if (msec < middlepoint)
+ msec = qMax(base, min);
+ else
+ msec = qMin(base + wantedBoundaryMultiple, max);
+ }
+
+recalculate:
+ if (msec == 1000u) {
+ ++t->timeout.tv_sec;
+ t->timeout.tv_usec = 0;
+ } else {
+ t->timeout.tv_usec = msec * 1000;
+ }
+
+ if (t->timeout < currentTime)
+ t->timeout += interval;
+}
+
+static void calculateNextTimeout(QTimerInfo *t, timeval currentTime)
+{
+ switch (t->timerType) {
+ case Qt::PreciseTimer:
+ case Qt::CoarseTimer:
+ t->timeout += t->interval;
+ if (t->timeout < currentTime) {
+ t->timeout = currentTime;
+ t->timeout += t->interval;
+ }
+#ifdef QTIMERINFO_DEBUG
+ t->expected += t->interval;
+ if (t->expected < currentTime) {
+ t->expected = currentTime;
+ t->expected += t->interval;
+ }
+#endif
+ if (t->timerType == Qt::CoarseTimer)
+ calculateCoarseTimerTimeout(t, currentTime);
+ return;
+
+ case Qt::VeryCoarseTimer:
+ // we don't need to take care of the microsecond component of t->interval
+ t->timeout.tv_sec += t->interval;
+ if (t->timeout.tv_sec <= currentTime.tv_sec)
+ t->timeout.tv_sec = currentTime.tv_sec + t->interval;
+#ifdef QTIMERINFO_DEBUG
+ t->expected.tv_sec += t->interval;
+ if (t->expected.tv_sec <= currentTime.tv_sec)
+ t->expected.tv_sec = currentTime.tv_sec + t->interval;
+#endif
+ return;
+ }
+
+#ifdef QTIMERINFO_DEBUG
+ if (t->timerType != Qt::PreciseTimer)
+ qDebug() << "timer" << t->timerType << hex << t->id << dec << "interval" << t->interval
+ << "originally expected at" << t->expected << "will fire at" << t->timeout
+ << "or" << (t->timeout - t->expected) << "s late";
+#endif
+}
+
+/*
+ Returns the time to wait for the next timer, or null if no timers
+ are waiting.
+*/
+bool QTimerInfoList::timerWait(timeval &tm)
+{
+ timeval currentTime = updateCurrentTime();
+ repairTimersIfNeeded();
+
+ // Find first waiting timer not already active
+ QTimerInfo *t = 0;
+ for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) {
+ if (!(*it)->activateRef) {
+ t = *it;
+ break;
+ }
+ }
+
+ if (!t)
+ return false;
+
+ if (currentTime < t->timeout) {
+ // time to wait
+ tm = roundToMillisecond(t->timeout - currentTime);
+ } else {
+ // no time to wait
+ tm.tv_sec = 0;
+ tm.tv_usec = 0;
+ }
+
+ return true;
+}
+
+void QTimerInfoList::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object)
+{
+ QTimerInfo *t = new QTimerInfo;
+ t->id = timerId;
+ t->interval = interval;
+ t->timerType = timerType;
+ t->obj = object;
+ t->activateRef = 0;
+
+ timeval expected = updateCurrentTime() + interval;
+
+ switch (timerType) {
+ case Qt::PreciseTimer:
+ // high precision timer is based on millisecond precision
+ // so no adjustment is necessary
+ t->timeout = expected;
+ break;
+
+ case Qt::CoarseTimer:
+ // this timer has up to 5% coarseness
+ // so our boundaries are 20 ms and 20 s
+ // below 20 ms, 5% inaccuracy is below 1 ms, so we convert to high precision
+ // above 20 s, 5% inaccuracy is above 1 s, so we convert to VeryCoarseTimer
+ if (interval >= 20000) {
+ t->timerType = Qt::VeryCoarseTimer;
+ // fall through
+ } else {
+ t->timeout = expected;
+ if (interval <= 20) {
+ t->timerType = Qt::PreciseTimer;
+ // no adjustment is necessary
+ } else if (interval <= 20000) {
+ calculateCoarseTimerTimeout(t, currentTime);
+ }
+ break;
+ }
+ // fall through
+ case Qt::VeryCoarseTimer:
+ // the very coarse timer is based on full second precision,
+ // so we keep the interval in seconds (round to closest second)
+ t->interval /= 500;
+ t->interval += 1;
+ t->interval >>= 1;
+ t->timeout.tv_sec = currentTime.tv_sec + t->interval;
+ t->timeout.tv_usec = 0;
+
+ // if we're past the half-second mark, increase the timeout again
+ if (currentTime.tv_usec > 500*1000)
+ ++t->timeout.tv_sec;
+ }
+
+ timerInsert(t);
+
+#ifdef QTIMERINFO_DEBUG
+ t->expected = expected;
+ t->cumulativeError = 0;
+ t->count = 0;
+ if (t->timerType != Qt::PreciseTimer)
+ qDebug() << "timer" << t->timerType << hex <<t->id << dec << "interval" << t->interval << "expected at"
+ << t->expected << "will fire first at" << t->timeout;
+#endif
+}
+
+bool QTimerInfoList::unregisterTimer(int timerId)
+{
+ // set timer inactive
+ for (int i = 0; i < count(); ++i) {
+ register QTimerInfo *t = at(i);
+ if (t->id == timerId) {
+ // found it
+ removeAt(i);
+ if (t == firstTimerInfo)
+ firstTimerInfo = 0;
+ if (t->activateRef)
+ *(t->activateRef) = 0;
+ delete t;
+ return true;
+ }
+ }
+ // id not found
+ return false;
+}
+
+bool QTimerInfoList::unregisterTimers(QObject *object)
+{
+ if (isEmpty())
+ return false;
+ for (int i = 0; i < count(); ++i) {
+ register QTimerInfo *t = at(i);
+ if (t->obj == object) {
+ // object found
+ removeAt(i);
+ if (t == firstTimerInfo)
+ firstTimerInfo = 0;
+ if (t->activateRef)
+ *(t->activateRef) = 0;
+ delete t;
+ // move back one so that we don't skip the new current item
+ --i;
+ }
+ }
+ return true;
+}
+
+QList<QAbstractEventDispatcher::TimerInfo> QTimerInfoList::registeredTimers(QObject *object) const
+{
+ QList<QAbstractEventDispatcher::TimerInfo> list;
+ for (int i = 0; i < count(); ++i) {
+ register const QTimerInfo * const t = at(i);
+ if (t->obj == object) {
+ list << QAbstractEventDispatcher::TimerInfo(t->id,
+ (t->timerType == Qt::VeryCoarseTimer
+ ? t->interval * 1000
+ : t->interval),
+ t->timerType);
+ }
+ }
+ return list;
+}
+
+/*
+ Activate pending timers, returning how many where activated.
+*/
+int QTimerInfoList::activateTimers()
+{
+ if (qt_disable_lowpriority_timers || isEmpty())
+ return 0; // nothing to do
+
+ int n_act = 0, maxCount = 0;
+ firstTimerInfo = 0;
+
+ timeval currentTime = updateCurrentTime();
+ // qDebug() << "Thread" << QThread::currentThreadId() << "woken up at" << currentTime;
+ repairTimersIfNeeded();
+
+
+ // Find out how many timer have expired
+ for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) {
+ if (currentTime < (*it)->timeout)
+ break;
+ maxCount++;
+ }
+
+ //fire the timers.
+ while (maxCount--) {
+ if (isEmpty())
+ break;
+
+ QTimerInfo *currentTimerInfo = first();
+ if (currentTime < currentTimerInfo->timeout)
+ break; // no timer has expired
+
+ if (!firstTimerInfo) {
+ firstTimerInfo = currentTimerInfo;
+ } else if (firstTimerInfo == currentTimerInfo) {
+ // avoid sending the same timer multiple times
+ break;
+ } else if (currentTimerInfo->interval < firstTimerInfo->interval
+ || currentTimerInfo->interval == firstTimerInfo->interval) {
+ firstTimerInfo = currentTimerInfo;
+ }
+
+ // remove from list
+ removeFirst();
+
+#ifdef QTIMERINFO_DEBUG
+ float diff;
+ if (currentTime < currentTimerInfo->expected) {
+ // early
+ timeval early = currentTimerInfo->expected - currentTime;
+ diff = -(early.tv_sec + early.tv_usec / 1000000.0);
+ } else {
+ timeval late = currentTime - currentTimerInfo->expected;
+ diff = late.tv_sec + late.tv_usec / 1000000.0;
+ }
+ currentTimerInfo->cumulativeError += diff;
+ ++currentTimerInfo->count;
+ if (currentTimerInfo->timerType != Qt::PreciseTimer)
+ qDebug() << "timer" << currentTimerInfo->timerType << hex << currentTimerInfo->id << dec << "interval"
+ << currentTimerInfo->interval << "firing at" << currentTime
+ << "(orig" << currentTimerInfo->expected << "scheduled at" << currentTimerInfo->timeout
+ << ") off by" << diff << "activation" << currentTimerInfo->count
+ << "avg error" << (currentTimerInfo->cumulativeError / currentTimerInfo->count);
+#endif
+
+ // determine next timeout time
+ calculateNextTimeout(currentTimerInfo, currentTime);
+
+ // reinsert timer
+ timerInsert(currentTimerInfo);
+ if (currentTimerInfo->interval > 0)
+ n_act++;
+
+ if (!currentTimerInfo->activateRef) {
+ // send event, but don't allow it to recurse
+ currentTimerInfo->activateRef = &currentTimerInfo;
+
+ QTimerEvent e(currentTimerInfo->id);
+ QCoreApplication::sendEvent(currentTimerInfo->obj, &e);
+
+ if (currentTimerInfo)
+ currentTimerInfo->activateRef = 0;
+ }
+ }
+
+ firstTimerInfo = 0;
+ // qDebug() << "Thread" << QThread::currentThreadId() << "activated" << n_act << "timers";
+ return n_act;
+}
+
+QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qtimerinfo_unix_p.h b/src/corelib/kernel/qtimerinfo_unix_p.h
new file mode 100644
index 0000000000..8a057dda60
--- /dev/null
+++ b/src/corelib/kernel/qtimerinfo_unix_p.h
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTIMERINFO_UNIX_P_H
+#define QTIMERINFO_UNIX_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.
+//
+
+// #define QTIMERINFO_DEBUG
+
+#include "qabstracteventdispatcher.h"
+
+#include <sys/time.h> // struct timeval
+
+QT_BEGIN_NAMESPACE
+
+// internal timer info
+struct QTimerInfo {
+ int id; // - timer identifier
+ int interval; // - timer interval in milliseconds
+ Qt::TimerType timerType; // - timer type
+ timeval timeout; // - when to actually fire
+ QObject *obj; // - object to receive event
+ QTimerInfo **activateRef; // - ref from activateTimers
+
+#ifdef QTIMERINFO_DEBUG
+ timeval expected; // when timer is expected to fire
+ float cumulativeError;
+ uint count;
+#endif
+};
+
+class Q_CORE_EXPORT QTimerInfoList : public QList<QTimerInfo*>
+{
+#if ((_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC)) || defined(QT_BOOTSTRAPPED)
+ timeval previousTime;
+ clock_t previousTicks;
+ int ticksPerSecond;
+ int msPerTick;
+
+ bool timeChanged(timeval *delta);
+ void timerRepair(const timeval &);
+#endif
+
+ // state variables used by activateTimers()
+ QTimerInfo *firstTimerInfo;
+
+public:
+ QTimerInfoList();
+
+ timeval currentTime;
+ timeval updateCurrentTime();
+
+ // must call updateCurrentTime() first!
+ void repairTimersIfNeeded();
+
+ bool timerWait(timeval &);
+ void timerInsert(QTimerInfo *);
+
+ void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object);
+ bool unregisterTimer(int timerId);
+ bool unregisterTimers(QObject *object);
+ QList<QAbstractEventDispatcher::TimerInfo> registeredTimers(QObject *object) const;
+
+ int activateTimers();
+};
+
+QT_END_NAMESPACE
+
+#endif // QTIMERINFO_UNIX_P_H
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp
index 2796902590..aadf3a76e9 100644
--- a/src/corelib/kernel/qtranslator.cpp
+++ b/src/corelib/kernel/qtranslator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qtranslator.h b/src/corelib/kernel/qtranslator.h
index 43cd63d1da..b1f378a8b5 100644
--- a/src/corelib/kernel/qtranslator.h
+++ b/src/corelib/kernel/qtranslator.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qtranslator_p.h b/src/corelib/kernel/qtranslator_p.h
index 426be0b19b..23164ecac6 100644
--- a/src/corelib/kernel/qtranslator_p.h
+++ b/src/corelib/kernel/qtranslator_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 29717398a8..72229c0e63 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -52,6 +52,10 @@
#include "qstringlist.h"
#include "qurl.h"
#include "qlocale.h"
+#include "quuid.h"
+#ifndef QT_BOOTSTRAPPED
+#include "qabstractitemmodel.h"
+#endif
#include "private/qvariant_p.h"
#include "qmetatype_p.h"
@@ -74,6 +78,25 @@ QT_BEGIN_NAMESPACE
#endif
namespace {
+class HandlersManager
+{
+ static const QVariant::Handler *Handlers[QModulesPrivate::ModulesCount];
+public:
+ const QVariant::Handler *operator[] (const int typeId) const
+ {
+ return Handlers[QModulesPrivate::moduleForType(typeId)];
+ }
+
+ void registerHandler(const QModulesPrivate::Names name, const QVariant::Handler *handler)
+ {
+ Handlers[name] = handler;
+ }
+
+ inline void unregisterHandler(const QModulesPrivate::Names name);
+};
+} // namespace
+
+namespace {
template<typename T>
struct TypeDefiniton {
static const bool IsAvailable = true;
@@ -82,6 +105,7 @@ struct TypeDefiniton {
// Ignore these types, as incomplete
#ifdef QT_BOOTSTRAPPED
template<> struct TypeDefiniton<QEasingCurve> { static const bool IsAvailable = false; };
+template<> struct TypeDefiniton<QModelIndex> { static const bool IsAvailable = false; };
#endif
#ifdef QT_NO_GEOM_VARIANT
template<> struct TypeDefiniton<QRect> { static const bool IsAvailable = false; };
@@ -100,7 +124,9 @@ struct CoreTypesFilter {
static const bool IsAccepted = QTypeModuleInfo<T>::IsCore && TypeDefiniton<T>::IsAvailable;
};
};
-} // namspace
+} // annonymous used to hide TypeDefiniton
+
+namespace { // annonymous used to hide QVariant handlers
static void construct(QVariant::Private *x, const void *copy)
{
@@ -324,6 +350,9 @@ static bool convert(const QVariant::Private *d, QVariant::Type t, void *result,
case QVariant::Url:
*str = v_cast<QUrl>(d)->toString();
break;
+ case QVariant::Uuid:
+ *str = v_cast<QUuid>(d)->toString();
+ break;
default:
return false;
}
@@ -688,6 +717,15 @@ static bool convert(const QVariant::Private *d, QVariant::Type t, void *result,
return *ok;
}
#endif
+ case QVariant::Uuid:
+ switch (d->type) {
+ case QVariant::String:
+ *static_cast<QUuid *>(result) = QUuid(*v_cast<QString>(d));
+ break;
+ default:
+ return false;
+ }
+ break;
default:
return false;
}
@@ -697,101 +735,9 @@ static bool convert(const QVariant::Private *d, QVariant::Type t, void *result,
#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
static void streamDebug(QDebug dbg, const QVariant &v)
{
- switch (v.userType()) {
- case QVariant::Int:
- dbg.nospace() << v.toInt();
- break;
- case QVariant::UInt:
- dbg.nospace() << v.toUInt();
- break;
- case QVariant::LongLong:
- dbg.nospace() << v.toLongLong();
- break;
- case QVariant::ULongLong:
- dbg.nospace() << v.toULongLong();
- break;
- case QMetaType::Float:
- dbg.nospace() << v.toFloat();
- break;
- case QMetaType::QObjectStar:
- dbg.nospace() << qvariant_cast<QObject *>(v);
- break;
- case QVariant::Double:
- dbg.nospace() << v.toDouble();
- break;
- case QVariant::Bool:
- dbg.nospace() << v.toBool();
- break;
- case QVariant::String:
- dbg.nospace() << v.toString();
- break;
- case QVariant::Char:
- dbg.nospace() << v.toChar();
- break;
- case QVariant::StringList:
- dbg.nospace() << v.toStringList();
- break;
- case QVariant::Map:
- dbg.nospace() << v.toMap();
- break;
- case QVariant::Hash:
- dbg.nospace() << v.toHash();
- break;
- case QVariant::List:
- dbg.nospace() << v.toList();
- break;
- case QVariant::Date:
- dbg.nospace() << v.toDate();
- break;
- case QVariant::Time:
- dbg.nospace() << v.toTime();
- break;
- case QVariant::DateTime:
- dbg.nospace() << v.toDateTime();
- break;
-#ifndef QT_BOOTSTRAPPED
- case QVariant::EasingCurve:
- dbg.nospace() << v.toEasingCurve();
- break;
-#endif
- case QVariant::ByteArray:
- dbg.nospace() << v.toByteArray();
- break;
- case QVariant::Url:
- dbg.nospace() << v.toUrl();
- break;
-#ifndef QT_NO_GEOM_VARIANT
- case QVariant::Point:
- dbg.nospace() << v.toPoint();
- break;
- case QVariant::PointF:
- dbg.nospace() << v.toPointF();
- break;
- case QVariant::Rect:
- dbg.nospace() << v.toRect();
- break;
- case QVariant::Size:
- dbg.nospace() << v.toSize();
- break;
- case QVariant::SizeF:
- dbg.nospace() << v.toSizeF();
- break;
- case QVariant::Line:
- dbg.nospace() << v.toLine();
- break;
- case QVariant::LineF:
- dbg.nospace() << v.toLineF();
- break;
- case QVariant::RectF:
- dbg.nospace() << v.toRectF();
- break;
-#endif
- case QVariant::BitArray:
- //dbg.nospace() << v.toBitArray();
- break;
- default:
- break;
- }
+ QVariant::Private *d = const_cast<QVariant::Private *>(&v.data_ptr());
+ QVariantDebugStream<CoreTypesFilter> stream(dbg, d);
+ QMetaTypeSwitcher::switcher<void>(stream, d->type, 0);
}
#endif
@@ -813,13 +759,142 @@ const QVariant::Handler qt_kernel_variant_handler = {
#endif
};
+static void dummyConstruct(QVariant::Private *, const void *) { Q_ASSERT_X(false, "QVariant", "Trying to construct an unknown type"); }
+static void dummyClear(QVariant::Private *) { Q_ASSERT_X(false, "QVariant", "Trying to clear an unknown type"); }
+static bool dummyIsNull(const QVariant::Private *d) { Q_ASSERT_X(false, "QVariant::isNull", "Trying to call isNull on an unknown type"); return d->is_null; }
+static bool dummyCompare(const QVariant::Private *, const QVariant::Private *) { Q_ASSERT_X(false, "QVariant", "Trying to compare an unknown types"); return false; }
+static bool dummyConvert(const QVariant::Private *, QVariant::Type , void *, bool *) { Q_ASSERT_X(false, "QVariant", "Trying to convert an unknown type"); return false; }
+#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
+static void dummyStreamDebug(QDebug, const QVariant &) { Q_ASSERT_X(false, "QVariant", "Trying to convert an unknown type"); }
+#endif
+const QVariant::Handler qt_dummy_variant_handler = {
+ dummyConstruct,
+ dummyClear,
+ dummyIsNull,
+#ifndef QT_NO_DATASTREAM
+ 0,
+ 0,
+#endif
+ dummyCompare,
+ dummyConvert,
+ 0,
+#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
+ dummyStreamDebug
+#else
+ 0
+#endif
+};
+
+static void customConstruct(QVariant::Private *d, const void *copy)
+{
+ const uint size = QMetaType::sizeOf(d->type);
+ if (!size) {
+ d->type = QVariant::Invalid;
+ return;
+ }
+
+ // this logic should match with QVariantIntegrator::CanUseInternalSpace
+ if (size <= sizeof(QVariant::Private::Data)
+ && (QMetaType::typeFlags(d->type) & QMetaType::MovableType)) {
+ QMetaType::construct(d->type, &d->data.ptr, copy);
+ d->is_shared = false;
+ } else {
+ void *ptr = QMetaType::create(d->type, copy);
+ d->is_shared = true;
+ d->data.shared = new QVariant::PrivateShared(ptr);
+ }
+}
+
+static void customClear(QVariant::Private *d)
+{
+ if (!d->is_shared) {
+ QMetaType::destruct(d->type, &d->data.ptr);
+ } else {
+ QMetaType::destroy(d->type, d->data.shared->ptr);
+ delete d->data.shared;
+ }
+}
+
+static bool customIsNull(const QVariant::Private *d)
+{
+ return d->is_null;
+}
+
+static bool customCompare(const QVariant::Private *a, const QVariant::Private *b)
+{
+ const char *const typeName = QMetaType::typeName(a->type);
+ if (Q_UNLIKELY(!typeName) && Q_LIKELY(!QMetaType::isRegistered(a->type)))
+ qFatal("QVariant::compare: type %d unknown to QVariant.", a->type);
+
+ const void *a_ptr = a->is_shared ? a->data.shared->ptr : &(a->data.ptr);
+ const void *b_ptr = b->is_shared ? b->data.shared->ptr : &(b->data.ptr);
+
+ uint typeNameLen = qstrlen(typeName);
+ if (typeNameLen > 0 && typeName[typeNameLen - 1] == '*')
+ return *static_cast<void *const *>(a_ptr) == *static_cast<void *const *>(b_ptr);
+
+ if (a->is_null && b->is_null)
+ return true;
+
+ return !memcmp(a_ptr, b_ptr, QMetaType::sizeOf(a->type));
+}
+
+static bool customConvert(const QVariant::Private *, QVariant::Type, void *, bool *ok)
+{
+ if (ok)
+ *ok = false;
+ return false;
+}
+
+#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
+static void customStreamDebug(QDebug, const QVariant &) {}
+#endif
+
+const QVariant::Handler qt_custom_variant_handler = {
+ customConstruct,
+ customClear,
+ customIsNull,
+#ifndef QT_NO_DATASTREAM
+ 0,
+ 0,
+#endif
+ customCompare,
+ customConvert,
+ 0,
+#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
+ customStreamDebug
+#else
+ 0
+#endif
+};
+
+} // annonymous used to hide QVariant handlers
+
+static HandlersManager handlerManager;
+Q_STATIC_ASSERT_X(!QModulesPrivate::Core, "Initialization assumes that ModulesNames::Core is 0");
+const QVariant::Handler *HandlersManager::Handlers[QModulesPrivate::ModulesCount]
+ = { &qt_kernel_variant_handler, &qt_dummy_variant_handler,
+ &qt_dummy_variant_handler, &qt_custom_variant_handler };
+
Q_CORE_EXPORT const QVariant::Handler *qcoreVariantHandler()
{
return &qt_kernel_variant_handler;
}
+inline void HandlersManager::unregisterHandler(const QModulesPrivate::Names name)
+{
+ Handlers[name] = &qt_dummy_variant_handler;
+}
-const QVariant::Handler *QVariant::handler = &qt_kernel_variant_handler;
+Q_CORE_EXPORT void QVariantPrivate::registerHandler(const int /* Modules::Names */name, const QVariant::Handler *handler)
+{
+ handlerManager.registerHandler(static_cast<QModulesPrivate::Names>(name), handler);
+}
+
+Q_CORE_EXPORT void QVariantPrivate::unregisterHandler(const int /* Modules::Names */ name)
+{
+ handlerManager.unregisterHandler(static_cast<QModulesPrivate::Names>(name));
+}
/*!
\class QVariant
@@ -923,6 +998,8 @@ const QVariant::Handler *QVariant::handler = &qt_kernel_variant_handler;
\value DateTime a QDateTime
\value Double a double
\value EasingCurve a QEasingCurve
+ \value Uuid a QUuid
+ \value ModelIndex a QModelIndex
\value Font a QFont
\value Hash a QVariantHash
\value Icon a QIcon
@@ -1018,7 +1095,7 @@ const QVariant::Handler *QVariant::handler = &qt_kernel_variant_handler;
void QVariant::create(int type, const void *copy)
{
d.type = type;
- handler->construct(&d, copy);
+ handlerManager[type]->construct(&d, copy);
}
/*!
@@ -1035,7 +1112,7 @@ void QVariant::create(int type, const void *copy)
QVariant::~QVariant()
{
if ((d.is_shared && !d.data.shared->ref.deref()) || (!d.is_shared && d.type > Char))
- handler->clear(&d);
+ handlerManager[d.type]->clear(&d);
}
/*!
@@ -1051,7 +1128,7 @@ QVariant::QVariant(const QVariant &p)
if (d.is_shared) {
d.data.shared->ref.ref();
} else if (p.d.type > Char) {
- handler->construct(&d, p.constData());
+ handlerManager[d.type]->construct(&d, p.constData());
d.is_null = p.d.is_null;
}
}
@@ -1435,7 +1512,7 @@ QVariant& QVariant::operator=(const QVariant &variant)
d = variant.d;
} else if (variant.d.type > Char) {
d.type = variant.d.type;
- handler->construct(&d, variant.constData());
+ handlerManager[d.type]->construct(&d, variant.constData());
d.is_null = variant.d.is_null;
} else {
d = variant.d;
@@ -1465,9 +1542,9 @@ void QVariant::detach()
Private dd;
dd.type = d.type;
- handler->construct(&dd, constData());
+ handlerManager[d.type]->construct(&dd, constData());
if (!d.data.shared->ref.deref())
- handler->clear(&d);
+ handlerManager[d.type]->clear(&d);
d.data.shared = dd.data.shared;
}
@@ -1496,7 +1573,7 @@ const char *QVariant::typeName() const
void QVariant::clear()
{
if ((d.is_shared && !d.data.shared->ref.deref()) || (!d.is_shared && d.type > Char))
- handler->clear(&d);
+ handlerManager[d.type]->clear(&d);
d.type = Invalid;
d.is_null = true;
d.is_shared = false;
@@ -1732,14 +1809,14 @@ QDataStream& operator<<(QDataStream &s, const QVariant::Type p)
*/
template <typename T>
-inline T qVariantToHelper(const QVariant::Private &d, QVariant::Type t,
- const QVariant::Handler *handler, T * = 0)
+inline T qVariantToHelper(const QVariant::Private &d, const HandlersManager &handlerManager)
{
- if (d.type == t)
+ const QVariant::Type targetType = static_cast<const QVariant::Type>(qMetaTypeId<T>());
+ if (d.type == targetType)
return *v_cast<T>(&d);
T ret;
- handler->convert(&d, t, &ret, 0);
+ handlerManager[d.type]->convert(&d, targetType, &ret, 0);
return ret;
}
@@ -1754,7 +1831,7 @@ inline T qVariantToHelper(const QVariant::Private &d, QVariant::Type t,
*/
QStringList QVariant::toStringList() const
{
- return qVariantToHelper<QStringList>(d, StringList, handler);
+ return qVariantToHelper<QStringList>(d, handlerManager);
}
/*!
@@ -1767,7 +1844,7 @@ QStringList QVariant::toStringList() const
*/
QString QVariant::toString() const
{
- return qVariantToHelper<QString>(d, String, handler);
+ return qVariantToHelper<QString>(d, handlerManager);
}
/*!
@@ -1778,7 +1855,7 @@ QString QVariant::toString() const
*/
QVariantMap QVariant::toMap() const
{
- return qVariantToHelper<QVariantMap>(d, Map, handler);
+ return qVariantToHelper<QVariantMap>(d, handlerManager);
}
/*!
@@ -1789,7 +1866,7 @@ QVariantMap QVariant::toMap() const
*/
QVariantHash QVariant::toHash() const
{
- return qVariantToHelper<QVariantHash>(d, Hash, handler);
+ return qVariantToHelper<QVariantHash>(d, handlerManager);
}
/*!
@@ -1805,7 +1882,7 @@ QVariantHash QVariant::toHash() const
*/
QDate QVariant::toDate() const
{
- return qVariantToHelper<QDate>(d, Date, handler);
+ return qVariantToHelper<QDate>(d, handlerManager);
}
/*!
@@ -1821,7 +1898,7 @@ QDate QVariant::toDate() const
*/
QTime QVariant::toTime() const
{
- return qVariantToHelper<QTime>(d, Time, handler);
+ return qVariantToHelper<QTime>(d, handlerManager);
}
/*!
@@ -1838,7 +1915,7 @@ QTime QVariant::toTime() const
*/
QDateTime QVariant::toDateTime() const
{
- return qVariantToHelper<QDateTime>(d, DateTime, handler);
+ return qVariantToHelper<QDateTime>(d, handlerManager);
}
/*!
@@ -1853,7 +1930,7 @@ QDateTime QVariant::toDateTime() const
#ifndef QT_BOOTSTRAPPED
QEasingCurve QVariant::toEasingCurve() const
{
- return qVariantToHelper<QEasingCurve>(d, EasingCurve, handler);
+ return qVariantToHelper<QEasingCurve>(d, handlerManager);
}
#endif
@@ -1868,7 +1945,7 @@ QEasingCurve QVariant::toEasingCurve() const
*/
QByteArray QVariant::toByteArray() const
{
- return qVariantToHelper<QByteArray>(d, ByteArray, handler);
+ return qVariantToHelper<QByteArray>(d, handlerManager);
}
#ifndef QT_NO_GEOM_VARIANT
@@ -1882,7 +1959,7 @@ QByteArray QVariant::toByteArray() const
*/
QPoint QVariant::toPoint() const
{
- return qVariantToHelper<QPoint>(d, Point, handler);
+ return qVariantToHelper<QPoint>(d, handlerManager);
}
/*!
@@ -1895,7 +1972,7 @@ QPoint QVariant::toPoint() const
*/
QRect QVariant::toRect() const
{
- return qVariantToHelper<QRect>(d, Rect, handler);
+ return qVariantToHelper<QRect>(d, handlerManager);
}
/*!
@@ -1908,7 +1985,7 @@ QRect QVariant::toRect() const
*/
QSize QVariant::toSize() const
{
- return qVariantToHelper<QSize>(d, Size, handler);
+ return qVariantToHelper<QSize>(d, handlerManager);
}
/*!
@@ -1921,7 +1998,7 @@ QSize QVariant::toSize() const
*/
QSizeF QVariant::toSizeF() const
{
- return qVariantToHelper<QSizeF>(d, SizeF, handler);
+ return qVariantToHelper<QSizeF>(d, handlerManager);
}
/*!
@@ -1934,7 +2011,7 @@ QSizeF QVariant::toSizeF() const
*/
QRectF QVariant::toRectF() const
{
- return qVariantToHelper<QRectF>(d, RectF, handler);
+ return qVariantToHelper<QRectF>(d, handlerManager);
}
/*!
@@ -1947,7 +2024,7 @@ QRectF QVariant::toRectF() const
*/
QLineF QVariant::toLineF() const
{
- return qVariantToHelper<QLineF>(d, LineF, handler);
+ return qVariantToHelper<QLineF>(d, handlerManager);
}
/*!
@@ -1960,7 +2037,7 @@ QLineF QVariant::toLineF() const
*/
QLine QVariant::toLine() const
{
- return qVariantToHelper<QLine>(d, Line, handler);
+ return qVariantToHelper<QLine>(d, handlerManager);
}
/*!
@@ -1973,7 +2050,7 @@ QLine QVariant::toLine() const
*/
QPointF QVariant::toPointF() const
{
- return qVariantToHelper<QPointF>(d, PointF, handler);
+ return qVariantToHelper<QPointF>(d, handlerManager);
}
#endif // QT_NO_GEOM_VARIANT
@@ -1988,7 +2065,7 @@ QPointF QVariant::toPointF() const
*/
QUrl QVariant::toUrl() const
{
- return qVariantToHelper<QUrl>(d, Url, handler);
+ return qVariantToHelper<QUrl>(d, handlerManager);
}
/*!
@@ -2001,7 +2078,7 @@ QUrl QVariant::toUrl() const
*/
QLocale QVariant::toLocale() const
{
- return qVariantToHelper<QLocale>(d, Locale, handler);
+ return qVariantToHelper<QLocale>(d, handlerManager);
}
/*!
@@ -2016,7 +2093,7 @@ QLocale QVariant::toLocale() const
#ifndef QT_NO_REGEXP
QRegExp QVariant::toRegExp() const
{
- return qVariantToHelper<QRegExp>(d, RegExp, handler);
+ return qVariantToHelper<QRegExp>(d, handlerManager);
}
#endif
@@ -2030,7 +2107,7 @@ QRegExp QVariant::toRegExp() const
*/
QChar QVariant::toChar() const
{
- return qVariantToHelper<QChar>(d, Char, handler);
+ return qVariantToHelper<QChar>(d, handlerManager);
}
/*!
@@ -2041,12 +2118,12 @@ QChar QVariant::toChar() const
*/
QBitArray QVariant::toBitArray() const
{
- return qVariantToHelper<QBitArray>(d, BitArray, handler);
+ return qVariantToHelper<QBitArray>(d, handlerManager);
}
template <typename T>
inline T qNumVariantToHelper(const QVariant::Private &d,
- const QVariant::Handler *handler, bool *ok, const T& val)
+ const HandlersManager &handlerManager, bool *ok, const T& val)
{
uint t = qMetaTypeId<T>();
if (ok)
@@ -2054,8 +2131,8 @@ inline T qNumVariantToHelper(const QVariant::Private &d,
if (d.type == t)
return val;
- T ret;
- if (!handler->convert(&d, QVariant::Type(t), &ret, ok) && ok)
+ T ret = 0;
+ if (!handlerManager[d.type]->convert(&d, QVariant::Type(t), &ret, ok) && ok)
*ok = false;
return ret;
}
@@ -2077,7 +2154,7 @@ inline T qNumVariantToHelper(const QVariant::Private &d,
*/
int QVariant::toInt(bool *ok) const
{
- return qNumVariantToHelper<int>(d, handler, ok, d.data.i);
+ return qNumVariantToHelper<int>(d, handlerManager, ok, d.data.i);
}
/*!
@@ -2097,7 +2174,7 @@ int QVariant::toInt(bool *ok) const
*/
uint QVariant::toUInt(bool *ok) const
{
- return qNumVariantToHelper<uint>(d, handler, ok, d.data.u);
+ return qNumVariantToHelper<uint>(d, handlerManager, ok, d.data.u);
}
/*!
@@ -2112,7 +2189,7 @@ uint QVariant::toUInt(bool *ok) const
*/
qlonglong QVariant::toLongLong(bool *ok) const
{
- return qNumVariantToHelper<qlonglong>(d, handler, ok, d.data.ll);
+ return qNumVariantToHelper<qlonglong>(d, handlerManager, ok, d.data.ll);
}
/*!
@@ -2128,7 +2205,7 @@ qlonglong QVariant::toLongLong(bool *ok) const
*/
qulonglong QVariant::toULongLong(bool *ok) const
{
- return qNumVariantToHelper<qulonglong>(d, handler, ok, d.data.ull);
+ return qNumVariantToHelper<qulonglong>(d, handlerManager, ok, d.data.ull);
}
/*!
@@ -2148,7 +2225,7 @@ bool QVariant::toBool() const
return d.data.b;
bool res = false;
- handler->convert(&d, Bool, &res, 0);
+ handlerManager[d.type]->convert(&d, Bool, &res, 0);
return res;
}
@@ -2165,7 +2242,7 @@ bool QVariant::toBool() const
*/
double QVariant::toDouble(bool *ok) const
{
- return qNumVariantToHelper<double>(d, handler, ok, d.data.d);
+ return qNumVariantToHelper<double>(d, handlerManager, ok, d.data.d);
}
/*!
@@ -2182,7 +2259,7 @@ double QVariant::toDouble(bool *ok) const
*/
float QVariant::toFloat(bool *ok) const
{
- return qNumVariantToHelper<float>(d, handler, ok, d.data.f);
+ return qNumVariantToHelper<float>(d, handlerManager, ok, d.data.f);
}
/*!
@@ -2199,7 +2276,7 @@ float QVariant::toFloat(bool *ok) const
*/
qreal QVariant::toReal(bool *ok) const
{
- return qNumVariantToHelper<qreal>(d, handler, ok, d.data.real);
+ return qNumVariantToHelper<qreal>(d, handlerManager, ok, d.data.real);
}
/*!
@@ -2210,7 +2287,7 @@ qreal QVariant::toReal(bool *ok) const
*/
QVariantList QVariant::toList() const
{
- return qVariantToHelper<QVariantList>(d, List, handler);
+ return qVariantToHelper<QVariantList>(d, handlerManager);
}
@@ -2253,7 +2330,7 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
| 1 << QVariant::UInt | 1 << QVariant::Bool | 1 << QVariant::Double
| 1 << QVariant::Date | 1 << QVariant::Time | 1 << QVariant::DateTime
| 1 << QVariant::LongLong | 1 << QVariant::ULongLong | 1 << QVariant::Char
- | 1 << QVariant::Url,
+ | 1 << QVariant::Url | 1 << QVariant::Uuid,
/*QStringList*/ 1 << QVariant::List | 1 << QVariant::String,
@@ -2292,7 +2369,9 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
/*QHash*/ 0,
-/*QEasingCurve*/ 0
+/*QEasingCurve*/ 0,
+
+/*QUuid*/ 1 << QVariant::String
};
/*!
@@ -2418,13 +2497,25 @@ bool QVariant::convert(Type t)
return false;
bool isOk = true;
- if (!handler->convert(&oldValue.d, t, data(), &isOk))
+ if (!handlerManager[d.type]->convert(&oldValue.d, t, data(), &isOk))
isOk = false;
d.is_null = !isOk;
return isOk;
}
/*!
+ \fn convert(const int type, void *ptr) const
+ \internal
+ Created for qvariant_cast() usage
+*/
+bool QVariant::convert(const int type, void *ptr) const
+{
+ Q_ASSERT(type < int(QMetaType::User));
+ return handlerManager[type]->convert(&d, QVariant::Type(type), ptr, 0);
+}
+
+
+/*!
\fn bool operator==(const QVariant &v1, const QVariant &v2)
\relates QVariant
@@ -2490,7 +2581,7 @@ bool QVariant::cmp(const QVariant &v) const
if (!v2.canConvert(Type(d.type)) || !v2.convert(Type(d.type)))
return false;
}
- return handler->compare(&d, &v2.d);
+ return handlerManager[d.type]->compare(&d, &v2.d);
}
/*! \internal
@@ -2520,15 +2611,15 @@ void* QVariant::data()
*/
bool QVariant::isNull() const
{
- return handler->isNull(&d);
+ return handlerManager[d.type]->isNull(&d);
}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QVariant &v)
{
#ifndef Q_BROKEN_DEBUG_STREAM
- dbg.nospace() << "QVariant(" << v.typeName() << ", ";
- QVariant::handler->debugStream(dbg, v);
+ dbg.nospace() << "QVariant(" << QMetaType::typeName(v.userType()) << ", ";
+ handlerManager[v.d.type]->debugStream(dbg, v);
dbg.nospace() << ')';
return dbg.space();
#else
@@ -2541,7 +2632,7 @@ QDebug operator<<(QDebug dbg, const QVariant &v)
QDebug operator<<(QDebug dbg, const QVariant::Type p)
{
#ifndef Q_BROKEN_DEBUG_STREAM
- dbg.nospace() << "QVariant::" << QVariant::typeToName(p);
+ dbg.nospace() << "QVariant::" << QMetaType::typeName(p);
return dbg.space();
#else
qWarning("This compiler doesn't support streaming QVariant::Type to QDebug");
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 02458a07e0..35c584fa51 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -123,6 +123,8 @@ class Q_CORE_EXPORT QVariant
RegExp = QMetaType::QRegExp,
Hash = QMetaType::QVariantHash,
EasingCurve = QMetaType::QEasingCurve,
+ Uuid = QMetaType::QUuid,
+ ModelIndex = QMetaType::QModelIndex,
LastCoreType = QMetaType::LastCoreType,
Font = QMetaType::QFont,
@@ -370,35 +372,35 @@ class Q_CORE_EXPORT QVariant
{ return !cmp(v); }
protected:
- friend inline bool qvariant_cast_helper(const QVariant &, QVariant::Type, void *);
- friend void qRegisterGuiVariant();
- friend void qUnregisterGuiVariant();
friend inline bool operator==(const QVariant &, const QVariantComparisonHelper &);
#ifndef QT_NO_DEBUG_STREAM
friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QVariant &);
#endif
Private d;
-
- static const Handler *handler;
-
+#ifndef Q_NO_TEMPLATE_FRIENDS
+ template<typename T>
+ friend inline T qvariant_cast(const QVariant &);
+private:
+#else
+public:
+#endif
void create(int type, const void *copy);
bool cmp(const QVariant &other) const;
+ bool convert(const int t, void *ptr) const;
private:
// force compile error, prevent QVariant(bool) to be called
- inline QVariant(void *) { Q_ASSERT(false); }
+ inline QVariant(void *) Q_DECL_EQ_DELETE;
#ifdef QT_NO_CAST_FROM_ASCII
// force compile error when implicit conversion is not wanted
- inline QVariant(const char *) { Q_ASSERT(false); }
+ inline QVariant(const char *) Q_DECL_EQ_DELETE;
#endif
public:
typedef Private DataPtr;
inline DataPtr &data_ptr() { return d; }
+ inline const DataPtr &data_ptr() const { return d; }
};
-inline bool qvariant_cast_helper(const QVariant &v, QVariant::Type tp, void *ptr)
-{ return QVariant::handler->convert(&v.d, tp, ptr, 0); }
-
template <typename T>
inline QVariant qVariantFromValue(const T &t)
{
@@ -488,7 +490,7 @@ template<typename T> inline T qvariant_cast(const QVariant &v)
return *reinterpret_cast<const T *>(v.constData());
if (vid < int(QMetaType::User)) {
T t;
- if (qvariant_cast_helper(v, QVariant::Type(vid), &t))
+ if (v.convert(vid, &t))
return t;
}
return T();
diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h
index 3c2176856d..015ca5b464 100644
--- a/src/corelib/kernel/qvariant_p.h
+++ b/src/corelib/kernel/qvariant_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -58,20 +58,34 @@
#include <QtCore/qglobal.h>
#include <QtCore/qvariant.h>
+#include <QtCore/private/qmetatype_p.h>
+#include <QtCore/qdebug.h>
#include "qmetatypeswitcher_p.h"
QT_BEGIN_NAMESPACE
+namespace {
+template<typename T>
+struct QVariantIntegrator
+{
+ static const bool CanUseInternalSpace = sizeof(T) <= sizeof(QVariant::Private::Data)
+ && (!QTypeInfo<T>::isStatic);
+};
+Q_STATIC_ASSERT(QVariantIntegrator<double>::CanUseInternalSpace);
+Q_STATIC_ASSERT(QVariantIntegrator<long int>::CanUseInternalSpace);
+Q_STATIC_ASSERT(QVariantIntegrator<qulonglong>::CanUseInternalSpace);
+} // namespace
+
#ifdef Q_CC_SUN // Sun CC picks the wrong overload, so introduce awful hack
template <typename T>
inline T *v_cast(const QVariant::Private *nd, T * = 0)
{
QVariant::Private *d = const_cast<QVariant::Private *>(nd);
- return ((sizeof(T) > sizeof(QVariant::Private::Data))
+ return !QVariantIntegrator<T>::CanUseInternalSpace
? static_cast<T *>(d->data.shared->ptr)
- : static_cast<T *>(static_cast<void *>(&d->data.c)));
+ : static_cast<T *>(static_cast<void *>(&d->data.c));
}
#else // every other compiler in this world
@@ -79,17 +93,17 @@ inline T *v_cast(const QVariant::Private *nd, T * = 0)
template <typename T>
inline const T *v_cast(const QVariant::Private *d, T * = 0)
{
- return ((sizeof(T) > sizeof(QVariant::Private::Data))
+ return !QVariantIntegrator<T>::CanUseInternalSpace
? static_cast<const T *>(d->data.shared->ptr)
- : static_cast<const T *>(static_cast<const void *>(&d->data.c)));
+ : static_cast<const T *>(static_cast<const void *>(&d->data.c));
}
template <typename T>
inline T *v_cast(QVariant::Private *d, T * = 0)
{
- return ((sizeof(T) > sizeof(QVariant::Private::Data))
+ return !QVariantIntegrator<T>::CanUseInternalSpace
? static_cast<T *>(d->data.shared->ptr)
- : static_cast<T *>(static_cast<void *>(&d->data.c)));
+ : static_cast<T *>(static_cast<void *>(&d->data.c));
}
#endif
@@ -110,7 +124,7 @@ private:
template <class T>
inline void v_construct(QVariant::Private *x, const void *copy, T * = 0)
{
- if (sizeof(T) > sizeof(QVariant::Private::Data)) {
+ if (!QVariantIntegrator<T>::CanUseInternalSpace) {
x->data.shared = copy ? new QVariantPrivateSharedEx<T>(*static_cast<const T *>(copy))
: new QVariantPrivateSharedEx<T>;
x->is_shared = true;
@@ -125,7 +139,7 @@ inline void v_construct(QVariant::Private *x, const void *copy, T * = 0)
template <class T>
inline void v_construct(QVariant::Private *x, const T &t)
{
- if (sizeof(T) > sizeof(QVariant::Private::Data)) {
+ if (!QVariantIntegrator<T>::CanUseInternalSpace) {
x->data.shared = new QVariantPrivateSharedEx<T>(t);
x->is_shared = true;
} else {
@@ -138,7 +152,7 @@ template <class T>
inline void v_clear(QVariant::Private *d, T* = 0)
{
- if (sizeof(T) > sizeof(QVariant::Private::Data)) {
+ if (!QVariantIntegrator<T>::CanUseInternalSpace) {
//now we need to cast
//because QVariant::PrivateShared doesn't have a virtual destructor
delete static_cast<QVariantPrivateSharedEx<T>*>(d->data.shared);
@@ -159,24 +173,7 @@ class QVariantComparator {
};
template<typename T>
struct FilteredComparator<T, /* IsAcceptedType = */ false> {
- static bool compare(const QVariant::Private *m_a, const QVariant::Private *m_b)
- {
- const char *const typeName = QMetaType::typeName(m_a->type);
- if (Q_UNLIKELY(!typeName) && Q_LIKELY(!QMetaType::isRegistered(m_a->type)))
- qFatal("QVariant::compare: type %d unknown to QVariant.", m_a->type);
-
- const void *a_ptr = m_a->is_shared ? m_a->data.shared->ptr : &(m_a->data.ptr);
- const void *b_ptr = m_b->is_shared ? m_b->data.shared->ptr : &(m_b->data.ptr);
-
- uint typeNameLen = qstrlen(typeName);
- if (typeNameLen > 0 && typeName[typeNameLen - 1] == '*')
- return *static_cast<void *const *>(a_ptr) == *static_cast<void *const *>(b_ptr);
-
- if (m_a->is_null && m_b->is_null)
- return true;
-
- return !memcmp(a_ptr, b_ptr, QMetaType::sizeOf(m_a->type));
- }
+ static bool compare(const QVariant::Private *, const QVariant::Private *) { return false; }
};
public:
QVariantComparator(const QVariant::Private *a, const QVariant::Private *b)
@@ -293,11 +290,11 @@ protected:
template<class Filter>
class QVariantConstructor
{
- template<typename T, bool IsSmall = (sizeof(T) <= sizeof(QVariant::Private::Data))>
+ template<typename T, bool CanUseInternalSpace = QVariantIntegrator<T>::CanUseInternalSpace>
struct CallConstructor {};
template<typename T>
- struct CallConstructor<T, /* IsSmall = */ true>
+ struct CallConstructor<T, /* CanUseInternalSpace = */ true>
{
CallConstructor(const QVariantConstructor &tc)
{
@@ -310,11 +307,11 @@ class QVariantConstructor
};
template<typename T>
- struct CallConstructor<T, /* IsSmall = */ false>
+ struct CallConstructor<T, /* CanUseInternalSpace = */ false>
{
CallConstructor(const QVariantConstructor &tc)
{
- Q_STATIC_ASSERT(QTypeInfo<T>::isComplex);
+ Q_STATIC_ASSERT(QTypeInfo<T>::isComplex || sizeof(T) > sizeof(QVariant::Private::Data));
tc.m_x->data.shared = tc.m_copy ? new QVariantPrivateSharedEx<T>(*static_cast<const T*>(tc.m_copy))
: new QVariantPrivateSharedEx<T>;
tc.m_x->is_shared = true;
@@ -359,24 +356,8 @@ public:
m_x->is_shared = false;
return;
}
- // it is not a static known type, lets ask QMetaType if it can be constructed for us.
- const uint size = QMetaType::sizeOf(m_x->type);
-
- if (size && size <= sizeof(QVariant::Private::Data)) {
- void *ptr = QMetaType::construct(m_x->type, &m_x->data.ptr, m_copy);
- if (!ptr) {
- m_x->type = QVariant::Invalid;
- }
- m_x->is_shared = false;
- } else {
- void *ptr = QMetaType::create(m_x->type, m_copy);
- if (!ptr) {
- m_x->type = QVariant::Invalid;
- } else {
- m_x->is_shared = true;
- m_x->data.shared = new QVariant::PrivateShared(ptr);
- }
- }
+ qWarning("Trying to construct an instance of an invalid type, type id: %i", m_x->type);
+ m_x->type = QVariant::Invalid;
}
void delegate(const void*)
@@ -425,13 +406,9 @@ public:
void delegate(const QMetaTypeSwitcher::UnknownType*)
{
- // This is not a static type, so lets delegate everyting to QMetaType
- if (!m_d->is_shared) {
- QMetaType::destruct(m_d->type, &m_d->data.ptr);
- } else {
- QMetaType::destroy(m_d->type, m_d->data.shared->ptr);
- delete m_d->data.shared;
- }
+ if (m_d->type == QVariant::UserType)
+ return;
+ qWarning("Trying to destruct an instance of an invalid type, type id: %i", m_d->type);
}
// Ignore nonconstructible type
void delegate(const void*) {}
@@ -439,6 +416,59 @@ private:
QVariant::Private *m_d;
};
+namespace QVariantPrivate {
+Q_CORE_EXPORT void registerHandler(const int /* Modules::Names */ name, const QVariant::Handler *handler);
+Q_CORE_EXPORT void unregisterHandler(const int /* Modules::Names */ name);
+}
+
+#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
+template<class Filter>
+class QVariantDebugStream
+{
+ template<typename T, bool IsAcceptedType = Filter::template Acceptor<T>::IsAccepted>
+ struct Filtered {
+ Filtered(QDebug dbg, QVariant::Private *d)
+ {
+ dbg.nospace() << *v_cast<T>(d);
+ }
+ };
+ template<typename T>
+ struct Filtered<T, /* IsAcceptedType = */ false> {
+ Filtered(QDebug dbg, QVariant::Private *d)
+ {
+ dbg.nospace() << "QVariant::Type(" << d->type << ")";
+ }
+ };
+
+public:
+ QVariantDebugStream(QDebug dbg, QVariant::Private *d)
+ : m_debugStream(dbg)
+ , m_d(d)
+ {}
+
+ template<typename T>
+ void delegate(const T*)
+ {
+ Filtered<T> streamIt(m_debugStream, m_d);
+ }
+
+ void delegate(const QMetaTypeSwitcher::UnknownType*)
+ {
+ if (m_d->type == QVariant::UserType)
+ m_debugStream.nospace() << "QVariant::UserType";
+ else
+ qWarning("Trying to stream an instance of an invalid type, type id: %i", m_d->type);
+ }
+ void delegate(const void*)
+ {
+ m_debugStream.nospace() << "QVariant::Invalid";
+ }
+private:
+ QDebug m_debugStream;
+ QVariant::Private *m_d;
+};
+#endif
+
QT_END_NAMESPACE
#endif // QVARIANT_P_H
diff --git a/src/corelib/kernel/qwineventnotifier.cpp b/src/corelib/kernel/qwineventnotifier.cpp
index 1ef77cdf62..e06e1d5b0a 100644
--- a/src/corelib/kernel/qwineventnotifier.cpp
+++ b/src/corelib/kernel/qwineventnotifier.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/kernel/qwineventnotifier.h b/src/corelib/kernel/qwineventnotifier.h
index d265c8c181..386a640434 100644
--- a/src/corelib/kernel/qwineventnotifier.h
+++ b/src/corelib/kernel/qwineventnotifier.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/plugin/qelfparser_p.cpp b/src/corelib/plugin/qelfparser_p.cpp
index e3c6b30820..cfe9a9d1b5 100644
--- a/src/corelib/plugin/qelfparser_p.cpp
+++ b/src/corelib/plugin/qelfparser_p.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/plugin/qelfparser_p.h b/src/corelib/plugin/qelfparser_p.h
index 510ffed567..2f10807720 100644
--- a/src/corelib/plugin/qelfparser_p.h
+++ b/src/corelib/plugin/qelfparser_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/plugin/qfactoryinterface.h b/src/corelib/plugin/qfactoryinterface.h
index 647d97f173..b7e4f3de16 100644
--- a/src/corelib/plugin/qfactoryinterface.h
+++ b/src/corelib/plugin/qfactoryinterface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index 749a7deddd..9ae97c6313 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/plugin/qfactoryloader_p.h b/src/corelib/plugin/qfactoryloader_p.h
index 75d40f8c3f..be40e66efd 100644
--- a/src/corelib/plugin/qfactoryloader_p.h
+++ b/src/corelib/plugin/qfactoryloader_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index 6a40b5b818..f20abb660d 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -96,7 +96,7 @@ Q_GLOBAL_STATIC(QMutex, qt_library_mutex)
Unix), unless the file name has an absolute path. If the file
cannot be found, QLibrary tries the name with different
platform-specific file suffixes, like ".so" on Unix, ".dylib" on
- the Mac, or ".dll" on Windows and Symbian. This makes it possible
+ the Mac, or ".dll" on Windows. This makes it possible
to specify shared libraries that are only identified by their
basename (i.e. without their suffix), so the same code will work
on different operating systems.
@@ -118,11 +118,6 @@ Q_GLOBAL_STATIC(QMutex, qt_library_mutex)
linking", which is done by the link step in the build process when
linking an executable against a library.
- Note: In Symbian resolving symbols using their names is supported
- only if the library is built as STDDLL. Otherwise ordinals must
- be used. Also, in Symbian the path of the library is ignored and
- system default library location is always used.
-
The following code snippet loads a library, resolves the symbol
"mysymbol", and calls the function if everything succeeded. If
something goes wrong, e.g. the library file does not exist or the
@@ -287,7 +282,7 @@ static bool qt_parse_pattern(const char *s, uint *version, bool *debug)
}
#endif // QT_NO_PLUGIN_CHECK
-#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_SYMBIAN) && !defined(QT_NO_PLUGIN_CHECK)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(QT_NO_PLUGIN_CHECK)
static long qt_find_pattern(const char *s, ulong s_len,
const char *pattern, ulong p_len)
@@ -398,7 +393,7 @@ static bool qt_unix_query(const QString &library, uint *version, bool *debug, QL
return ret;
}
-#endif // Q_OS_UNIX && !Q_OS_MAC && !defined(Q_OS_SYMBIAN) && !defined(QT_NO_PLUGIN_CHECK)
+#endif // Q_OS_UNIX && !Q_OS_MAC && !defined(QT_NO_PLUGIN_CHECK)
static void installCoverageTool(QLibraryPrivate *libPrivate)
{
@@ -435,25 +430,6 @@ static void installCoverageTool(QLibraryPrivate *libPrivate)
#endif
}
-static void releaseCoverageTool(QLibraryPrivate *libPrivate)
-{
-#ifdef __COVERAGESCANNER__
- /*
- __COVERAGESCANNER__ is defined when Qt has been instrumented for code
- coverage by TestCocoon.
- Here is the code to save the execution data.
- See comments about initialization in QLibraryPrivate::load().
- */
- if (libPrivate->pHnd) {
- __coveragescanner_save();
- __coveragescanner_clear();
- __coveragescanner_unregister_library(libPrivate->fileName.toLocal8Bit());
- }
-#else
- Q_UNUSED(libPrivate);
-#endif
-}
-
typedef QMap<QString, QLibraryPrivate*> LibraryMap;
struct LibraryData {
@@ -550,8 +526,6 @@ bool QLibraryPrivate::unload()
void QLibraryPrivate::release()
{
- releaseCoverageTool(this);
-
QMutexLocker locker(qt_library_mutex());
if (!libraryRefCount.deref())
delete this;
@@ -567,14 +541,6 @@ bool QLibraryPrivate::loadPlugin()
return false;
if (load()) {
instance = (QtPluginInstanceFunction)resolve("qt_plugin_instance");
-#if defined(Q_OS_SYMBIAN)
- if (!instance) {
- // If resolving with function name failed (i.e. not STDDLL),
- // try resolving using known ordinal, which for
- // qt_plugin_instance function is always "2".
- instance = (QtPluginInstanceFunction)resolve("2");
- }
-#endif
return instance;
}
if (qt_debug_component())
@@ -594,7 +560,6 @@ bool QLibraryPrivate::loadPlugin()
\row \i AIX \i \c .a
\row \i HP-UX \i \c .sl, \c .so (HP-UXi)
\row \i Mac OS X \i \c .dylib, \c .bundle, \c .so
- \row \i Symbian \i \c .dll
\endtable
Trailing versioning numbers on Unix are ignored.
@@ -603,10 +568,6 @@ bool QLibrary::isLibrary(const QString &fileName)
{
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
return fileName.endsWith(QLatin1String(".dll"), Qt::CaseInsensitive);
-#elif defined(Q_OS_SYMBIAN)
- // Plugin stubs are also considered libraries in Symbian.
- return (fileName.endsWith(QLatin1String(".dll")) ||
- fileName.endsWith(QLatin1String(".qtplugin")));
#else
QString completeSuffix = QFileInfo(fileName).completeSuffix();
if (completeSuffix.isEmpty())
@@ -728,7 +689,7 @@ bool QLibraryPrivate::isPlugin()
}
#endif
-#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
if (!pHnd) {
// use unix shortcut to avoid loading the library
success = qt_unix_query(fileName, &qt_version, &debug, this);
@@ -749,11 +710,7 @@ bool QLibraryPrivate::isPlugin()
hTempModule = ::LoadLibraryEx((wchar_t*)QDir::toNativeSeparators(fileName).utf16(), 0, dwFlags);
SetErrorMode(oldmode);
#else
-# if defined(Q_OS_SYMBIAN)
- //Guard against accidentally trying to load non-plugin libraries by making sure the stub exists
- if (fileinfo.exists())
-# endif
- temporary_load = load_sys();
+ temporary_load = load_sys();
#endif
}
#ifdef Q_OS_WIN
@@ -766,16 +723,7 @@ bool QLibraryPrivate::isPlugin()
: (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data");
#else
QtPluginQueryVerificationDataFunction qtPluginQueryVerificationDataFunction = NULL;
-# if defined(Q_OS_SYMBIAN)
- if (temporary_load) {
- qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data");
- // If resolving with function name failed (i.e. not STDDLL), try resolving using known ordinal
- if (!qtPluginQueryVerificationDataFunction)
- qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("1");
- }
-# else
qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data");
-# endif
#endif
bool exceptionThrown = false;
bool ret = qt_get_verificationdata(qtPluginQueryVerificationDataFunction,
@@ -927,8 +875,6 @@ QLibrary::QLibrary(QObject *parent)
QLibrary will automatically look for the file with the appropriate
suffix in accordance with the platform, e.g. ".so" on Unix,
".dylib" on Mac OS X, and ".dll" on Windows. (See \l{fileName}.)
-
- Note: In Symbian the path portion of the \a fileName is ignored.
*/
QLibrary::QLibrary(const QString& fileName, QObject *parent)
:QObject(parent), d(0), did_load(false)
@@ -940,14 +886,12 @@ QLibrary::QLibrary(const QString& fileName, QObject *parent)
/*!
Constructs a library object with the given \a parent that will
load the library specified by \a fileName and major version number \a verNum.
- Currently, the version number is ignored on Windows and Symbian.
+ Currently, the version number is ignored on Windows.
We recommend omitting the file's suffix in \a fileName, since
QLibrary will automatically look for the file with the appropriate
suffix in accordance with the platform, e.g. ".so" on Unix,
".dylib" on Mac OS X, and ".dll" on Windows. (See \l{fileName}.)
-
- Note: In Symbian the path portion of the \a fileName is ignored.
*/
QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent)
:QObject(parent), d(0), did_load(false)
@@ -958,14 +902,12 @@ QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent)
/*!
Constructs a library object with the given \a parent that will
load the library specified by \a fileName and full version number \a version.
- Currently, the version number is ignored on Windows and Symbian.
+ Currently, the version number is ignored on Windows.
We recommend omitting the file's suffix in \a fileName, since
QLibrary will automatically look for the file with the appropriate
suffix in accordance with the platform, e.g. ".so" on Unix,
".dylib" on Mac OS X, and ".dll" on Windows. (See \l{fileName}.)
-
- Note: In Symbian the path portion of the \a fileName is ignored.
*/
QLibrary::QLibrary(const QString& fileName, const QString &version, QObject *parent)
:QObject(parent), d(0), did_load(false)
@@ -1007,8 +949,6 @@ QLibrary::~QLibrary()
platforms, fileName() will return "libGL.so". If the file name was
originally passed as "/usr/lib/libGL", fileName() will return
"/usr/lib/libGL.so".
-
- Note: In Symbian the path portion of the \a fileName is ignored.
*/
void QLibrary::setFileName(const QString &fileName)
@@ -1036,9 +976,7 @@ QString QLibrary::fileName() const
Sets the fileName property and major version number to \a fileName
and \a versionNumber respectively.
- The \a versionNumber is ignored on Windows and Symbian.
-
- Note: In Symbian the path portion of the \a fileName is ignored.
+ The \a versionNumber is ignored on Windows.
\sa setFileName()
*/
@@ -1060,9 +998,7 @@ void QLibrary::setFileNameAndVersion(const QString &fileName, int verNum)
Sets the fileName property and full version number to \a fileName
and \a version respectively.
- The \a version parameter is ignored on Windows and Symbian.
-
- Note: In Symbian the path portion of the \a fileName is ignored.
+ The \a version parameter is ignored on Windows.
\sa setFileName()
*/
@@ -1098,9 +1034,6 @@ void QLibrary::setFileNameAndVersion(const QString &fileName, const QString &ver
with \c MY_EXPORT defined as
\snippet doc/src/snippets/code/src_corelib_plugin_qlibrary.cpp 4
-
- Note: In Symbian resolving with symbol names works only if the loaded
- library was built as STDDLL. Otherwise, the ordinals must be used.
*/
QFunctionPointer QLibrary::resolve(const char *symbol)
{
@@ -1120,9 +1053,6 @@ QFunctionPointer QLibrary::resolve(const char *symbol)
The function returns 0 if the symbol could not be resolved or if
the library could not be loaded.
- Note: In Symbian resolving with symbol names works only if the loaded
- library was built as STDDLL. Otherwise, the ordinals must be used.
-
\sa resolve()
*/
QFunctionPointer QLibrary::resolve(const QString &fileName, const char *symbol)
@@ -1143,9 +1073,6 @@ QFunctionPointer QLibrary::resolve(const QString &fileName, const char *symbol)
The function returns 0 if the symbol could not be resolved or if
the library could not be loaded.
- Note: In Symbian resolving with symbol names works only if the loaded
- library was built as STDDLL. Otherwise, the ordinals must be used.
-
\sa resolve()
*/
QFunctionPointer QLibrary::resolve(const QString &fileName, int verNum, const char *symbol)
@@ -1167,9 +1094,6 @@ QFunctionPointer QLibrary::resolve(const QString &fileName, int verNum, const ch
The function returns 0 if the symbol could not be resolved or if
the library could not be loaded.
- Note: In Symbian resolving with symbol names works only if the loaded
- library was built as STDDLL. Otherwise, the ordinals must be used.
-
\sa resolve()
*/
QFunctionPointer QLibrary::resolve(const QString &fileName, const QString &version, const char *symbol)
diff --git a/src/corelib/plugin/qlibrary.h b/src/corelib/plugin/qlibrary.h
index e3f557dd7d..729277e838 100644
--- a/src/corelib/plugin/qlibrary.h
+++ b/src/corelib/plugin/qlibrary.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/plugin/qlibrary_p.h b/src/corelib/plugin/qlibrary_p.h
index 15825c699f..45c8843d20 100644
--- a/src/corelib/plugin/qlibrary_p.h
+++ b/src/corelib/plugin/qlibrary_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp
index d3b08e1acf..ce6d645ca4 100644
--- a/src/corelib/plugin/qlibrary_unix.cpp
+++ b/src/corelib/plugin/qlibrary_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp
index 4eeb2fc441..fd46a7107e 100644
--- a/src/corelib/plugin/qlibrary_win.cpp
+++ b/src/corelib/plugin/qlibrary_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h
index 52661671b5..c9388c1337 100644
--- a/src/corelib/plugin/qplugin.h
+++ b/src/corelib/plugin/qplugin.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/plugin/qplugin.qdoc b/src/corelib/plugin/qplugin.qdoc
index 1c24de3254..2149fa7179 100644
--- a/src/corelib/plugin/qplugin.qdoc
+++ b/src/corelib/plugin/qplugin.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index 591e36e20a..1557df2eef 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -48,11 +48,6 @@
#include "qdebug.h"
#include "qdir.h"
-#if defined(Q_OS_SYMBIAN)
-# include <f32file.h>
-# include "private/qcore_symbian_p.h"
-#endif
-
#ifndef QT_NO_LIBRARY
QT_BEGIN_NAMESPACE
@@ -106,16 +101,6 @@ QT_BEGIN_NAMESPACE
link to plugins statically. You can use QLibrary if you need to
load dynamic libraries in a statically linked application.
- \note In Symbian the plugin stub files must be used whenever a
- path to plugin is needed. For the purposes of loading plugins,
- the stubs can be considered to have the same name as the actual
- plugin binary. In practice they have ".qtplugin" extension
- instead of ".dll", but this difference is handled transparently
- by QPluginLoader and QLibrary to avoid need for Symbian specific
- plugin handling in most Qt applications. Plugin stubs are needed
- because Symbian Platform Security denies all access to the directory
- where the actual plugin binaries are located.
-
\sa QLibrary, {Plug & Paint Example}
*/
@@ -136,8 +121,6 @@ QPluginLoader::QPluginLoader(QObject *parent)
Unix, - \c .dylib on Mac OS X, and \c .dll on Windows. The suffix
can be verified with QLibrary::isLibrary().
- Note: In Symbian the \a fileName must point to plugin stub file.
-
\sa setFileName()
*/
QPluginLoader::QPluginLoader(const QString &fileName, QObject *parent)
@@ -263,8 +246,6 @@ bool QPluginLoader::isLoaded() const
By default, this property contains an empty string.
- Note: In Symbian the \a fileName must point to plugin stub file.
-
\sa load()
*/
void QPluginLoader::setFileName(const QString &fileName)
@@ -278,48 +259,7 @@ void QPluginLoader::setFileName(const QString &fileName)
did_load = false;
}
-#if defined(Q_OS_SYMBIAN)
- // In Symbian we actually look for plugin stub, so modify the filename
- // to make canonicalFilePath find the file, if .dll is specified.
- QFileInfo fi(fileName);
-
- if (fi.suffix() == QLatin1String("dll")) {
- QString stubName = fileName;
- stubName.chop(3);
- stubName += QLatin1String("qtplugin");
- fi = QFileInfo(stubName);
- }
-
- QString fn = fi.canonicalFilePath();
- // If not found directly, check also all the available drives
- if (!fn.length()) {
- QString stubPath(fi.fileName().length() ? fi.absoluteFilePath() : QString());
- if (stubPath.length() > 1) {
- if (stubPath.at(1).toAscii() == ':')
- stubPath.remove(0,2);
- QFileInfoList driveList(QDir::drives());
- RFs rfs = qt_s60GetRFs();
- foreach(const QFileInfo& drive, driveList) {
- QString testFilePath(drive.absolutePath() + stubPath);
- testFilePath = QDir::cleanPath(testFilePath);
- // Use native Symbian code to check for file existence, because checking
- // for file from under non-existent protected dir like E:/private/<uid> using
- // QFile::exists causes platform security violations on most apps.
- QString nativePath = QDir::toNativeSeparators(testFilePath);
- TPtrC ptr(qt_QString2TPtrC(nativePath));
- TUint attributes;
- TInt err = rfs.Att(ptr, attributes);
- if (err == KErrNone) {
- fn = testFilePath;
- break;
- }
- }
- }
- }
-
-#else
QString fn = QFileInfo(fileName).canonicalFilePath();
-#endif
d = QLibraryPrivate::findOrCreate(fn);
d->loadHints = lh;
diff --git a/src/corelib/plugin/qpluginloader.h b/src/corelib/plugin/qpluginloader.h
index b8f40379c8..0854d3dcdf 100644
--- a/src/corelib/plugin/qpluginloader.h
+++ b/src/corelib/plugin/qpluginloader.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/plugin/qsystemlibrary.cpp b/src/corelib/plugin/qsystemlibrary.cpp
index bb9c82a35a..f949cc0f86 100644
--- a/src/corelib/plugin/qsystemlibrary.cpp
+++ b/src/corelib/plugin/qsystemlibrary.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/plugin/qsystemlibrary_p.h b/src/corelib/plugin/qsystemlibrary_p.h
index 3298f05b8f..4015fb6958 100644
--- a/src/corelib/plugin/qsystemlibrary_p.h
+++ b/src/corelib/plugin/qsystemlibrary_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp
index 6fca1b6709..e73508fce6 100644
--- a/src/corelib/plugin/quuid.cpp
+++ b/src/corelib/plugin/quuid.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -43,6 +43,7 @@
#include "qdatastream.h"
#include "qendian.h"
+#include "qdebug.h"
QT_BEGIN_NAMESPACE
@@ -132,6 +133,29 @@ bool _q_uuidFromHex(const Char *&src, uint &d1, ushort &d2, ushort &d3, uchar (&
}
#endif
+static QUuid createFromName(const QUuid &ns, const QByteArray &baseData, QCryptographicHash::Algorithm algorithm, int version)
+{
+ QByteArray hashResult;
+
+ // create a scope so later resize won't reallocate
+ {
+ QCryptographicHash hash(algorithm);
+ hash.addData(ns.toRfc4122());
+ hash.addData(baseData);
+ hashResult = hash.result();
+ }
+ hashResult.resize(16); // Sha1 will be too long
+
+ QUuid result = QUuid::fromRfc4122(hashResult);
+
+ result.data3 &= 0x0FFF;
+ result.data3 |= (version << 12);
+ result.data4[0] &= 0x3F;
+ result.data4[0] |= 0x80;
+
+ return result;
+}
+
/*!
\class QUuid
\brief The QUuid class stores a Universally Unique Identifier (UUID).
@@ -230,7 +254,7 @@ bool _q_uuidFromHex(const Char *&src, uint &d1, ushort &d2, ushort &d3, uchar (&
\o 0
\o 1
\o 1
- \o Name
+ \o Md5(Name)
\row
\o 0
@@ -239,6 +263,13 @@ bool _q_uuidFromHex(const Char *&src, uint &d1, ushort &d2, ushort &d3, uchar (&
\o 0
\o Random
+ \row
+ \o 0
+ \o 1
+ \o 0
+ \o 1
+ \o Sha1
+
\endtable
The field layouts for the DCE versions listed in the table above
@@ -384,9 +415,40 @@ QUuid::QUuid(const QByteArray &text)
return;
}
}
+
#endif
/*!
+ \since 5.0
+ \fn QUuid::createUuidV3()
+
+ This functions returns a new UUID with variant QUuid::DCE and version QUuid::MD5.
+ \a ns is the namespace and \a name is the name as described by RFC 4122.
+
+ \sa variant(), version(), createUuidV5()
+*/
+
+/*!
+ \since 5.0
+ \fn QUuid::createUuidV5()
+
+ This functions returns a new UUID with variant QUuid::DCE and version QUuid::SHA1.
+ \a ns is the namespace and \a name is the name as described by RFC 4122.
+
+ \sa variant(), version(), createUuidV3()
+*/
+
+QUuid QUuid::createUuidV3(const QUuid &ns, const QByteArray &baseData)
+{
+ return createFromName(ns, baseData, QCryptographicHash::Md5, 3);
+}
+
+QUuid QUuid::createUuidV5(const QUuid &ns, const QByteArray &baseData)
+{
+ return createFromName(ns, baseData, QCryptographicHash::Sha1, 5);
+}
+
+/*!
Creates a QUuid object from the binary representation of the UUID, as
specified by RFC 4122 section 4.1.2. See toRfc4122() for a further
explanation of the order of bytes required.
@@ -440,15 +502,6 @@ QUuid QUuid::fromRfc4122(const QByteArray &bytes)
*/
#ifndef QT_NO_QUUID_STRING
/*!
- \fn QUuid::operator QString() const
- \obsolete
-
- Returns the string representation of the uuid.
-
- \sa toString()
-*/
-
-/*!
Returns the string representation of this QUuid. The string is
formatted as five hex fields separated by '-' and enclosed in
curly braces, i.e., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where
@@ -739,7 +792,7 @@ QUuid::Version QUuid::version() const
if (isNull()
|| (variant() != DCE)
|| ver < Time
- || ver > Random)
+ || ver > Sha1)
return VerUnknown;
return ver;
}
@@ -927,6 +980,14 @@ QUuid QUuid::createUuid()
guid; otherwise returns false.
*/
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QUuid &id)
+{
+ dbg.nospace() << "QUuid(" << id.toString() << ')';
+ return dbg.space();
+}
+#endif
+
/**
Returns a hash of the QUuid
*/
diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h
index b941079df0..9efb2ba37c 100644
--- a/src/corelib/plugin/quuid.h
+++ b/src/corelib/plugin/quuid.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -43,6 +43,7 @@
#define QUUID_H
#include <QtCore/qstring.h>
+#include <QtCore/qcryptographichash.h>
QT_BEGIN_HEADER
@@ -64,8 +65,9 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
-struct Q_CORE_EXPORT QUuid
+class Q_CORE_EXPORT QUuid
{
+public:
enum Variant {
VarUnknown =-1,
NCS = 0, // 0 - -
@@ -78,8 +80,10 @@ struct Q_CORE_EXPORT QUuid
VerUnknown =-1,
Time = 1, // 0 0 0 1
EmbeddedPOSIX = 2, // 0 0 1 0
- Name = 3, // 0 0 1 1
- Random = 4 // 0 1 0 0
+ Md5 = 3, // 0 0 1 1
+ Name = Md5,
+ Random = 4, // 0 1 0 0
+ Sha1 = 5 // 0 1 0 1
};
QUuid()
@@ -108,9 +112,6 @@ struct Q_CORE_EXPORT QUuid
QUuid(const QString &);
QUuid(const char *);
QString toString() const;
-#if QT_DEPRECATED_SINCE(5,0)
- QT_DEPRECATED operator QString() const { return toString(); }
-#endif
QUuid(const QByteArray &);
QByteArray toByteArray() const;
#endif
@@ -175,6 +176,21 @@ struct Q_CORE_EXPORT QUuid
}
#endif
static QUuid createUuid();
+ static QUuid createUuidV3(const QUuid &ns, const QByteArray &baseData);
+ static QUuid createUuidV5(const QUuid &ns, const QByteArray &baseData);
+#ifndef QT_NO_QUUID_STRING
+ static inline QUuid createUuidV3(const QUuid &ns, const QString &baseData)
+ {
+ return QUuid::createUuidV3(ns, baseData.toUtf8());
+ }
+
+ static inline QUuid createUuidV5(const QUuid &ns, const QString &baseData)
+ {
+ return QUuid::createUuidV5(ns, baseData.toUtf8());
+ }
+
+#endif
+
QUuid::Variant variant() const;
QUuid::Version version() const;
@@ -184,11 +200,17 @@ struct Q_CORE_EXPORT QUuid
uchar data4[8];
};
+Q_DECLARE_TYPEINFO(QUuid, Q_MOVABLE_TYPE);
+
#ifndef QT_NO_DATASTREAM
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QUuid &);
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QUuid &);
#endif
+#ifndef QT_NO_DEBUG_STREAM
+Q_CORE_EXPORT QDebug operator<<(QDebug, const QUuid &);
+#endif
+
Q_CORE_EXPORT uint qHash(const QUuid &uuid);
QT_END_NAMESPACE
diff --git a/src/corelib/statemachine/qabstractstate.cpp b/src/corelib/statemachine/qabstractstate.cpp
index 79b72ea538..c2d24e3c00 100644
--- a/src/corelib/statemachine/qabstractstate.cpp
+++ b/src/corelib/statemachine/qabstractstate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qabstractstate.h b/src/corelib/statemachine/qabstractstate.h
index 21169e4fee..33dbde23aa 100644
--- a/src/corelib/statemachine/qabstractstate.h
+++ b/src/corelib/statemachine/qabstractstate.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qabstractstate_p.h b/src/corelib/statemachine/qabstractstate_p.h
index 98b1d0a9b4..cf86e0cbe9 100644
--- a/src/corelib/statemachine/qabstractstate_p.h
+++ b/src/corelib/statemachine/qabstractstate_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
index ff2b4b5978..a8fdea2cfc 100644
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ b/src/corelib/statemachine/qabstracttransition.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h
index dbe7f3aa38..fd1eedb72e 100644
--- a/src/corelib/statemachine/qabstracttransition.h
+++ b/src/corelib/statemachine/qabstracttransition.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qabstracttransition_p.h b/src/corelib/statemachine/qabstracttransition_p.h
index 57f962d77d..4de0f4b8d6 100644
--- a/src/corelib/statemachine/qabstracttransition_p.h
+++ b/src/corelib/statemachine/qabstracttransition_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qeventtransition.cpp b/src/corelib/statemachine/qeventtransition.cpp
index 63f89669b9..f55cdbc927 100644
--- a/src/corelib/statemachine/qeventtransition.cpp
+++ b/src/corelib/statemachine/qeventtransition.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qeventtransition.h b/src/corelib/statemachine/qeventtransition.h
index 434b72e76c..173d24ef4a 100644
--- a/src/corelib/statemachine/qeventtransition.h
+++ b/src/corelib/statemachine/qeventtransition.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qeventtransition_p.h b/src/corelib/statemachine/qeventtransition_p.h
index ed096df81d..6c3dc9dda4 100644
--- a/src/corelib/statemachine/qeventtransition_p.h
+++ b/src/corelib/statemachine/qeventtransition_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qfinalstate.cpp b/src/corelib/statemachine/qfinalstate.cpp
index c583c32183..c2bb2ee218 100644
--- a/src/corelib/statemachine/qfinalstate.cpp
+++ b/src/corelib/statemachine/qfinalstate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qfinalstate.h b/src/corelib/statemachine/qfinalstate.h
index 9a18888c84..652abd6600 100644
--- a/src/corelib/statemachine/qfinalstate.h
+++ b/src/corelib/statemachine/qfinalstate.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qhistorystate.cpp b/src/corelib/statemachine/qhistorystate.cpp
index 5f3a5dcf4c..b45cd30935 100644
--- a/src/corelib/statemachine/qhistorystate.cpp
+++ b/src/corelib/statemachine/qhistorystate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qhistorystate.h b/src/corelib/statemachine/qhistorystate.h
index 1ba28e97f1..e9ec058d53 100644
--- a/src/corelib/statemachine/qhistorystate.h
+++ b/src/corelib/statemachine/qhistorystate.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qhistorystate_p.h b/src/corelib/statemachine/qhistorystate_p.h
index b915c2820c..35662d88f8 100644
--- a/src/corelib/statemachine/qhistorystate_p.h
+++ b/src/corelib/statemachine/qhistorystate_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qsignaleventgenerator_p.h b/src/corelib/statemachine/qsignaleventgenerator_p.h
index c38177b766..e681add086 100644
--- a/src/corelib/statemachine/qsignaleventgenerator_p.h
+++ b/src/corelib/statemachine/qsignaleventgenerator_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp
index 92862cbab6..51a8a82b2d 100644
--- a/src/corelib/statemachine/qsignaltransition.cpp
+++ b/src/corelib/statemachine/qsignaltransition.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h
index 155e0f3d9d..fd91dd4c6d 100644
--- a/src/corelib/statemachine/qsignaltransition.h
+++ b/src/corelib/statemachine/qsignaltransition.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qsignaltransition_p.h b/src/corelib/statemachine/qsignaltransition_p.h
index 8bf928804b..aadb4efcc7 100644
--- a/src/corelib/statemachine/qsignaltransition_p.h
+++ b/src/corelib/statemachine/qsignaltransition_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index 7dc9889dc0..4f37bb0642 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h
index 4d3acc1341..337659295e 100644
--- a/src/corelib/statemachine/qstate.h
+++ b/src/corelib/statemachine/qstate.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qstate_p.h b/src/corelib/statemachine/qstate_p.h
index 74b425361b..daa2f467c1 100644
--- a/src/corelib/statemachine/qstate_p.h
+++ b/src/corelib/statemachine/qstate_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index 927389a33b..a24c71c105 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h
index 1238f480f4..b2a251038d 100644
--- a/src/corelib/statemachine/qstatemachine.h
+++ b/src/corelib/statemachine/qstatemachine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h
index 3227f81e58..88b16a22bf 100644
--- a/src/corelib/statemachine/qstatemachine_p.h
+++ b/src/corelib/statemachine/qstatemachine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qatomic.cpp b/src/corelib/thread/qatomic.cpp
index 3cdb3c6d7b..c2c9484cf6 100644
--- a/src/corelib/thread/qatomic.cpp
+++ b/src/corelib/thread/qatomic.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qatomic.h b/src/corelib/thread/qatomic.h
index eff2182e28..07350ecfcd 100644
--- a/src/corelib/thread/qatomic.h
+++ b/src/corelib/thread/qatomic.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -44,7 +44,7 @@
#ifndef QATOMIC_H
#define QATOMIC_H
-#include <QtCore/qbasicatomic.h>
+#include <QtCore/qoldbasicatomic.h>
QT_BEGIN_HEADER
diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp
index df36120d88..6c8ed3b897 100644
--- a/src/corelib/thread/qmutex.cpp
+++ b/src/corelib/thread/qmutex.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h
index 086a289569..1d7e591b7d 100644
--- a/src/corelib/thread/qmutex.h
+++ b/src/corelib/thread/qmutex.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qmutex_linux.cpp b/src/corelib/thread/qmutex_linux.cpp
index 18ddd23819..9bb9c9061e 100644
--- a/src/corelib/thread/qmutex_linux.cpp
+++ b/src/corelib/thread/qmutex_linux.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qmutex_mac.cpp b/src/corelib/thread/qmutex_mac.cpp
index 2fdb2ec489..1a561aa5d5 100644
--- a/src/corelib/thread/qmutex_mac.cpp
+++ b/src/corelib/thread/qmutex_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qmutex_p.h b/src/corelib/thread/qmutex_p.h
index e385181e0f..0cbc99adc6 100644
--- a/src/corelib/thread/qmutex_p.h
+++ b/src/corelib/thread/qmutex_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qmutex_unix.cpp b/src/corelib/thread/qmutex_unix.cpp
index b693088015..a426d958f2 100644
--- a/src/corelib/thread/qmutex_unix.cpp
+++ b/src/corelib/thread/qmutex_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qmutex_win.cpp b/src/corelib/thread/qmutex_win.cpp
index 781a632a61..b513b6e1ad 100644
--- a/src/corelib/thread/qmutex_win.cpp
+++ b/src/corelib/thread/qmutex_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qmutexpool.cpp b/src/corelib/thread/qmutexpool.cpp
index ef4e9560fb..6be5e092d7 100644
--- a/src/corelib/thread/qmutexpool.cpp
+++ b/src/corelib/thread/qmutexpool.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qmutexpool_p.h b/src/corelib/thread/qmutexpool_p.h
index 20449c24d4..90b89f9a17 100644
--- a/src/corelib/thread/qmutexpool_p.h
+++ b/src/corelib/thread/qmutexpool_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qoldbasicatomic.h
index d3e988d8c5..2f952c9e0a 100644
--- a/src/corelib/thread/qbasicatomic.h
+++ b/src/corelib/thread/qoldbasicatomic.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qorderedmutexlocker_p.h b/src/corelib/thread/qorderedmutexlocker_p.h
index e65a601369..14a29c7edf 100644
--- a/src/corelib/thread/qorderedmutexlocker_p.h
+++ b/src/corelib/thread/qorderedmutexlocker_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qreadwritelock.cpp b/src/corelib/thread/qreadwritelock.cpp
index f552e6f6d6..54926111d5 100644
--- a/src/corelib/thread/qreadwritelock.cpp
+++ b/src/corelib/thread/qreadwritelock.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -107,19 +107,12 @@ QT_BEGIN_NAMESPACE
*/
/*!
- Constructs a QReadWriteLock object in NonRecursive mode.
-
- \sa lockForRead(), lockForWrite()
-*/
-QReadWriteLock::QReadWriteLock()
- :d(new QReadWriteLockPrivate(NonRecursive))
-{ }
-
-/*!
\since 4.4
Constructs a QReadWriteLock object in the given \a recursionMode.
+ The default recursion mode is NonRecursive.
+
\sa lockForRead(), lockForWrite(), RecursionMode
*/
QReadWriteLock::QReadWriteLock(RecursionMode recursionMode)
@@ -513,7 +506,7 @@ void QReadWriteLock::unlock()
\ingroup thread
- The purpose of QWriteLocker (and QReadLocker is to simplify
+ The purpose of QWriteLocker (and QReadLocker) is to simplify
QReadWriteLock locking and unlocking. Locking and unlocking
statements or in exception handling code is error-prone and
difficult to debug. QWriteLocker can be used in such situations
diff --git a/src/corelib/thread/qreadwritelock.h b/src/corelib/thread/qreadwritelock.h
index 7bb6329522..cdbd7894a1 100644
--- a/src/corelib/thread/qreadwritelock.h
+++ b/src/corelib/thread/qreadwritelock.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -60,8 +60,7 @@ class Q_CORE_EXPORT QReadWriteLock
public:
enum RecursionMode { NonRecursive, Recursive };
- QReadWriteLock(); // ### Qt 5: merge with below
- QReadWriteLock(RecursionMode recursionMode);
+ explicit QReadWriteLock(RecursionMode recursionMode = NonRecursive);
~QReadWriteLock();
void lockForRead();
diff --git a/src/corelib/thread/qreadwritelock_p.h b/src/corelib/thread/qreadwritelock_p.h
index fda7bf44e6..125245bb4a 100644
--- a/src/corelib/thread/qreadwritelock_p.h
+++ b/src/corelib/thread/qreadwritelock_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp
index acfd478a14..12539a794d 100644
--- a/src/corelib/thread/qsemaphore.cpp
+++ b/src/corelib/thread/qsemaphore.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qsemaphore.h b/src/corelib/thread/qsemaphore.h
index 50d32c5f65..4790a84bb6 100644
--- a/src/corelib/thread/qsemaphore.h
+++ b/src/corelib/thread/qsemaphore.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 1df768c1ed..9d48c4dbe5 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h
index baad793969..597e29546a 100644
--- a/src/corelib/thread/qthread.h
+++ b/src/corelib/thread/qthread.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h
index bbaf664a2d..094c9b0daf 100644
--- a/src/corelib/thread/qthread_p.h
+++ b/src/corelib/thread/qthread_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -81,6 +81,8 @@ public:
: receiver(r), event(e), priority(p)
{ }
};
+Q_DECLARE_TYPEINFO(QPostEvent, Q_MOVABLE_TYPE);
+
inline bool operator<(int priority, const QPostEvent &pe)
{
return pe.priority < priority;
@@ -92,7 +94,7 @@ inline bool operator<(const QPostEvent &pe, int priority)
// This class holds the list of posted events.
// The list has to be kept sorted by priority
-class QPostEventList : public QList<QPostEvent>
+class QPostEventList : public QVector<QPostEvent>
{
public:
// recursion == recursion count for sendPostedEvents()
@@ -106,12 +108,14 @@ public:
QMutex mutex;
inline QPostEventList()
- : QList<QPostEvent>(), recursion(0), startOffset(0), insertionOffset(0)
+ : QVector<QPostEvent>(), recursion(0), startOffset(0), insertionOffset(0)
{ }
void addEvent(const QPostEvent &ev) {
int priority = ev.priority;
- if (isEmpty() || last().priority >= priority) {
+ if (isEmpty() ||
+ last().priority >= priority ||
+ begin() + insertionOffset >= end()) {
// optimization: we can simply append if the last event in
// the queue has higher or equal priority
append(ev);
@@ -125,8 +129,8 @@ public:
}
private:
//hides because they do not keep that list sorted. addEvent must be used
- using QList<QPostEvent>::append;
- using QList<QPostEvent>::insert;
+ using QVector<QPostEvent>::append;
+ using QVector<QPostEvent>::insert;
};
#ifndef QT_NO_THREAD
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index 6deae261c6..672b7cb976 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index 0c834cfff2..3184b18471 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qthreadstorage.cpp b/src/corelib/thread/qthreadstorage.cpp
index 0913292852..6dba8d670e 100644
--- a/src/corelib/thread/qthreadstorage.cpp
+++ b/src/corelib/thread/qthreadstorage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qthreadstorage.h b/src/corelib/thread/qthreadstorage.h
index 172dff0b3d..790f9a51ef 100644
--- a/src/corelib/thread/qthreadstorage.h
+++ b/src/corelib/thread/qthreadstorage.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qwaitcondition.h b/src/corelib/thread/qwaitcondition.h
index 0a96689f0b..7d4eb684ee 100644
--- a/src/corelib/thread/qwaitcondition.h
+++ b/src/corelib/thread/qwaitcondition.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qwaitcondition.qdoc b/src/corelib/thread/qwaitcondition.qdoc
index 00d4b0ff00..f079e5a6ba 100644
--- a/src/corelib/thread/qwaitcondition.qdoc
+++ b/src/corelib/thread/qwaitcondition.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qwaitcondition_unix.cpp b/src/corelib/thread/qwaitcondition_unix.cpp
index dd85bf4023..91aea010d9 100644
--- a/src/corelib/thread/qwaitcondition_unix.cpp
+++ b/src/corelib/thread/qwaitcondition_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/qwaitcondition_win.cpp b/src/corelib/thread/qwaitcondition_win.cpp
index bf1ec5e5ba..0106dbf13a 100644
--- a/src/corelib/thread/qwaitcondition_win.cpp
+++ b/src/corelib/thread/qwaitcondition_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/thread/thread.pri b/src/corelib/thread/thread.pri
index d63bb914e1..974e086684 100644
--- a/src/corelib/thread/thread.pri
+++ b/src/corelib/thread/thread.pri
@@ -7,7 +7,8 @@ HEADERS += thread/qmutex.h \
thread/qthread.h \
thread/qthreadstorage.h \
thread/qwaitcondition.h \
- thread/qatomic.h
+ thread/qatomic.h \
+ thread/qoldbasicatomic.h
# private headers
HEADERS += thread/qmutex_p.h \
@@ -40,3 +41,4 @@ unix: {
else:linux-* { SOURCES += thread/qmutex_linux.cpp }
else { SOURCES += thread/qmutex_unix.cpp }
}
+
diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h
index 90a9caa905..a1c656934d 100644
--- a/src/corelib/tools/qalgorithms.h
+++ b/src/corelib/tools/qalgorithms.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc
index b11f4092a8..3ba86b6838 100644
--- a/src/corelib/tools/qalgorithms.qdoc
+++ b/src/corelib/tools/qalgorithms.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp
index 5538180b37..96811cc179 100644
--- a/src/corelib/tools/qbitarray.cpp
+++ b/src/corelib/tools/qbitarray.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -725,6 +725,24 @@ QDataStream &operator>>(QDataStream &in, QBitArray &ba)
}
#endif // QT_NO_DATASTREAM
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QBitArray &array)
+{
+ dbg.nospace() << "QBitArray(";
+ for (int i = 0; i < array.size();) {
+ if (array.testBit(i))
+ dbg.nospace() << '1';
+ else
+ dbg.nospace() << '0';
+ i += 1;
+ if (!(i % 4) && (i < array.size()))
+ dbg.nospace() << ' ';
+ }
+ dbg.nospace() << ')';
+ return dbg.space();
+}
+#endif
+
/*!
\fn DataPtr &QBitArray::data_ptr()
\internal
diff --git a/src/corelib/tools/qbitarray.h b/src/corelib/tools/qbitarray.h
index 3b66b9f4df..83c81eca90 100644
--- a/src/corelib/tools/qbitarray.h
+++ b/src/corelib/tools/qbitarray.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -170,6 +170,10 @@ Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QBitArray &);
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QBitArray &);
#endif
+#ifndef QT_NO_DEBUG_STREAM
+Q_CORE_EXPORT QDebug operator<<(QDebug, const QBitArray &);
+#endif
+
Q_DECLARE_TYPEINFO(QBitArray, Q_MOVABLE_TYPE);
Q_DECLARE_SHARED(QBitArray)
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index e56e4fc8ff..47bf5da619 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -546,7 +546,7 @@ QByteArray qUncompress(const uchar* data, int nbytes)
qWarning("qUncompress: Input data is corrupted");
return QByteArray();
}
- QByteArray::Data *p = static_cast<QByteArray::Data *>(qRealloc(d.data(), sizeof(QByteArray::Data) + alloc + 1));
+ QByteArray::Data *p = static_cast<QByteArray::Data *>(::realloc(d.data(), sizeof(QByteArray::Data) + alloc + 1));
if (!p) {
// we are not allowed to crash here when compiling with QT_NO_EXCEPTIONS
qWarning("qUncompress: could not allocate enough memory to uncompress data");
@@ -567,7 +567,7 @@ QByteArray qUncompress(const uchar* data, int nbytes)
qWarning("qUncompress: Input data is corrupted");
return QByteArray();
}
- QByteArray::Data *p = static_cast<QByteArray::Data *>(qRealloc(d.data(), sizeof(QByteArray::Data) + len + 1));
+ QByteArray::Data *p = static_cast<QByteArray::Data *>(::realloc(d.data(), sizeof(QByteArray::Data) + len + 1));
if (!p) {
// we are not allowed to crash here when compiling with QT_NO_EXCEPTIONS
qWarning("qUncompress: could not allocate enough memory to uncompress data");
@@ -883,7 +883,7 @@ QByteArray &QByteArray::operator=(const QByteArray & other)
{
other.d->ref.ref();
if (!d->ref.deref())
- qFree(d);
+ free(d);
d = other.d;
return *this;
}
@@ -912,7 +912,7 @@ QByteArray &QByteArray::operator=(const char *str)
}
x->ref.ref();
if (!d->ref.deref())
- qFree(d);
+ free(d);
d = x;
return *this;
}
@@ -1302,7 +1302,7 @@ QByteArray::QByteArray(const char *str)
d = const_cast<Data *>(&shared_empty.ba);
} else {
int len = qstrlen(str);
- d = static_cast<Data *>(qMalloc(sizeof(Data) + len + 1));
+ d = static_cast<Data *>(malloc(sizeof(Data) + len + 1));
Q_CHECK_PTR(d);
d->ref.initializeOwned();
d->size = len;
@@ -1331,7 +1331,7 @@ QByteArray::QByteArray(const char *data, int size)
} else if (size <= 0) {
d = const_cast<Data *>(&shared_empty.ba);
} else {
- d = static_cast<Data *>(qMalloc(sizeof(Data) + size + 1));
+ d = static_cast<Data *>(malloc(sizeof(Data) + size + 1));
Q_CHECK_PTR(d);
d->ref.initializeOwned();
d->size = size;
@@ -1355,7 +1355,7 @@ QByteArray::QByteArray(int size, char ch)
if (size <= 0) {
d = const_cast<Data *>(&shared_null.ba);
} else {
- d = static_cast<Data *>(qMalloc(sizeof(Data) + size + 1));
+ d = static_cast<Data *>(malloc(sizeof(Data) + size + 1));
Q_CHECK_PTR(d);
d->ref.initializeOwned();
d->size = size;
@@ -1375,7 +1375,7 @@ QByteArray::QByteArray(int size, char ch)
QByteArray::QByteArray(int size, Qt::Initialization)
{
- d = static_cast<Data *>(qMalloc(sizeof(Data) + size + 1));
+ d = static_cast<Data *>(malloc(sizeof(Data) + size + 1));
Q_CHECK_PTR(d);
d->ref.initializeOwned();
d->size = size;
@@ -1411,7 +1411,7 @@ void QByteArray::resize(int size)
if (size == 0 && !d->capacityReserved) {
Data *x = const_cast<Data *>(&shared_empty.ba);
if (!d->ref.deref())
- qFree(d);
+ free(d);
d = x;
} else if (d == &shared_null.ba || d == &shared_empty.ba) {
//
@@ -1422,7 +1422,7 @@ void QByteArray::resize(int size)
// which is used in place of the Qt 3 idiom:
// QByteArray a(sz);
//
- Data *x = static_cast<Data *>(qMalloc(sizeof(Data) + size + 1));
+ Data *x = static_cast<Data *>(malloc(sizeof(Data) + size + 1));
Q_CHECK_PTR(x);
x->ref.initializeOwned();
x->size = size;
@@ -1464,7 +1464,7 @@ QByteArray &QByteArray::fill(char ch, int size)
void QByteArray::realloc(int alloc)
{
if (d->ref != 1 || d->offset) {
- Data *x = static_cast<Data *>(qMalloc(sizeof(Data) + alloc + 1));
+ Data *x = static_cast<Data *>(malloc(sizeof(Data) + alloc + 1));
Q_CHECK_PTR(x);
x->ref.initializeOwned();
x->size = qMin(alloc, d->size);
@@ -1474,10 +1474,10 @@ void QByteArray::realloc(int alloc)
::memcpy(x->data(), d->data(), x->size);
x->data()[x->size] = '\0';
if (!d->ref.deref())
- qFree(d);
+ free(d);
d = x;
} else {
- Data *x = static_cast<Data *>(qRealloc(d, sizeof(Data) + alloc + 1));
+ Data *x = static_cast<Data *>(::realloc(d, sizeof(Data) + alloc + 1));
Q_CHECK_PTR(x);
x->alloc = alloc;
x->offset = 0;
@@ -2730,7 +2730,7 @@ QByteArray QByteArray::toUpper() const
void QByteArray::clear()
{
if (!d->ref.deref())
- qFree(d);
+ free(d);
d = const_cast<Data *>(&shared_null.ba);
d->ref.ref();
}
@@ -3885,7 +3885,7 @@ QByteArray QByteArray::fromRawData(const char *data, int size)
} else if (!size) {
x = const_cast<Data *>(&shared_empty.ba);
} else {
- x = static_cast<Data *>(qMalloc(sizeof(Data) + 1));
+ x = static_cast<Data *>(malloc(sizeof(Data) + 1));
Q_CHECK_PTR(x);
x->ref.initializeOwned();
x->size = size;
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index dcaa6153f9..2409ff1232 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp
index 43924a764e..fbe54fb9b3 100644
--- a/src/corelib/tools/qbytearraymatcher.cpp
+++ b/src/corelib/tools/qbytearraymatcher.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qbytearraymatcher.h b/src/corelib/tools/qbytearraymatcher.h
index 0eb50bb77d..9acfa0d581 100644
--- a/src/corelib/tools/qbytearraymatcher.h
+++ b/src/corelib/tools/qbytearraymatcher.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qbytedata_p.h b/src/corelib/tools/qbytedata_p.h
index 22ec47fb9d..2708df3d52 100644
--- a/src/corelib/tools/qbytedata_p.h
+++ b/src/corelib/tools/qbytedata_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h
index 2928140863..fc5b8a0a9f 100644
--- a/src/corelib/tools/qcache.h
+++ b/src/corelib/tools/qcache.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -61,7 +61,6 @@ class QCache
};
Node *f, *l;
QHash<Key, Node> hash;
- void *unused; // ### Qt5: remove
int mx, total;
inline void unlink(Node &n) {
@@ -123,7 +122,7 @@ private:
template <class Key, class T>
inline QCache<Key, T>::QCache(int amaxCost)
- : f(0), l(0), unused(0), mx(amaxCost), total(0) {}
+ : f(0), l(0), mx(amaxCost), total(0) {}
template <class Key, class T>
inline void QCache<Key,T>::clear()
diff --git a/src/corelib/tools/qcache.qdoc b/src/corelib/tools/qcache.qdoc
index 397c5fbb0c..9c8aef15df 100644
--- a/src/corelib/tools/qcache.qdoc
+++ b/src/corelib/tools/qcache.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index ec4b0cce58..5109bf22a4 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h
index 1bc6962ca1..0e02d109f6 100644
--- a/src/corelib/tools/qchar.h
+++ b/src/corelib/tools/qchar.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qcontainerfwd.h b/src/corelib/tools/qcontainerfwd.h
index ed6ab4332c..51ba07d856 100644
--- a/src/corelib/tools/qcontainerfwd.h
+++ b/src/corelib/tools/qcontainerfwd.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qcontiguouscache.cpp b/src/corelib/tools/qcontiguouscache.cpp
index eef1f74b8c..29601149e4 100644
--- a/src/corelib/tools/qcontiguouscache.cpp
+++ b/src/corelib/tools/qcontiguouscache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h
index e192edf0ab..3c43b3abe7 100644
--- a/src/corelib/tools/qcontiguouscache.h
+++ b/src/corelib/tools/qcontiguouscache.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp
index 89b3bab7c6..350c785e8b 100644
--- a/src/corelib/tools/qcryptographichash.cpp
+++ b/src/corelib/tools/qcryptographichash.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -50,6 +50,7 @@
#include "../../3rdparty/md4/md4.h"
#include "../../3rdparty/md4/md4.cpp"
#include "../../3rdparty/sha1/sha1.cpp"
+#include <qiodevice.h>
QT_BEGIN_NAMESPACE
@@ -155,6 +156,28 @@ void QCryptographicHash::addData(const QByteArray &data)
}
/*!
+ Reads the data from the open QIODevice \a device until it ends
+ and hashes it. Returns true if reading was successful.
+ */
+bool QCryptographicHash::addData(QIODevice* device)
+{
+ if (!device->isReadable())
+ return false;
+
+ if (!device->isOpen())
+ return false;
+
+ char buffer[1024];
+ int length;
+
+ while ((length = device->read(buffer,sizeof(buffer))) > 0)
+ addData(buffer,length);
+
+ return device->atEnd();
+}
+
+
+/*!
Returns the final hash value.
\sa QByteArray::toHex()
diff --git a/src/corelib/tools/qcryptographichash.h b/src/corelib/tools/qcryptographichash.h
index b40e8cc25b..64d54838fa 100644
--- a/src/corelib/tools/qcryptographichash.h
+++ b/src/corelib/tools/qcryptographichash.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
class QCryptographicHashPrivate;
+class QIODevice;
class Q_CORE_EXPORT QCryptographicHash
{
@@ -68,6 +69,7 @@ public:
void addData(const char *data, int length);
void addData(const QByteArray &data);
+ bool addData(QIODevice* device);
QByteArray result() const;
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 3c8848ba0f..d20b07589e 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -566,18 +566,6 @@ QString QDate::shortMonthName(int month, QDate::MonthNameType type)
}
/*!
- Returns the short version of the name of the \a month. The
- returned name is in normal type which can be used for date formatting.
-
- \sa toString(), longMonthName(), shortDayName(), longDayName()
- */
-
-QString QDate::shortMonthName(int month)
-{
- return shortMonthName(month, QDate::DateFormat);
-}
-
-/*!
\since 4.5
Returns the long name of the \a month for the representation specified
@@ -623,21 +611,6 @@ QString QDate::longMonthName(int month, MonthNameType type)
}
/*!
- Returns the long version of the name of the \a month. The
- returned name is in normal type which can be used for date formatting.
-
- \sa toString(), shortMonthName(), shortDayName(), longDayName()
- */
-
-QString QDate::longMonthName(int month)
-{
- if (month < 1 || month > 12) {
- month = 1;
- }
- return QLocale::system().monthName(month, QLocale::LongFormat);
-}
-
-/*!
\since 4.5
Returns the short name of the \a weekday for the representation specified
@@ -678,21 +651,6 @@ QString QDate::shortDayName(int weekday, MonthNameType type)
}
/*!
- Returns the short version of the name of the \a weekday. The
- returned name is in normal type which can be used for date formatting.
-
- \sa toString(), longDayName(), shortMonthName(), longMonthName()
- */
-
-QString QDate::shortDayName(int weekday)
-{
- if (weekday < 1 || weekday > 7) {
- weekday = 1;
- }
- return QLocale::system().dayName(weekday, QLocale::ShortFormat);
-}
-
-/*!
\since 4.5
Returns the long name of the \a weekday for the representation specified
@@ -731,21 +689,6 @@ QString QDate::longDayName(int weekday, MonthNameType type)
}
return QLocale::system().dayName(weekday, QLocale::LongFormat);
}
-
-/*!
- Returns the long version of the name of the \a weekday. The
- returned name is in normal type which can be used for date formatting.
-
- \sa toString(), shortDayName(), shortMonthName(), longMonthName()
- */
-
-QString QDate::longDayName(int weekday)
-{
- if (weekday < 1 || weekday > 7) {
- weekday = 1;
- }
- return QLocale::system().dayName(weekday, QLocale::LongFormat);
-}
#endif //QT_NO_TEXTDATE
#ifndef QT_NO_DATESTRING
@@ -1346,30 +1289,6 @@ bool QDate::isLeapYear(int y)
}
}
-/*!
- \internal
-
- This function has a confusing name and shouldn't be part of the
- API anyway, since we have toJulian() and fromJulian().
- ### Qt 5: remove it
-*/
-uint QDate::gregorianToJulian(int y, int m, int d)
-{
- return julianDayFromDate(y, m, d);
-}
-
-/*!
- \internal
-
- This function has a confusing name and shouldn't be part of the
- API anyway, since we have toJulian() and fromJulian().
- ### Qt 5: remove it
-*/
-void QDate::julianToGregorian(uint jd, int &y, int &m, int &d)
-{
- getDateFromJulianDay(jd, &y, &m, &d);
-}
-
/*! \fn static QDate QDate::fromJulianDay(int jd)
Converts the Julian day \a jd to a QDate.
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index 62bdcab7cc..ba52f7455c 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -76,15 +76,10 @@ public:
int weekNumber(int *yearNum = 0) const;
#ifndef QT_NO_TEXTDATE
- // ### Qt 5: merge these functions.
- static QString shortMonthName(int month);
- static QString shortMonthName(int month, MonthNameType type);
- static QString shortDayName(int weekday);
- static QString shortDayName(int weekday, MonthNameType type);
- static QString longMonthName(int month);
- static QString longMonthName(int month, MonthNameType type);
- static QString longDayName(int weekday);
- static QString longDayName(int weekday, MonthNameType type);
+ static QString shortMonthName(int month, MonthNameType type = DateFormat);
+ static QString shortDayName(int weekday, MonthNameType type = DateFormat);
+ static QString longMonthName(int month, MonthNameType type = DateFormat);
+ static QString longDayName(int weekday, MonthNameType type = DateFormat);
#endif // QT_NO_TEXTDATE
#ifndef QT_NO_DATESTRING
QString toString(Qt::DateFormat f = Qt::TextDate) const;
@@ -115,10 +110,6 @@ public:
static bool isValid(int y, int m, int d);
static bool isLeapYear(int year);
- // ### Qt 5: remove these two functions
- static uint gregorianToJulian(int y, int m, int d);
- static void julianToGregorian(uint jd, int &y, int &m, int &d);
-
static inline QDate fromJulianDay(int jd) { QDate d; d.jd = jd; return d; }
inline int toJulianDay() const { return jd; }
diff --git a/src/corelib/tools/qdatetime_p.h b/src/corelib/tools/qdatetime_p.h
index c20f2123f9..38aa748c6c 100644
--- a/src/corelib/tools/qdatetime_p.h
+++ b/src/corelib/tools/qdatetime_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index 4337c4a594..a3614f9b6c 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h
index 326e7f6e61..ef18ae20bc 100644
--- a/src/corelib/tools/qeasingcurve.h
+++ b/src/corelib/tools/qeasingcurve.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qelapsedtimer.cpp b/src/corelib/tools/qelapsedtimer.cpp
index 039c76960e..087252a926 100644
--- a/src/corelib/tools/qelapsedtimer.cpp
+++ b/src/corelib/tools/qelapsedtimer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qelapsedtimer.h b/src/corelib/tools/qelapsedtimer.h
index 6e5be84c00..73ec8d637e 100644
--- a/src/corelib/tools/qelapsedtimer.h
+++ b/src/corelib/tools/qelapsedtimer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qelapsedtimer_generic.cpp b/src/corelib/tools/qelapsedtimer_generic.cpp
index 165efa96f2..3c7bb197d7 100644
--- a/src/corelib/tools/qelapsedtimer_generic.cpp
+++ b/src/corelib/tools/qelapsedtimer_generic.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qelapsedtimer_mac.cpp b/src/corelib/tools/qelapsedtimer_mac.cpp
index 4b1275fe5c..f8f124f6a9 100644
--- a/src/corelib/tools/qelapsedtimer_mac.cpp
+++ b/src/corelib/tools/qelapsedtimer_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qelapsedtimer_symbian.cpp b/src/corelib/tools/qelapsedtimer_symbian.cpp
index dd5909f76f..4ae3f3d1ab 100644
--- a/src/corelib/tools/qelapsedtimer_symbian.cpp
+++ b/src/corelib/tools/qelapsedtimer_symbian.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qelapsedtimer_unix.cpp b/src/corelib/tools/qelapsedtimer_unix.cpp
index 8a046063f9..7f3d4f635c 100644
--- a/src/corelib/tools/qelapsedtimer_unix.cpp
+++ b/src/corelib/tools/qelapsedtimer_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qelapsedtimer_win.cpp b/src/corelib/tools/qelapsedtimer_win.cpp
index cd076a60d7..183171e306 100644
--- a/src/corelib/tools/qelapsedtimer_win.cpp
+++ b/src/corelib/tools/qelapsedtimer_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qfreelist.cpp b/src/corelib/tools/qfreelist.cpp
index bbbdb25e49..57530cf3c8 100644
--- a/src/corelib/tools/qfreelist.cpp
+++ b/src/corelib/tools/qfreelist.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qfreelist_p.h b/src/corelib/tools/qfreelist_p.h
index 5af0bb1807..2105e5af56 100644
--- a/src/corelib/tools/qfreelist_p.h
+++ b/src/corelib/tools/qfreelist_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qharfbuzz.cpp b/src/corelib/tools/qharfbuzz.cpp
index 324cd481ed..4eb6565557 100644
--- a/src/corelib/tools/qharfbuzz.cpp
+++ b/src/corelib/tools/qharfbuzz.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qharfbuzz_p.h b/src/corelib/tools/qharfbuzz_p.h
index f67b094c2d..a8da47b71c 100644
--- a/src/corelib/tools/qharfbuzz_p.h
+++ b/src/corelib/tools/qharfbuzz_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index 373b59872c..82ac8a0591 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -171,7 +171,7 @@ const QHashData QHashData::shared_null = {
void *QHashData::allocateNode(int nodeAlign)
{
- void *ptr = strictAlignment ? qMallocAligned(nodeSize, nodeAlign) : qMalloc(nodeSize);
+ void *ptr = strictAlignment ? qMallocAligned(nodeSize, nodeAlign) : malloc(nodeSize);
Q_CHECK_PTR(ptr);
return ptr;
}
@@ -181,7 +181,7 @@ void QHashData::freeNode(void *node)
if (strictAlignment)
qFreeAligned(node);
else
- qFree(node);
+ free(node);
}
QHashData *QHashData::detach_helper(void (*node_duplicate)(Node *, void *),
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index ec9bd42c83..0fdb1ad794 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qiterator.h b/src/corelib/tools/qiterator.h
index c789e23ddc..0747940bf2 100644
--- a/src/corelib/tools/qiterator.h
+++ b/src/corelib/tools/qiterator.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qiterator.qdoc b/src/corelib/tools/qiterator.qdoc
index 6594a2f874..0e33aecbe4 100644
--- a/src/corelib/tools/qiterator.qdoc
+++ b/src/corelib/tools/qiterator.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp
index 0f67652fb5..161123cfff 100644
--- a/src/corelib/tools/qline.cpp
+++ b/src/corelib/tools/qline.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qline.h b/src/corelib/tools/qline.h
index af2eda0850..956cbf9ce8 100644
--- a/src/corelib/tools/qline.h
+++ b/src/corelib/tools/qline.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp
index e5919363a0..acfbcd07eb 100644
--- a/src/corelib/tools/qlinkedlist.cpp
+++ b/src/corelib/tools/qlinkedlist.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index 55d229d351..966b74ddfa 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index 2a3695bb35..2afe1ab969 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,7 +42,9 @@
#include <new>
#include "qlist.h"
#include "qtools_p.h"
+
#include <string.h>
+#include <stdlib.h>
QT_BEGIN_NAMESPACE
@@ -82,7 +84,7 @@ QListData::Data *QListData::detach_grow(int *idx, int num)
int l = x->end - x->begin;
int nl = l + num;
int alloc = grow(nl);
- Data* t = static_cast<Data *>(qMalloc(DataHeaderSize + alloc * sizeof(void *)));
+ Data* t = static_cast<Data *>(::malloc(DataHeaderSize + alloc * sizeof(void *)));
Q_CHECK_PTR(t);
t->ref.initializeOwned();
@@ -124,7 +126,7 @@ QListData::Data *QListData::detach_grow(int *idx, int num)
QListData::Data *QListData::detach(int alloc)
{
Data *x = d;
- Data* t = static_cast<Data *>(qMalloc(DataHeaderSize + alloc * sizeof(void *)));
+ Data* t = static_cast<Data *>(::malloc(DataHeaderSize + alloc * sizeof(void *)));
Q_CHECK_PTR(t);
t->ref.initializeOwned();
@@ -145,7 +147,7 @@ QListData::Data *QListData::detach(int alloc)
void QListData::realloc(int alloc)
{
Q_ASSERT(d->ref == 1);
- Data *x = static_cast<Data *>(qRealloc(d, DataHeaderSize + alloc * sizeof(void *)));
+ Data *x = static_cast<Data *>(::realloc(d, DataHeaderSize + alloc * sizeof(void *)));
Q_CHECK_PTR(x);
d = x;
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 5c8a58a196..d192d31234 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index d2bb752c6d..1dc384985b 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -56,6 +56,7 @@ QT_END_NAMESPACE
#include "qplatformdefs.h"
#include "qdatastream.h"
+#include "qdebug.h"
#include "qstring.h"
#include "qlocale.h"
#include "qlocale_p.h"
@@ -775,6 +776,16 @@ QLocale &QLocale::operator=(const QLocale &other)
return *this;
}
+bool QLocale::operator==(const QLocale &other) const
+{
+ return d() == other.d() && numberOptions() == other.numberOptions();
+}
+
+bool QLocale::operator!=(const QLocale &other) const
+{
+ return d() != other.d() || numberOptions() != other.numberOptions();
+}
+
/*!
\since 4.2
@@ -3315,4 +3326,13 @@ QString QLocale::nativeCountryName() const
return getLocaleData(endonyms_data + d()->m_country_endonym_idx, d()->m_country_endonym_size);
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QLocale &l)
+{
+ dbg.nospace() << "QLocale(" << qPrintable(QLocale::languageToString(l.language()))
+ << ", " << qPrintable(QLocale::scriptToString(l.script()))
+ << ", " << qPrintable(QLocale::countryToString(l.country())) << ')';
+ return dbg.space();
+}
+#endif
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index 55dd55b984..9bc4ea70b8 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -739,8 +739,8 @@ public:
QStringList uiLanguages() const;
- inline bool operator==(const QLocale &other) const;
- inline bool operator!=(const QLocale &other) const;
+ bool operator==(const QLocale &other) const;
+ bool operator!=(const QLocale &other) const;
static QString languageToString(Language language);
static QString countryToString(Country country);
@@ -789,10 +789,6 @@ inline QString QLocale::toString(uint i) const
{ return toString(qulonglong(i)); }
inline QString QLocale::toString(float i, char f, int prec) const
{ return toString(double(i), f, prec); }
-inline bool QLocale::operator==(const QLocale &other) const
- { return d() == other.d() && numberOptions() == other.numberOptions(); }
-inline bool QLocale::operator!=(const QLocale &other) const
- { return d() != other.d() || numberOptions() != other.numberOptions(); }
inline QString QLocale::toCurrencyString(short i, const QString &symbol) const
{ return toCurrencyString(qlonglong(i), symbol); }
@@ -810,6 +806,10 @@ Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QLocale &);
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QLocale &);
#endif
+#ifndef QT_NO_DEBUG_STREAM
+Q_CORE_EXPORT QDebug operator<<(QDebug, const QLocale &);
+#endif
+
QT_END_NAMESPACE
#ifndef QT_NO_SYSTEMLOCALE
diff --git a/src/corelib/tools/qlocale.qdoc b/src/corelib/tools/qlocale.qdoc
index fd139c3bec..0337c708a9 100644
--- a/src/corelib/tools/qlocale.qdoc
+++ b/src/corelib/tools/qlocale.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -89,7 +89,7 @@
pair; it does not use the system locale database.
\note For the current keyboard input locale take a look at
- QApplication::keyboardInputLocale().
+ QInputPanel::locale().
QLocale's data is based on Common Locale Data Repository v1.8.1.
@@ -114,7 +114,7 @@
California, Berkeley and its contributors.
\sa QString::arg(), QString::toInt(), QString::toDouble(),
- QApplication::keyboardInputLocale()
+ QInputPanel::locale()
*/
/*!
diff --git a/src/corelib/tools/qlocale_data_p.h b/src/corelib/tools/qlocale_data_p.h
index 95b23a29a6..a29e40079a 100644
--- a/src/corelib/tools/qlocale_data_p.h
+++ b/src/corelib/tools/qlocale_data_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qlocale_icu.cpp b/src/corelib/tools/qlocale_icu.cpp
index a04b0bfc5f..0e220ff000 100644
--- a/src/corelib/tools/qlocale_icu.cpp
+++ b/src/corelib/tools/qlocale_icu.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm
index 82b6b00e5e..ffcbbbca4b 100644
--- a/src/corelib/tools/qlocale_mac.mm
+++ b/src/corelib/tools/qlocale_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index b607038aaf..0b229e5e3f 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp
index a4f6cc8458..abe437fc89 100644
--- a/src/corelib/tools/qlocale_symbian.cpp
+++ b/src/corelib/tools/qlocale_symbian.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qlocale_tools.cpp b/src/corelib/tools/qlocale_tools.cpp
index 750379c014..8a57a418e4 100644
--- a/src/corelib/tools/qlocale_tools.cpp
+++ b/src/corelib/tools/qlocale_tools.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -50,6 +50,10 @@
#include <stdlib.h>
#include <time.h>
+#ifdef Q_OS_WINCE
+# include "qfunctions_wince.h" // for _control87
+#endif
+
#if defined(Q_OS_LINUX) && !defined(__UCLIBC__)
# include <fenv.h>
#endif
diff --git a/src/corelib/tools/qlocale_tools_p.h b/src/corelib/tools/qlocale_tools_p.h
index 996b612208..85e6d3b0d0 100644
--- a/src/corelib/tools/qlocale_tools_p.h
+++ b/src/corelib/tools/qlocale_tools_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qlocale_unix.cpp b/src/corelib/tools/qlocale_unix.cpp
index 27e1782b93..5839a80e00 100644
--- a/src/corelib/tools/qlocale_unix.cpp
+++ b/src/corelib/tools/qlocale_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp
index 8b4b1b55bf..c09802879c 100644
--- a/src/corelib/tools/qlocale_win.cpp
+++ b/src/corelib/tools/qlocale_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp
index 76cb203e10..b1e8ecb0ad 100644
--- a/src/corelib/tools/qmap.cpp
+++ b/src/corelib/tools/qmap.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -85,7 +85,7 @@ void QMapData::continueFreeData(int offset)
if (strictAlignment)
qFreeAligned(reinterpret_cast<char *>(prev) - offset);
else
- qFree(reinterpret_cast<char *>(prev) - offset);
+ free(reinterpret_cast<char *>(prev) - offset);
}
delete this;
}
@@ -127,7 +127,7 @@ QMapData::Node *QMapData::node_create(Node *update[], int offset, int alignment)
void *concreteNode = strictAlignment ?
qMallocAligned(offset + sizeof(Node) + level * sizeof(Node *), alignment) :
- qMalloc(offset + sizeof(Node) + level * sizeof(Node *));
+ malloc(offset + sizeof(Node) + level * sizeof(Node *));
Q_CHECK_PTR(concreteNode);
Node *abstractNode = reinterpret_cast<Node *>(reinterpret_cast<char *>(concreteNode) + offset);
@@ -157,7 +157,7 @@ void QMapData::node_delete(Node *update[], int offset, Node *node)
if (strictAlignment)
qFreeAligned(reinterpret_cast<char *>(node) - offset);
else
- qFree(reinterpret_cast<char *>(node) - offset);
+ free(reinterpret_cast<char *>(node) - offset);
}
#ifdef QT_QMAP_DEBUG
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index 362b723b0a..f975b7eb16 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp
index 9c7dd038e7..e14e2aa227 100644
--- a/src/corelib/tools/qmargins.cpp
+++ b/src/corelib/tools/qmargins.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qmargins.h b/src/corelib/tools/qmargins.h
index 635ac56137..4e69907440 100644
--- a/src/corelib/tools/qmargins.h
+++ b/src/corelib/tools/qmargins.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qpair.h b/src/corelib/tools/qpair.h
index 95868840ea..0acd617e26 100644
--- a/src/corelib/tools/qpair.h
+++ b/src/corelib/tools/qpair.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qpair.qdoc b/src/corelib/tools/qpair.qdoc
index a9d73419ff..26e7c78996 100644
--- a/src/corelib/tools/qpair.qdoc
+++ b/src/corelib/tools/qpair.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qpodlist_p.h b/src/corelib/tools/qpodlist_p.h
index d06c9479e7..9c03f0e64a 100644
--- a/src/corelib/tools/qpodlist_p.h
+++ b/src/corelib/tools/qpodlist_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qpoint.cpp b/src/corelib/tools/qpoint.cpp
index bd32fe77b1..9139f4033c 100644
--- a/src/corelib/tools/qpoint.cpp
+++ b/src/corelib/tools/qpoint.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h
index b394ece1a6..a6381578d8 100644
--- a/src/corelib/tools/qpoint.h
+++ b/src/corelib/tools/qpoint.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qqueue.cpp b/src/corelib/tools/qqueue.cpp
index 2f5aae4026..5753c7d695 100644
--- a/src/corelib/tools/qqueue.cpp
+++ b/src/corelib/tools/qqueue.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qqueue.h b/src/corelib/tools/qqueue.h
index c10e6c0b2b..9aa7a7bdb0 100644
--- a/src/corelib/tools/qqueue.h
+++ b/src/corelib/tools/qqueue.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp
index 41ec816c46..2d63eb85e6 100644
--- a/src/corelib/tools/qrect.cpp
+++ b/src/corelib/tools/qrect.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h
index 58221f4739..34000750ee 100644
--- a/src/corelib/tools/qrect.h
+++ b/src/corelib/tools/qrect.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -136,29 +136,23 @@ public:
bool contains(int x, int y) const; // inline methods, _don't_ merge these
bool contains(int x, int y, bool proper) const;
bool contains(const QRect &r, bool proper = false) const;
- QRect unite(const QRect &r) const; // ### Qt 5: make QT4_SUPPORT
QRect united(const QRect &other) const;
- QRect intersect(const QRect &r) const; // ### Qt 5: make QT4_SUPPORT
QRect intersected(const QRect &other) const;
bool intersects(const QRect &r) const;
+#if QT_DEPRECATED_SINCE(5, 0)
+ QT_DEPRECATED QRect unite(const QRect &r) const { return united(r); }
+ QT_DEPRECATED QRect intersect(const QRect &r) const { return intersected(r); }
+#endif
+
friend Q_CORE_EXPORT_INLINE bool operator==(const QRect &, const QRect &);
friend Q_CORE_EXPORT_INLINE bool operator!=(const QRect &, const QRect &);
private:
- // ### Qt 5; remove the ifdef and just have the same order on all platforms.
-#if defined(Q_OS_MAC)
- int y1;
- int x1;
- int y2;
- int x2;
-#else
int x1;
int y1;
int x2;
int y2;
-#endif
-
};
Q_DECLARE_TYPEINFO(QRect, Q_MOVABLE_TYPE);
@@ -440,24 +434,14 @@ inline QRect& QRect::operator&=(const QRect &r)
return *this;
}
-inline QRect QRect::intersect(const QRect &r) const
-{
- return *this & r;
-}
-
inline QRect QRect::intersected(const QRect &other) const
{
- return intersect(other);
-}
-
-inline QRect QRect::unite(const QRect &r) const
-{
- return *this | r;
+ return *this & other;
}
inline QRect QRect::united(const QRect &r) const
{
- return unite(r);
+ return *this | r;
}
inline bool operator==(const QRect &r1, const QRect &r2)
@@ -557,12 +541,15 @@ public:
bool contains(const QPointF &p) const;
bool contains(qreal x, qreal y) const;
bool contains(const QRectF &r) const;
- QRectF unite(const QRectF &r) const; // ### Qt 5: make QT4_SUPPORT
QRectF united(const QRectF &other) const;
- QRectF intersect(const QRectF &r) const; // ### Qt 5: make QT4_SUPPORT
QRectF intersected(const QRectF &other) const;
bool intersects(const QRectF &r) const;
+#if QT_DEPRECATED_SINCE(5, 0)
+ QT_DEPRECATED QRectF unite(const QRectF &r) const { return united(r); }
+ QT_DEPRECATED QRectF intersect(const QRectF &r) const { return intersected(r); }
+#endif
+
friend Q_CORE_EXPORT_INLINE bool operator==(const QRectF &, const QRectF &);
friend Q_CORE_EXPORT_INLINE bool operator!=(const QRectF &, const QRectF &);
@@ -777,24 +764,14 @@ inline QRectF& QRectF::operator&=(const QRectF &r)
return *this;
}
-inline QRectF QRectF::intersect(const QRectF &r) const
-{
- return *this & r;
-}
-
inline QRectF QRectF::intersected(const QRectF &r) const
{
- return intersect(r);
-}
-
-inline QRectF QRectF::unite(const QRectF &r) const
-{
- return *this | r;
+ return *this & r;
}
inline QRectF QRectF::united(const QRectF &r) const
{
- return unite(r);
+ return *this | r;
}
inline bool operator==(const QRectF &r1, const QRectF &r2)
diff --git a/src/corelib/tools/qrefcount.cpp b/src/corelib/tools/qrefcount.cpp
index c40214b2ab..5341d27a91 100644
--- a/src/corelib/tools/qrefcount.cpp
+++ b/src/corelib/tools/qrefcount.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qrefcount.h b/src/corelib/tools/qrefcount.h
index bf864f2f58..698351456f 100644
--- a/src/corelib/tools/qrefcount.h
+++ b/src/corelib/tools/qrefcount.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index 688b38d132..d300ed967d 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -45,6 +45,7 @@
#include "qbitarray.h"
#include "qcache.h"
#include "qdatastream.h"
+#include "qdebug.h"
#include "qlist.h"
#include "qmap.h"
#include "qmutex.h"
@@ -4571,4 +4572,13 @@ QDataStream &operator>>(QDataStream &in, QRegExp &regExp)
}
#endif // QT_NO_DATASTREAM
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QRegExp &r)
+{
+ dbg.nospace() << "QRegExp(patternSyntax=" << r.patternSyntax()
+ << ", pattern='"<< r.pattern() << "')";
+ return dbg.space();
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qregexp.h b/src/corelib/tools/qregexp.h
index 4ce2f6e0be..364745e24a 100644
--- a/src/corelib/tools/qregexp.h
+++ b/src/corelib/tools/qregexp.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -127,6 +127,10 @@ Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, const QRegExp &regExp);
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, QRegExp &regExp);
#endif
+#ifndef QT_NO_DEBUG_STREAM
+Q_CORE_EXPORT QDebug operator<<(QDebug, const QRegExp &);
+#endif
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h
index 4a19e12647..6bbce03a44 100644
--- a/src/corelib/tools/qringbuffer_p.h
+++ b/src/corelib/tools/qringbuffer_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp
index 9277a3ebbf..a95468617b 100644
--- a/src/corelib/tools/qscopedpointer.cpp
+++ b/src/corelib/tools/qscopedpointer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h
index a24f62e7ba..41e6dff90c 100644
--- a/src/corelib/tools/qscopedpointer.h
+++ b/src/corelib/tools/qscopedpointer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qscopedpointer_p.h b/src/corelib/tools/qscopedpointer_p.h
index 8dcc503ad2..eb7cc80e54 100644
--- a/src/corelib/tools/qscopedpointer_p.h
+++ b/src/corelib/tools/qscopedpointer_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qscopedvaluerollback.cpp b/src/corelib/tools/qscopedvaluerollback.cpp
index 1ad47f45dd..e5b68ded1f 100644
--- a/src/corelib/tools/qscopedvaluerollback.cpp
+++ b/src/corelib/tools/qscopedvaluerollback.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qscopedvaluerollback.h b/src/corelib/tools/qscopedvaluerollback.h
index ee62147540..3b821956eb 100644
--- a/src/corelib/tools/qscopedvaluerollback.h
+++ b/src/corelib/tools/qscopedvaluerollback.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h
index 5f48042114..7ad16a7943 100644
--- a/src/corelib/tools/qset.h
+++ b/src/corelib/tools/qset.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -176,9 +176,8 @@ public:
typedef iterator Iterator;
typedef const_iterator ConstIterator;
inline int count() const { return q_hash.count(); }
- inline const_iterator insert(const T &value) // ### Qt 5: should return an 'iterator'
- { return static_cast<typename Hash::const_iterator>(q_hash.insert(value,
- QHashDummyValue())); }
+ inline iterator insert(const T &value)
+ { return static_cast<typename Hash::iterator>(q_hash.insert(value, QHashDummyValue())); }
iterator find(const T &value) { return q_hash.find(value); }
const_iterator find(const T &value) const { return q_hash.find(value); }
inline const_iterator constFind(const T &value) const { return find(value); }
@@ -216,17 +215,6 @@ public:
{ QSet<T> result = *this; result += other; return result; }
inline QSet<T> operator-(const QSet<T> &other) const
{ QSet<T> result = *this; result -= other; return result; }
-#if QT_VERSION < 0x050000
- // ### Qt 5: remove
- inline QSet<T> operator|(const QSet<T> &other)
- { QSet<T> result = *this; result |= other; return result; }
- inline QSet<T> operator&(const QSet<T> &other)
- { QSet<T> result = *this; result &= other; return result; }
- inline QSet<T> operator+(const QSet<T> &other)
- { QSet<T> result = *this; result += other; return result; }
- inline QSet<T> operator-(const QSet<T> &other)
- { QSet<T> result = *this; result -= other; return result; }
-#endif
QList<T> toList() const;
inline QList<T> values() const { return toList(); }
diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc
index f562c68b72..28b53e690d 100644
--- a/src/corelib/tools/qset.qdoc
+++ b/src/corelib/tools/qset.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qshareddata.cpp b/src/corelib/tools/qshareddata.cpp
index ee2b0c4f3c..2995d4a123 100644
--- a/src/corelib/tools/qshareddata.cpp
+++ b/src/corelib/tools/qshareddata.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h
index 6de6a19289..add8025d5a 100644
--- a/src/corelib/tools/qshareddata.h
+++ b/src/corelib/tools/qshareddata.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index 34060926c7..0069eb6831 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qsharedpointer.h b/src/corelib/tools/qsharedpointer.h
index 6b2b41f1de..f4a0c02ebf 100644
--- a/src/corelib/tools/qsharedpointer.h
+++ b/src/corelib/tools/qsharedpointer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index f03889106f..3cad13856c 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp
index 3dfe38a4d1..9001c4a399 100644
--- a/src/corelib/tools/qsimd.cpp
+++ b/src/corelib/tools/qsimd.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index 296c275b61..2fc6d88fb6 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qsize.cpp b/src/corelib/tools/qsize.cpp
index d8bd14de8d..41abb0be17 100644
--- a/src/corelib/tools/qsize.cpp
+++ b/src/corelib/tools/qsize.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qsize.h b/src/corelib/tools/qsize.h
index adc857be96..c9712b3976 100644
--- a/src/corelib/tools/qsize.h
+++ b/src/corelib/tools/qsize.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qstack.cpp b/src/corelib/tools/qstack.cpp
index 0fbb8d8516..de851d2f0d 100644
--- a/src/corelib/tools/qstack.cpp
+++ b/src/corelib/tools/qstack.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qstack.h b/src/corelib/tools/qstack.h
index 224935455d..35518cfe5e 100644
--- a/src/corelib/tools/qstack.h
+++ b/src/corelib/tools/qstack.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index d57adbe731..dbe1e913c3 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1030,7 +1030,7 @@ QString::QString(const QChar *unicode, int size)
} else if (size <= 0) {
d = const_cast<Data *>(&shared_empty.str);
} else {
- d = (Data*) qMalloc(sizeof(Data)+(size+1)*sizeof(QChar));
+ d = (Data*) ::malloc(sizeof(Data)+(size+1)*sizeof(QChar));
Q_CHECK_PTR(d);
d->ref.initializeOwned();
d->size = size;
@@ -1062,7 +1062,7 @@ QString::QString(const QChar *unicode)
if (!size) {
d = const_cast<Data *>(&shared_empty.str);
} else {
- d = (Data*) qMalloc(sizeof(Data)+(size+1)*sizeof(QChar));
+ d = (Data*) ::malloc(sizeof(Data)+(size+1)*sizeof(QChar));
Q_CHECK_PTR(d);
d->ref.initializeOwned();
d->size = size;
@@ -1087,7 +1087,7 @@ QString::QString(int size, QChar ch)
if (size <= 0) {
d = const_cast<Data *>(&shared_empty.str);
} else {
- d = (Data*) qMalloc(sizeof(Data)+(size+1)*sizeof(QChar));
+ d = (Data*) ::malloc(sizeof(Data)+(size+1)*sizeof(QChar));
Q_CHECK_PTR(d);
d->ref.initializeOwned();
d->size = size;
@@ -1111,7 +1111,7 @@ QString::QString(int size, QChar ch)
*/
QString::QString(int size, Qt::Initialization)
{
- d = (Data*) qMalloc(sizeof(Data)+(size+1)*sizeof(QChar));
+ d = (Data*) ::malloc(sizeof(Data)+(size+1)*sizeof(QChar));
Q_CHECK_PTR(d);
d->ref.initializeOwned();
d->size = size;
@@ -1133,7 +1133,7 @@ QString::QString(int size, Qt::Initialization)
*/
QString::QString(QChar ch)
{
- d = (Data *) qMalloc(sizeof(Data) + 2*sizeof(QChar));
+ d = (Data *) ::malloc(sizeof(Data) + 2*sizeof(QChar));
Q_CHECK_PTR(d);
d->ref.initializeOwned();
d->size = 1;
@@ -1199,7 +1199,7 @@ QString::QString(QChar ch)
// ### Qt 5: rename freeData() to avoid confusion. See task 197625.
void QString::free(Data *d)
{
- qFree(d);
+ ::free(d);
}
/*!
@@ -1312,7 +1312,7 @@ void QString::resize(int size)
void QString::realloc(int alloc)
{
if (d->ref != 1 || d->offset) {
- Data *x = static_cast<Data *>(qMalloc(sizeof(Data) + (alloc+1) * sizeof(QChar)));
+ Data *x = static_cast<Data *>(::malloc(sizeof(Data) + (alloc+1) * sizeof(QChar)));
Q_CHECK_PTR(x);
x->ref.initializeOwned();
x->size = qMin(alloc, d->size);
@@ -1325,7 +1325,7 @@ void QString::realloc(int alloc)
QString::free(d);
d = x;
} else {
- Data *p = static_cast<Data *>(qRealloc(d, sizeof(Data) + (alloc+1) * sizeof(QChar)));
+ Data *p = static_cast<Data *>(::realloc(d, sizeof(Data) + (alloc+1) * sizeof(QChar)));
Q_CHECK_PTR(p);
d = p;
d->alloc = alloc;
@@ -1483,11 +1483,11 @@ QString& QString::insert(int i, const QChar *unicode, int size)
const ushort *s = (const ushort *)unicode;
if (s >= d->data() && s < d->data() + d->alloc) {
// Part of me - take a copy
- ushort *tmp = static_cast<ushort *>(qMalloc(size * sizeof(QChar)));
+ ushort *tmp = static_cast<ushort *>(::malloc(size * sizeof(QChar)));
Q_CHECK_PTR(tmp);
memcpy(tmp, s, size * sizeof(QChar));
insert(i, reinterpret_cast<const QChar *>(tmp), size);
- qFree(tmp);
+ ::free(tmp);
return *this;
}
@@ -1843,7 +1843,7 @@ void QString::replace_helper(uint *indices, int nIndices, int blen, const QChar
// (which we could possibly invalidate via a realloc or corrupt via memcpy operations.)
QChar *afterBuffer = const_cast<QChar *>(after);
if (after >= reinterpret_cast<QChar *>(d->data()) && after < reinterpret_cast<QChar *>(d->data()) + d->size) {
- afterBuffer = static_cast<QChar *>(qMalloc(alen*sizeof(QChar)));
+ afterBuffer = static_cast<QChar *>(::malloc(alen*sizeof(QChar)));
Q_CHECK_PTR(afterBuffer);
::memcpy(afterBuffer, after, alen*sizeof(QChar));
}
@@ -1898,11 +1898,11 @@ void QString::replace_helper(uint *indices, int nIndices, int blen, const QChar
}
} QT_CATCH(const std::bad_alloc &) {
if (afterBuffer != after)
- qFree(afterBuffer);
+ ::free(afterBuffer);
QT_RETHROW;
}
if (afterBuffer != after)
- qFree(afterBuffer);
+ ::free(afterBuffer);
}
/*!
@@ -3756,7 +3756,7 @@ QString::Data *QString::fromLatin1_helper(const char *str, int size)
} else {
if (size < 0)
size = qstrlen(str);
- d = static_cast<Data *>(qMalloc(sizeof(Data) + (size+1) * sizeof(QChar)));
+ d = static_cast<Data *>(::malloc(sizeof(Data) + (size+1) * sizeof(QChar)));
Q_CHECK_PTR(d);
d->ref.initializeOwned();
d->size = size;
@@ -3818,33 +3818,29 @@ QString::Data *QString::fromAscii_helper(const char *str, int size)
return fromLatin1_helper(str, size);
}
-/*!
+/*! \fn QString QString::fromLatin1(const char *str, int size)
Returns a QString initialized with the first \a size characters
of the Latin-1 string \a str.
- If \a size is -1 (default), it is taken to be qstrlen(\a
+ If \a size is -1 (default), it is taken to be strlen(\a
str).
\sa toLatin1(), fromAscii(), fromUtf8(), fromLocal8Bit()
*/
-QString QString::fromLatin1(const char *str, int size)
-{
- return QString(fromLatin1_helper(str, size), 0);
-}
-/*!
+/*! \fn QString QString::fromLocal8Bit(const char *str, int size)
Returns a QString initialized with the first \a size characters
of the 8-bit string \a str.
- If \a size is -1 (default), it is taken to be qstrlen(\a
+ If \a size is -1 (default), it is taken to be strlen(\a
str).
QTextCodec::codecForLocale() is used to perform the conversion.
\sa toLocal8Bit(), fromAscii(), fromLatin1(), fromUtf8()
*/
-QString QString::fromLocal8Bit(const char *str, int size)
+QString QString::fromLocal8Bit_helper(const char *str, int size)
{
if (!str)
return QString();
@@ -3860,11 +3856,11 @@ QString QString::fromLocal8Bit(const char *str, int size)
return fromLatin1(str, size);
}
-/*!
+/*! \fn QString QString::fromAscii(const char *, int size);
Returns a QString initialized with the first \a size characters
from the string \a str.
- If \a size is -1 (default), it is taken to be qstrlen(\a
+ If \a size is -1 (default), it is taken to be strlen(\a
str).
Note that, despite the name, this function actually uses the codec
@@ -3875,16 +3871,12 @@ QString QString::fromLocal8Bit(const char *str, int size)
\sa toAscii(), fromLatin1(), fromUtf8(), fromLocal8Bit()
*/
-QString QString::fromAscii(const char *str, int size)
-{
- return QString(fromAscii_helper(str, size), 0);
-}
-/*!
+/*! \fn QString QString::fromUtf8(const char *str, int size)
Returns a QString initialized with the first \a size bytes
of the UTF-8 string \a str.
- If \a size is -1 (default), it is taken to be qstrlen(\a
+ If \a size is -1 (default), it is taken to be strlen(\a
str).
UTF-8 is a Unicode codec and can represent all characters in a Unicode
@@ -3901,13 +3893,12 @@ QString QString::fromAscii(const char *str, int size)
\sa toUtf8(), fromAscii(), fromLatin1(), fromLocal8Bit()
*/
-QString QString::fromUtf8(const char *str, int size)
+QString QString::fromUtf8_helper(const char *str, int size)
{
if (!str)
return QString();
- if (size < 0)
- size = qstrlen(str);
+ Q_ASSERT(size != -1);
return QUtf8::convertToUnicode(str, size, 0);
}
@@ -7072,7 +7063,7 @@ QString QString::fromRawData(const QChar *unicode, int size)
} else if (!size) {
x = const_cast<Data *>(&shared_empty.str);
} else {
- x = static_cast<Data *>(qMalloc(sizeof(Data) + sizeof(ushort)));
+ x = static_cast<Data *>(::malloc(sizeof(Data) + sizeof(ushort)));
Q_CHECK_PTR(x);
x->ref.initializeOwned();
x->size = size;
@@ -8817,13 +8808,37 @@ QString QString::toHtmlEscaped() const
Creating a QString from it is free in this case, and the generated string data is stored in
the read-only segment of the compiled object file.
+ For compilers not supporting the creation of compile time strings, QStringLiteral will fall back to
+ QLatin1String.
+
+ The result of the QStringLiteral expression can be cast into a QString.
+
+ If you have code looking like:
+ \code
+ if (node.hasAttribute("http-contents-length")) //...
+ \endcode
+ One temporary QString will be created to be passed as the hasAttribute function parameter.
+ This can be quite expensive, as it involves a memory allocation and the copy and the conversion
+ of the data into QString's internal encoding.
+
+ This can be avoided by doing
+ \code
+ if (node.hasAttribute(QStringLiteral("http-contents-length"))) //...
+ \endcode
+ Then the QString's internal data will be generated at compile time and no conversion or allocation
+ will occur at runtime
+
Using QStringLiteral instead of a double quoted ascii literal can significantly speed up creation
of QString's from data known at compile time.
- If the compiler is c++0x enabled the string \a str can actually contain unicode data.
+ If the compiler is C++11 enabled the string \a str can actually contain unicode data.
- For compilers not supporting the creation of compile time strings, QStringLiteral will fall back to
- QLatin1String.
+ \note There are still a few cases in which QLatin1String is more efficient than QStringLiteral:
+ If it is passed to a function that has an overload that takes the QLatin1String directly, without
+ conversion to QString. For instance, this is the case of QString::operator==
+ \code
+ if (attribute.name() == QLatin1String("http-contents-length")) //...
+ \endcode
*/
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 898c80ce35..f7898bbadb 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -49,12 +49,6 @@
#ifndef QT_NO_STL
# include <string>
-
-# ifndef QT_NO_STL_WCHAR
-// workaround for some headers not typedef'ing std::wstring
-typedef std::basic_string<wchar_t> QStdWString;
-# endif // QT_NO_STL_WCHAR
-
#endif // QT_NO_STL
#include <stdarg.h>
@@ -407,10 +401,23 @@ public:
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT;
QVector<uint> toUcs4() const Q_REQUIRED_RESULT;
- static QString fromAscii(const char *, int size = -1);
- static QString fromLatin1(const char *, int size = -1);
- static QString fromUtf8(const char *, int size = -1);
- static QString fromLocal8Bit(const char *, int size = -1);
+ // note - this are all inline so we can benefit from strlen() compile time optimizations
+ static inline QString fromAscii(const char *str, int size = -1)
+ {
+ return QString(fromAscii_helper(str, (str && size == -1) ? int(strlen(str)) : size), 0);
+ }
+ static inline QString fromLatin1(const char *str, int size = -1)
+ {
+ return QString(fromLatin1_helper(str, (str && size == -1) ? int(strlen(str)) : size), 0);
+ }
+ static inline QString fromUtf8(const char *str, int size = -1)
+ {
+ return fromUtf8_helper(str, (str && size == -1) ? int(strlen(str)) : size);
+ }
+ static inline QString fromLocal8Bit(const char *str, int size = -1)
+ {
+ return fromLocal8Bit_helper(str, (str && size == -1) ? int(strlen(str)) : size);
+ }
static QString fromUtf16(const ushort *, int size = -1);
static QString fromUcs4(const uint *, int size = -1);
static QString fromRawData(const QChar *, int size);
@@ -492,13 +499,14 @@ public:
// ASCII compatibility
#ifndef QT_NO_CAST_FROM_ASCII
- inline QT_ASCII_CAST_WARN_CONSTRUCTOR QString(const char *ch) : d(fromAscii_helper(ch))
+ inline QT_ASCII_CAST_WARN_CONSTRUCTOR QString(const char *ch)
+ : d(fromAscii_helper(ch, ch ? int(strlen(ch)) : -1))
{}
inline QT_ASCII_CAST_WARN_CONSTRUCTOR QString(const QByteArray &a)
: d(fromAscii_helper(a.constData(), qstrnlen(a.constData(), a.size())))
{}
inline QT_ASCII_CAST_WARN QString &operator=(const char *ch)
- { return (*this = fromAscii(ch)); }
+ { return (*this = fromAscii(ch, ch ? int(strlen(ch)) : -1)); }
inline QT_ASCII_CAST_WARN QString &operator=(const QByteArray &a)
{ return (*this = fromAscii(a.constData(), qstrnlen(a.constData(), a.size()))); }
inline QT_ASCII_CAST_WARN QString &operator=(char c)
@@ -506,15 +514,15 @@ public:
// these are needed, so it compiles with STL support enabled
inline QT_ASCII_CAST_WARN QString &prepend(const char *s)
- { return prepend(QString::fromAscii(s)); }
+ { return prepend(QString::fromAscii(s, s ? int(strlen(s)) : -1)); }
inline QT_ASCII_CAST_WARN QString &prepend(const QByteArray &s)
{ return prepend(QString::fromAscii(s.constData(), qstrnlen(s.constData(), s.size()))); }
inline QT_ASCII_CAST_WARN QString &append(const char *s)
- { return append(QString::fromAscii(s)); }
+ { return append(QString::fromAscii(s, s ? int(strlen(s)) : -1)); }
inline QT_ASCII_CAST_WARN QString &append(const QByteArray &s)
{ return append(QString::fromAscii(s.constData(), qstrnlen(s.constData(), s.size()))); }
inline QT_ASCII_CAST_WARN QString &operator+=(const char *s)
- { return append(QString::fromAscii(s)); }
+ { return append(QString::fromAscii(s, s ? int(strlen(s)) : -1)); }
inline QT_ASCII_CAST_WARN QString &operator+=(const QByteArray &s)
{ return append(QString::fromAscii(s.constData(), qstrnlen(s.constData(), s.size()))); }
inline QT_ASCII_CAST_WARN QString &operator+=(char c)
@@ -562,15 +570,8 @@ public:
#ifndef QT_NO_STL
static inline QString fromStdString(const std::string &s);
inline std::string toStdString() const;
-# ifdef qdoc
static inline QString fromStdWString(const std::wstring &s);
inline std::wstring toStdWString() const;
-# else
-# ifndef QT_NO_STL_WCHAR
- static inline QString fromStdWString(const QStdWString &s);
- inline QStdWString toStdWString() const;
-# endif // QT_NO_STL_WCHAR
-# endif // qdoc
#endif
// compatibility
@@ -625,6 +626,8 @@ private:
const QChar *data2, int length2);
static Data *fromLatin1_helper(const char *str, int size = -1);
static Data *fromAscii_helper(const char *str, int size = -1);
+ static QString fromUtf8_helper(const char *str, int size);
+ static QString fromLocal8Bit_helper(const char *, int size);
static int toUcs4_helper(const ushort *uc, int length, uint *out);
void replace_helper(uint *indices, int nIndices, int blen, const QChar *after, int alen);
friend class QCharRef;
@@ -662,17 +665,17 @@ public:
{ return s >= *this; }
inline QT_ASCII_CAST_WARN bool operator==(const char *s) const
- { return QString::fromAscii(s) == *this; }
+ { return QString::fromAscii(s, s ? int(strlen(s)) : -1) == *this; }
inline QT_ASCII_CAST_WARN bool operator!=(const char *s) const
- { return QString::fromAscii(s) != *this; }
+ { return QString::fromAscii(s, s ? int(strlen(s)) : -1) != *this; }
inline QT_ASCII_CAST_WARN bool operator<(const char *s) const
- { return QString::fromAscii(s) > *this; }
+ { return QString::fromAscii(s, s ? int(strlen(s)) : -1) > *this; }
inline QT_ASCII_CAST_WARN bool operator>(const char *s) const
- { return QString::fromAscii(s) < *this; }
+ { return QString::fromAscii(s, s ? int(strlen(s)) : -1) < *this; }
inline QT_ASCII_CAST_WARN bool operator<=(const char *s) const
- { return QString::fromAscii(s) >= *this; }
+ { return QString::fromAscii(s, s ? int(strlen(s)) : -1) >= *this; }
inline QT_ASCII_CAST_WARN bool operator>=(const char *s) const
- { return QString::fromAscii(s) <= *this; }
+ { return QString::fromAscii(s, s ? int(strlen(s)) : -1) <= *this; }
private:
int m_size;
const char *m_data;
@@ -925,7 +928,7 @@ inline bool operator!=(const QString &s, QString::Null) { return !s.isNull(); }
inline bool qStringComparisonHelper(const QString &s1, const char *s2)
{
# ifndef QT_NO_TEXTCODEC
- if (QString::codecForCStrings) return (s1 == QString::fromAscii(s2));
+ if (QString::codecForCStrings) return (s1 == QString::fromAscii(s2, s2 ? int(strlen(s2)) : -1));
# endif
return (s1 == QLatin1String(s2));
}
@@ -934,39 +937,39 @@ inline bool QString::operator==(const char *s) const
inline bool QString::operator!=(const char *s) const
{ return !qStringComparisonHelper(*this, s); }
inline bool QString::operator<(const char *s) const
-{ return *this < QString::fromAscii(s); }
+{ return *this < QString::fromAscii(s, s ? int(strlen(s)) : -1); }
inline bool QString::operator>(const char *s) const
-{ return *this > QString::fromAscii(s); }
+{ return *this > QString::fromAscii(s, s ? int(strlen(s)) : -1); }
inline bool QString::operator<=(const char *s) const
-{ return *this <= QString::fromAscii(s); }
+{ return *this <= QString::fromAscii(s, s ? int(strlen(s)) : -1); }
inline bool QString::operator>=(const char *s) const
-{ return *this >= QString::fromAscii(s); }
+{ return *this >= QString::fromAscii(s, s ? int(strlen(s)) : -1); }
inline QT_ASCII_CAST_WARN bool operator==(const char *s1, const QString &s2)
{ return qStringComparisonHelper(s2, s1); }
inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, const QString &s2)
{ return !qStringComparisonHelper(s2, s1); }
inline QT_ASCII_CAST_WARN bool operator<(const char *s1, const QString &s2)
-{ return (QString::fromAscii(s1) < s2); }
+{ return (QString::fromAscii(s1, s1 ? int(strlen(s1)) : -1) < s2); }
inline QT_ASCII_CAST_WARN bool operator>(const char *s1, const QString &s2)
-{ return (QString::fromAscii(s1) > s2); }
+{ return (QString::fromAscii(s1, s1 ? int(strlen(s1)) : -1) > s2); }
inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QString &s2)
-{ return (QString::fromAscii(s1) <= s2); }
+{ return (QString::fromAscii(s1, s1 ? int(strlen(s1)) : -1) <= s2); }
inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QString &s2)
-{ return (QString::fromAscii(s1) >= s2); }
+{ return (QString::fromAscii(s1, s1 ? int(strlen(s1)) : -1) >= s2); }
inline QT_ASCII_CAST_WARN bool operator==(const char *s1, const QLatin1String &s2)
-{ return QString::fromAscii(s1) == s2; }
+{ return QString::fromAscii(s1, s1 ? int(strlen(s1)) : -1) == s2; }
inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, const QLatin1String &s2)
-{ return QString::fromAscii(s1) != s2; }
+{ return QString::fromAscii(s1, s1 ? int(strlen(s1)) : -1) != s2; }
inline QT_ASCII_CAST_WARN bool operator<(const char *s1, const QLatin1String &s2)
-{ return (QString::fromAscii(s1) < s2); }
+{ return (QString::fromAscii(s1, s1 ? int(strlen(s1)) : -1) < s2); }
inline QT_ASCII_CAST_WARN bool operator>(const char *s1, const QLatin1String &s2)
-{ return (QString::fromAscii(s1) > s2); }
+{ return (QString::fromAscii(s1, s1 ? int(strlen(s1)) : -1) > s2); }
inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QLatin1String &s2)
-{ return (QString::fromAscii(s1) <= s2); }
+{ return (QString::fromAscii(s1, s1 ? int(strlen(s1)) : -1) <= s2); }
inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QLatin1String &s2)
-{ return (QString::fromAscii(s1) >= s2); }
+{ return (QString::fromAscii(s1, s1 ? int(strlen(s1)) : -1) >= s2); }
inline bool operator==(const QLatin1String &s1, const QLatin1String &s2)
{ return (qstrcmp(s1.latin1(), s2.latin1()) == 0); }
@@ -1029,9 +1032,9 @@ inline const QString operator+(QChar s1, const QString &s2)
{ QString t(s1); t += s2; return t; }
# ifndef QT_NO_CAST_FROM_ASCII
inline QT_ASCII_CAST_WARN const QString operator+(const QString &s1, const char *s2)
-{ QString t(s1); t += QString::fromAscii(s2); return t; }
+{ QString t(s1); t += QString::fromAscii(s2, s2 ? int(strlen(s2)) : -1); return t; }
inline QT_ASCII_CAST_WARN const QString operator+(const char *s1, const QString &s2)
-{ QString t = QString::fromAscii(s1); t += s2; return t; }
+{ QString t = QString::fromAscii(s1, s1 ? int(strlen(s1)) : -1); t += s2; return t; }
inline QT_ASCII_CAST_WARN const QString operator+(char c, const QString &s)
{ QString t = s; t.prepend(QChar::fromAscii(c)); return t; }
inline QT_ASCII_CAST_WARN const QString operator+(const QString &s, char c)
@@ -1050,10 +1053,9 @@ inline std::string QString::toStdString() const
inline QString QString::fromStdString(const std::string &s)
{ return fromAscii(s.data(), int(s.size())); }
-# ifndef QT_NO_STL_WCHAR
-inline QStdWString QString::toStdWString() const
+inline std::wstring QString::toStdWString() const
{
- QStdWString str;
+ std::wstring str;
str.resize(length());
#if defined(_MSC_VER) && _MSC_VER >= 1400
@@ -1065,9 +1067,8 @@ inline QStdWString QString::toStdWString() const
str.resize(toWCharArray(&(*str.begin())));
return str;
}
-inline QString QString::fromStdWString(const QStdWString &s)
+inline QString QString::fromStdWString(const std::wstring &s)
{ return fromWCharArray(s.data(), int(s.size())); }
-# endif
#endif
#if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE))
@@ -1212,7 +1213,7 @@ inline bool operator>=(const QStringRef &s1, const QStringRef &s2)
inline bool qStringComparisonHelper(const QStringRef &s1, const char *s2)
{
# ifndef QT_NO_TEXTCODEC
- if (QString::codecForCStrings) return (s1 == QString::fromAscii(s2));
+ if (QString::codecForCStrings) return (s1 == QString::fromAscii(s2, s2 ? int(strlen(s2)) : -1));
# endif
return (s1 == QLatin1String(s2));
}
diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp
index 2b40a68e0b..018a312fa6 100644
--- a/src/corelib/tools/qstringbuilder.cpp
+++ b/src/corelib/tools/qstringbuilder.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index de6b655e95..016e37fb38 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp
index bab7d42215..1fca78b03b 100644
--- a/src/corelib/tools/qstringlist.cpp
+++ b/src/corelib/tools/qstringlist.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h
index bded94399d..6c32f11096 100644
--- a/src/corelib/tools/qstringlist.h
+++ b/src/corelib/tools/qstringlist.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qstringmatcher.cpp b/src/corelib/tools/qstringmatcher.cpp
index 0117d78544..36016a9401 100644
--- a/src/corelib/tools/qstringmatcher.cpp
+++ b/src/corelib/tools/qstringmatcher.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qstringmatcher.h b/src/corelib/tools/qstringmatcher.h
index ed4e503644..9f5e10b942 100644
--- a/src/corelib/tools/qstringmatcher.h
+++ b/src/corelib/tools/qstringmatcher.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qtextboundaryfinder.cpp b/src/corelib/tools/qtextboundaryfinder.cpp
index aabb6949ad..4554ebb34f 100644
--- a/src/corelib/tools/qtextboundaryfinder.cpp
+++ b/src/corelib/tools/qtextboundaryfinder.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qtextboundaryfinder.h b/src/corelib/tools/qtextboundaryfinder.h
index 4d5369c3af..3f4f309d31 100644
--- a/src/corelib/tools/qtextboundaryfinder.h
+++ b/src/corelib/tools/qtextboundaryfinder.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp
index 0ca406308a..2ff25a9a46 100644
--- a/src/corelib/tools/qtimeline.cpp
+++ b/src/corelib/tools/qtimeline.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qtimeline.h b/src/corelib/tools/qtimeline.h
index d65822ff40..06a5d76a4b 100644
--- a/src/corelib/tools/qtimeline.h
+++ b/src/corelib/tools/qtimeline.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qtools_p.h b/src/corelib/tools/qtools_p.h
index 9a7f5dd852..6a1b78b12b 100644
--- a/src/corelib/tools/qtools_p.h
+++ b/src/corelib/tools/qtools_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qunicodetables.cpp b/src/corelib/tools/qunicodetables.cpp
index 88fd2afb72..7fc09e7d60 100644
--- a/src/corelib/tools/qunicodetables.cpp
+++ b/src/corelib/tools/qunicodetables.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qunicodetables_p.h b/src/corelib/tools/qunicodetables_p.h
index 0c9bd02c04..0a357c0da6 100644
--- a/src/corelib/tools/qunicodetables_p.h
+++ b/src/corelib/tools/qunicodetables_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h
index 6da6cf524d..d37389a8dc 100644
--- a/src/corelib/tools/qvarlengtharray.h
+++ b/src/corelib/tools/qvarlengtharray.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -95,6 +95,11 @@ public:
}
inline int size() const { return s; }
inline int count() const { return s; }
+ inline int length() const { return s; }
+ inline T& first() { Q_ASSERT(!isEmpty()); return *begin(); }
+ inline const T& first() const { Q_ASSERT(!isEmpty()); return *begin(); }
+ T& last() { Q_ASSERT(!isEmpty()); return *(end() - 1); }
+ const T& last() const { Q_ASSERT(!isEmpty()); return *(end() - 1); }
inline bool isEmpty() const { return (s == 0); }
inline void resize(int size);
inline void clear() { resize(0); }
diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc
index b1d7a1a5b1..c4198aafa7 100644
--- a/src/corelib/tools/qvarlengtharray.qdoc
+++ b/src/corelib/tools/qvarlengtharray.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -118,6 +118,43 @@
\sa isEmpty(), resize()
*/
+/*! \fn int QVarLengthArray::length() const
+
+ Same as size().
+
+ \sa isEmpty(), resize()
+*/
+
+/*! \fn T& QVarLengthArray::first()
+
+ Returns a reference to the first item in the array. The array must
+ not be empty. If the array can be empty, check isEmpty() before
+ calling this function.
+
+ \sa last(), isEmpty()
+*/
+
+/*! \fn const T& QVarLengthArray::first() const
+
+ \overload
+*/
+
+/*! \fn T& QVarLengthArray::last()
+
+ Returns a reference to the last item in the array. The array must
+ not be empty. If the array can be empty, check isEmpty() before
+ calling this function.
+
+ \sa first(), isEmpty()
+*/
+
+/*! \fn const T& QVarLengthArray::last() const
+
+ \overload
+*/
+
+
+
/*! \fn bool QVarLengthArray::isEmpty() const
Returns true if the array has size 0; otherwise returns false.
diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp
index d4c7fd79f7..59ca11179b 100644
--- a/src/corelib/tools/qvector.cpp
+++ b/src/corelib/tools/qvector.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -41,7 +41,9 @@
#include "qvector.h"
#include "qtools_p.h"
+
#include <string.h>
+#include <stdlib.h>
QT_BEGIN_NAMESPACE
@@ -56,7 +58,7 @@ const QVectorData QVectorData::shared_null = { Q_REFCOUNT_INITIALIZE_STATIC, 0,
QVectorData *QVectorData::malloc(int sizeofTypedData, int size, int sizeofT, QVectorData *init)
{
- QVectorData* p = (QVectorData *)qMalloc(sizeofTypedData + (size - 1) * sizeofT);
+ QVectorData* p = (QVectorData *)::malloc(sizeofTypedData + (size - 1) * sizeofT);
Q_CHECK_PTR(p);
::memcpy(p, init, sizeofTypedData + (qMin(size, init->alloc) - 1) * sizeofT);
return p;
@@ -64,14 +66,14 @@ QVectorData *QVectorData::malloc(int sizeofTypedData, int size, int sizeofT, QVe
QVectorData *QVectorData::allocate(int size, int alignment)
{
- return static_cast<QVectorData *>(alignment > alignmentThreshold() ? qMallocAligned(size, alignment) : qMalloc(size));
+ return static_cast<QVectorData *>(alignment > alignmentThreshold() ? qMallocAligned(size, alignment) : ::malloc(size));
}
QVectorData *QVectorData::reallocate(QVectorData *x, int newsize, int oldsize, int alignment)
{
if (alignment > alignmentThreshold())
return static_cast<QVectorData *>(qReallocAligned(x, newsize, oldsize, alignment));
- return static_cast<QVectorData *>(qRealloc(x, newsize));
+ return static_cast<QVectorData *>(realloc(x, newsize));
}
void QVectorData::free(QVectorData *x, int alignment)
@@ -79,7 +81,7 @@ void QVectorData::free(QVectorData *x, int alignment)
if (alignment > alignmentThreshold())
qFreeAligned(x);
else
- qFree(x);
+ ::free(x);
}
int QVectorData::grow(int sizeofTypedData, int size, int sizeofT, bool excessive)
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index f9db421fdb..51364df91d 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -603,7 +603,7 @@ void QVector<T>::append(const T &t)
}
template <typename T>
-Q_TYPENAME QVector<T>::iterator QVector<T>::insert(iterator before, size_type n, const T &t)
+typename QVector<T>::iterator QVector<T>::insert(iterator before, size_type n, const T &t)
{
int offset = int(before - p->array);
if (n != 0) {
@@ -637,7 +637,7 @@ Q_TYPENAME QVector<T>::iterator QVector<T>::insert(iterator before, size_type n,
}
template <typename T>
-Q_TYPENAME QVector<T>::iterator QVector<T>::erase(iterator abegin, iterator aend)
+typename QVector<T>::iterator QVector<T>::erase(iterator abegin, iterator aend)
{
int f = int(abegin - p->array);
int l = int(aend - p->array);
diff --git a/src/corelib/tools/qvsnprintf.cpp b/src/corelib/tools/qvsnprintf.cpp
index 0b85cf0c0a..85f8270ffd 100644
--- a/src/corelib/tools/qvsnprintf.cpp
+++ b/src/corelib/tools/qvsnprintf.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/xml/make-parser.sh b/src/corelib/xml/make-parser.sh
index 11ac2196a6..a02538ba79 100755
--- a/src/corelib/xml/make-parser.sh
+++ b/src/corelib/xml/make-parser.sh
@@ -1,7 +1,7 @@
#!/bin/sh
#############################################################################
##
-## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
## Contact: Nokia Corporation (qt-info@nokia.com)
##
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index bf37902950..04336c3a31 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -885,9 +885,9 @@ void QXmlStreamReaderPrivate::parseEntity(const QString &value)
inline void QXmlStreamReaderPrivate::reallocateStack()
{
stack_size <<= 1;
- sym_stack = reinterpret_cast<Value*> (qRealloc(sym_stack, stack_size * sizeof(Value)));
+ sym_stack = reinterpret_cast<Value*> (realloc(sym_stack, stack_size * sizeof(Value)));
Q_CHECK_PTR(sym_stack);
- state_stack = reinterpret_cast<int*> (qRealloc(state_stack, stack_size * sizeof(int)));
+ state_stack = reinterpret_cast<int*> (realloc(state_stack, stack_size * sizeof(int)));
Q_CHECK_PTR(sym_stack);
}
@@ -897,8 +897,8 @@ QXmlStreamReaderPrivate::~QXmlStreamReaderPrivate()
#ifndef QT_NO_TEXTCODEC
delete decoder;
#endif
- qFree(sym_stack);
- qFree(state_stack);
+ free(sym_stack);
+ free(state_stack);
delete entityParser;
}
diff --git a/src/corelib/xml/qxmlstream.g b/src/corelib/xml/qxmlstream.g
index 26e7323a5f..88bfcd47cc 100644
--- a/src/corelib/xml/qxmlstream.g
+++ b/src/corelib/xml/qxmlstream.g
@@ -1,6 +1,6 @@
----------------------------------------------------------------------------
--
--- Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+-- Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-- All rights reserved.
-- Contact: Nokia Corporation (qt-info@nokia.com)
--
diff --git a/src/corelib/xml/qxmlstream.h b/src/corelib/xml/qxmlstream.h
index 3e19bef273..04f9322712 100644
--- a/src/corelib/xml/qxmlstream.h
+++ b/src/corelib/xml/qxmlstream.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h
index db5fb65246..e67ff3d76b 100644
--- a/src/corelib/xml/qxmlstream_p.h
+++ b/src/corelib/xml/qxmlstream_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/xml/qxmlutils.cpp b/src/corelib/xml/qxmlutils.cpp
index 9cae7632e5..afc4fff8d6 100644
--- a/src/corelib/xml/qxmlutils.cpp
+++ b/src/corelib/xml/qxmlutils.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/corelib/xml/qxmlutils_p.h b/src/corelib/xml/qxmlutils_p.h
index 5fa913e63a..8b8d2358c9 100644
--- a/src/corelib/xml/qxmlutils_p.h
+++ b/src/corelib/xml/qxmlutils_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbus_symbols.cpp b/src/dbus/qdbus_symbols.cpp
index 8e74b8b922..8f02bedf15 100644
--- a/src/dbus/qdbus_symbols.cpp
+++ b/src/dbus/qdbus_symbols.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbus_symbols_p.h b/src/dbus/qdbus_symbols_p.h
index 8178e2ecf3..bb17231c34 100644
--- a/src/dbus/qdbus_symbols_p.h
+++ b/src/dbus/qdbus_symbols_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusabstractadaptor.cpp b/src/dbus/qdbusabstractadaptor.cpp
index 9d9e0f6e28..6acbd98fbf 100644
--- a/src/dbus/qdbusabstractadaptor.cpp
+++ b/src/dbus/qdbusabstractadaptor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusabstractadaptor.h b/src/dbus/qdbusabstractadaptor.h
index bb9c11bbaa..2f5896a9cb 100644
--- a/src/dbus/qdbusabstractadaptor.h
+++ b/src/dbus/qdbusabstractadaptor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusabstractadaptor_p.h b/src/dbus/qdbusabstractadaptor_p.h
index 4c197be226..a9e184a186 100644
--- a/src/dbus/qdbusabstractadaptor_p.h
+++ b/src/dbus/qdbusabstractadaptor_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp
index 9f68313040..a63864a0b3 100644
--- a/src/dbus/qdbusabstractinterface.cpp
+++ b/src/dbus/qdbusabstractinterface.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusabstractinterface.h b/src/dbus/qdbusabstractinterface.h
index 34ff4107f9..9cc68594e6 100644
--- a/src/dbus/qdbusabstractinterface.h
+++ b/src/dbus/qdbusabstractinterface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusabstractinterface_p.h b/src/dbus/qdbusabstractinterface_p.h
index 4f96165aa0..b0fb04e831 100644
--- a/src/dbus/qdbusabstractinterface_p.h
+++ b/src/dbus/qdbusabstractinterface_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusargument.cpp b/src/dbus/qdbusargument.cpp
index af800d765d..4bb5d55724 100644
--- a/src/dbus/qdbusargument.cpp
+++ b/src/dbus/qdbusargument.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusargument.h b/src/dbus/qdbusargument.h
index cea28f9b61..74a5b37078 100644
--- a/src/dbus/qdbusargument.h
+++ b/src/dbus/qdbusargument.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusargument_p.h b/src/dbus/qdbusargument_p.h
index d8ca442920..c04e458449 100644
--- a/src/dbus/qdbusargument_p.h
+++ b/src/dbus/qdbusargument_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -201,6 +201,7 @@ public:
QVariant toVariantInternal();
QDBusArgument::ElementType currentType();
+ bool isCurrentTypeStringLike();
public:
DBusMessageIter iterator;
@@ -208,6 +209,11 @@ public:
private:
Q_DISABLE_COPY(QDBusDemarshaller)
+ QString toStringUnchecked();
+ QDBusObjectPath toObjectPathUnchecked();
+ QDBusSignature toSignatureUnchecked();
+ QStringList toStringListUnchecked();
+ QByteArray toByteArrayUnchecked();
};
inline QDBusMarshaller *QDBusArgumentPrivate::marshaller()
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index 7d3cf9be4c..50a55040c8 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -123,23 +123,6 @@ void QDBusConnectionManager::setConnection(const QString &name, QDBusConnectionP
}
/*!
- \fn QDBusConnection &QDBusConnection::sessionBus()
- \relates QDBusConnection
-
- Returns a QDBusConnection object opened with the session bus. The object
- reference returned by this function is valid until the application terminates,
- at which point the connection will be closed and the object deleted.
-*/
-/*!
- \fn QDBusConnection &QDBusConnection::systemBus()
- \relates QDBusConnection
-
- Returns a QDBusConnection object opened with the system bus. The object reference returned
- by this function is valid until the QCoreApplication's destructor is run, when the
- connection will be closed and the object, deleted.
-*/
-
-/*!
\class QDBusConnection
\inmodule QtDBus
\since 4.2
@@ -1125,11 +1108,25 @@ Q_GLOBAL_STATIC_WITH_ARGS(QDBusDefaultConnection, _q_sessionBus,
Q_GLOBAL_STATIC_WITH_ARGS(QDBusDefaultConnection, _q_systemBus,
(QDBusConnection::SystemBus, _q_systemBusName))
+/*!
+ \fn QDBusConnection QDBusConnection::sessionBus()
+
+ Returns a QDBusConnection object opened with the session bus. The object
+ reference returned by this function is valid until the application terminates,
+ at which point the connection will be closed and the object deleted.
+*/
QDBusConnection QDBusConnection::sessionBus()
{
return *_q_sessionBus();
}
+/*!
+ \fn QDBusConnection QDBusConnection::systemBus()
+
+ Returns a QDBusConnection object opened with the system bus. The object reference returned
+ by this function is valid until the QCoreApplication's destructor is run, when the
+ connection will be closed and the object, deleted.
+*/
QDBusConnection QDBusConnection::systemBus()
{
return *_q_systemBus();
diff --git a/src/dbus/qdbusconnection.h b/src/dbus/qdbusconnection.h
index 8b126af77e..3b88ad3f9a 100644
--- a/src/dbus/qdbusconnection.h
+++ b/src/dbus/qdbusconnection.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index d481cf16ba..46fed80865 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusconnectioninterface.cpp b/src/dbus/qdbusconnectioninterface.cpp
index 063fb88afa..46080027a6 100644
--- a/src/dbus/qdbusconnectioninterface.cpp
+++ b/src/dbus/qdbusconnectioninterface.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusconnectioninterface.h b/src/dbus/qdbusconnectioninterface.h
index a516bc4552..93ee6709eb 100644
--- a/src/dbus/qdbusconnectioninterface.h
+++ b/src/dbus/qdbusconnectioninterface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusconnectionmanager_p.h b/src/dbus/qdbusconnectionmanager_p.h
index f9a9e2906e..9d929b019b 100644
--- a/src/dbus/qdbusconnectionmanager_p.h
+++ b/src/dbus/qdbusconnectionmanager_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbuscontext.cpp b/src/dbus/qdbuscontext.cpp
index b65af73e63..e4a5d879d7 100644
--- a/src/dbus/qdbuscontext.cpp
+++ b/src/dbus/qdbuscontext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbuscontext.h b/src/dbus/qdbuscontext.h
index 8dd9b40981..9ceef6ecc1 100644
--- a/src/dbus/qdbuscontext.h
+++ b/src/dbus/qdbuscontext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbuscontext_p.h b/src/dbus/qdbuscontext_p.h
index 691e69d2f1..5aa5da0378 100644
--- a/src/dbus/qdbuscontext_p.h
+++ b/src/dbus/qdbuscontext_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusdemarshaller.cpp b/src/dbus/qdbusdemarshaller.cpp
index 4103552db1..215e6a1eb1 100644
--- a/src/dbus/qdbusdemarshaller.cpp
+++ b/src/dbus/qdbusdemarshaller.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -130,19 +130,43 @@ inline double QDBusDemarshaller::toDouble()
return qIterGet<double>(&iterator);
}
-inline QString QDBusDemarshaller::toString()
+inline QString QDBusDemarshaller::toStringUnchecked()
{
return QString::fromUtf8(qIterGet<char *>(&iterator));
}
+inline QString QDBusDemarshaller::toString()
+{
+ if (isCurrentTypeStringLike())
+ return toStringUnchecked();
+ else
+ return QString();
+}
+
+inline QDBusObjectPath QDBusDemarshaller::toObjectPathUnchecked()
+ {
+ return QDBusObjectPath(QString::fromUtf8(qIterGet<char *>(&iterator)));
+ }
+
inline QDBusObjectPath QDBusDemarshaller::toObjectPath()
{
- return QDBusObjectPath(QString::fromUtf8(qIterGet<char *>(&iterator)));
+ if (isCurrentTypeStringLike())
+ return toObjectPathUnchecked();
+ else
+ return QDBusObjectPath();
}
+inline QDBusSignature QDBusDemarshaller::toSignatureUnchecked()
+ {
+ return QDBusSignature(QString::fromUtf8(qIterGet<char *>(&iterator)));
+ }
+
inline QDBusSignature QDBusDemarshaller::toSignature()
{
- return QDBusSignature(QString::fromUtf8(qIterGet<char *>(&iterator)));
+ if (isCurrentTypeStringLike())
+ return toSignatureUnchecked();
+ else
+ return QDBusSignature();
}
inline QDBusUnixFileDescriptor QDBusDemarshaller::toUnixFileDescriptor()
@@ -236,11 +260,11 @@ QVariant QDBusDemarshaller::toVariantInternal()
case DBUS_TYPE_UINT64:
return toULongLong();
case DBUS_TYPE_STRING:
- return toString();
+ return toStringUnchecked();
case DBUS_TYPE_OBJECT_PATH:
- return QVariant::fromValue(toObjectPath());
+ return QVariant::fromValue(toObjectPathUnchecked());
case DBUS_TYPE_SIGNATURE:
- return QVariant::fromValue(toSignature());
+ return QVariant::fromValue(toSignatureUnchecked());
case DBUS_TYPE_VARIANT:
return QVariant::fromValue(toVariant());
@@ -248,9 +272,9 @@ QVariant QDBusDemarshaller::toVariantInternal()
switch (q_dbus_message_iter_get_element_type(&iterator)) {
case DBUS_TYPE_BYTE:
// QByteArray
- return toByteArray();
+ return toByteArrayUnchecked();
case DBUS_TYPE_STRING:
- return toStringList();
+ return toStringListUnchecked();
case DBUS_TYPE_DICT_ENTRY:
return QVariant::fromValue(duplicate());
@@ -280,7 +304,20 @@ QVariant QDBusDemarshaller::toVariantInternal()
};
}
-QStringList QDBusDemarshaller::toStringList()
+bool QDBusDemarshaller::isCurrentTypeStringLike()
+{
+ const int type = q_dbus_message_iter_get_arg_type(&iterator);
+ switch (type) {
+ case DBUS_TYPE_STRING: //FALLTHROUGH
+ case DBUS_TYPE_OBJECT_PATH: //FALLTHROUGH
+ case DBUS_TYPE_SIGNATURE:
+ return true;
+ default:
+ return false;
+ }
+}
+
+QStringList QDBusDemarshaller::toStringListUnchecked()
{
QStringList list;
@@ -288,12 +325,21 @@ QStringList QDBusDemarshaller::toStringList()
q_dbus_message_iter_recurse(&iterator, &sub.iterator);
q_dbus_message_iter_next(&iterator);
while (!sub.atEnd())
- list.append(sub.toString());
+ list.append(sub.toStringUnchecked());
return list;
}
-QByteArray QDBusDemarshaller::toByteArray()
+QStringList QDBusDemarshaller::toStringList()
+{
+ if (q_dbus_message_iter_get_arg_type(&iterator) == DBUS_TYPE_ARRAY
+ && q_dbus_message_iter_get_element_type(&iterator) == DBUS_TYPE_STRING)
+ return toStringListUnchecked();
+ else
+ return QStringList();
+}
+
+QByteArray QDBusDemarshaller::toByteArrayUnchecked()
{
DBusMessageIter sub;
q_dbus_message_iter_recurse(&iterator, &sub);
@@ -304,6 +350,15 @@ QByteArray QDBusDemarshaller::toByteArray()
return QByteArray(data,len);
}
+QByteArray QDBusDemarshaller::toByteArray()
+{
+ if (q_dbus_message_iter_get_arg_type(&iterator) == DBUS_TYPE_ARRAY
+ && q_dbus_message_iter_get_element_type(&iterator) == DBUS_TYPE_BYTE) {
+ return toByteArrayUnchecked();
+ }
+ return QByteArray();
+}
+
bool QDBusDemarshaller::atEnd()
{
// dbus_message_iter_has_next is broken if the list has one single element
diff --git a/src/dbus/qdbuserror.cpp b/src/dbus/qdbuserror.cpp
index 09e3450ecc..911e104736 100644
--- a/src/dbus/qdbuserror.cpp
+++ b/src/dbus/qdbuserror.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbuserror.h b/src/dbus/qdbuserror.h
index 4683f30385..3f6a66c2f4 100644
--- a/src/dbus/qdbuserror.h
+++ b/src/dbus/qdbuserror.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusextratypes.cpp b/src/dbus/qdbusextratypes.cpp
index 05a95c09e5..8d9d2e06fd 100644
--- a/src/dbus/qdbusextratypes.cpp
+++ b/src/dbus/qdbusextratypes.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -46,7 +46,7 @@
QT_BEGIN_NAMESPACE
-void QDBusObjectPath::check()
+void QDBusObjectPath::doCheck()
{
if (!QDBusUtil::isValidObjectPath(*this)) {
qWarning("QDBusObjectPath: invalid path \"%s\"", qPrintable(*this));
@@ -54,7 +54,7 @@ void QDBusObjectPath::check()
}
}
-void QDBusSignature::check()
+void QDBusSignature::doCheck()
{
if (!QDBusUtil::isValidSignature(*this)) {
qWarning("QDBusSignature: invalid signature \"%s\"", qPrintable(*this));
diff --git a/src/dbus/qdbusextratypes.h b/src/dbus/qdbusextratypes.h
index 984d4537ec..36060ab0a4 100644
--- a/src/dbus/qdbusextratypes.h
+++ b/src/dbus/qdbusextratypes.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -75,26 +75,26 @@ public:
{ return *this; }
private:
- void check();
+ void doCheck();
};
inline QDBusObjectPath::QDBusObjectPath(const char *objectPath)
: QString(QString::fromLatin1(objectPath))
-{ check(); }
+{ doCheck(); }
inline QDBusObjectPath::QDBusObjectPath(const QLatin1String &objectPath)
: QString(objectPath)
-{ check(); }
+{ doCheck(); }
inline QDBusObjectPath::QDBusObjectPath(const QString &objectPath)
: QString(objectPath)
-{ check(); }
+{ doCheck(); }
inline QDBusObjectPath &QDBusObjectPath::operator=(const QDBusObjectPath &_path)
-{ QString::operator=(_path); check(); return *this; }
+{ QString::operator=(_path); doCheck(); return *this; }
inline void QDBusObjectPath::setPath(const QString &objectPath)
-{ QString::operator=(objectPath); check(); }
+{ QString::operator=(objectPath); doCheck(); }
inline bool operator==(const QDBusObjectPath &lhs, const QDBusObjectPath &rhs)
{ return lhs.path() == rhs.path(); }
@@ -125,26 +125,26 @@ public:
{ return *this; }
private:
- void check();
+ void doCheck();
};
inline QDBusSignature::QDBusSignature(const char *dBusSignature)
: QString(QString::fromAscii(dBusSignature))
-{ check(); }
+{ doCheck(); }
inline QDBusSignature::QDBusSignature(const QLatin1String &dBusSignature)
: QString(dBusSignature)
-{ check(); }
+{ doCheck(); }
inline QDBusSignature::QDBusSignature(const QString &dBusSignature)
: QString(dBusSignature)
-{ check(); }
+{ doCheck(); }
inline QDBusSignature &QDBusSignature::operator=(const QDBusSignature &dbusSignature)
-{ QString::operator=(dbusSignature); check(); return *this; }
+{ QString::operator=(dbusSignature); doCheck(); return *this; }
inline void QDBusSignature::setSignature(const QString &dBusSignature)
-{ QString::operator=(dBusSignature); check(); }
+{ QString::operator=(dBusSignature); doCheck(); }
inline bool operator==(const QDBusSignature &lhs, const QDBusSignature &rhs)
{ return lhs.signature() == rhs.signature(); }
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index f6b433e1ba..59b191bd10 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusintegrator_p.h b/src/dbus/qdbusintegrator_p.h
index 745048a7e2..1e39bd734a 100644
--- a/src/dbus/qdbusintegrator_p.h
+++ b/src/dbus/qdbusintegrator_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusinterface.cpp b/src/dbus/qdbusinterface.cpp
index b670244a0a..1bf468acad 100644
--- a/src/dbus/qdbusinterface.cpp
+++ b/src/dbus/qdbusinterface.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusinterface.h b/src/dbus/qdbusinterface.h
index 9396d9b483..75e876a389 100644
--- a/src/dbus/qdbusinterface.h
+++ b/src/dbus/qdbusinterface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusinterface_p.h b/src/dbus/qdbusinterface_p.h
index 1bff192209..b85d3cea77 100644
--- a/src/dbus/qdbusinterface_p.h
+++ b/src/dbus/qdbusinterface_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp
index b874a64644..7d07c92663 100644
--- a/src/dbus/qdbusinternalfilters.cpp
+++ b/src/dbus/qdbusinternalfilters.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusintrospection.cpp b/src/dbus/qdbusintrospection.cpp
index 710a943941..23eda78e5a 100644
--- a/src/dbus/qdbusintrospection.cpp
+++ b/src/dbus/qdbusintrospection.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusintrospection_p.h b/src/dbus/qdbusintrospection_p.h
index 29d5772189..025cf63fe3 100644
--- a/src/dbus/qdbusintrospection_p.h
+++ b/src/dbus/qdbusintrospection_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusmacros.h b/src/dbus/qdbusmacros.h
index f942a28c58..e508362db0 100644
--- a/src/dbus/qdbusmacros.h
+++ b/src/dbus/qdbusmacros.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusmarshaller.cpp b/src/dbus/qdbusmarshaller.cpp
index 790f044fd7..843388c51e 100644
--- a/src/dbus/qdbusmarshaller.cpp
+++ b/src/dbus/qdbusmarshaller.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp
index 78a1d902c3..8cd2cc5d67 100644
--- a/src/dbus/qdbusmessage.cpp
+++ b/src/dbus/qdbusmessage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -389,7 +389,7 @@ QDBusMessage QDBusMessage::createSignal(const QString &path, const QString &inte
When using DBus in a peer-to-peer context (i.e., not on a bus), the \a service parameter is
optional.
- The QDBusObject and QDBusInterface classes provide a simpler abstraction to synchronous
+ The QDBusInterface class provides a simpler abstraction to synchronous
method calling.
This function returns a QDBusMessage object that can be sent with
diff --git a/src/dbus/qdbusmessage.h b/src/dbus/qdbusmessage.h
index 14027ff27b..9cb1a476ca 100644
--- a/src/dbus/qdbusmessage.h
+++ b/src/dbus/qdbusmessage.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusmessage_p.h b/src/dbus/qdbusmessage_p.h
index 2c17c38e28..da716a6def 100644
--- a/src/dbus/qdbusmessage_p.h
+++ b/src/dbus/qdbusmessage_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusmetaobject.cpp b/src/dbus/qdbusmetaobject.cpp
index 8daf2300b7..e25de261ed 100644
--- a/src/dbus/qdbusmetaobject.cpp
+++ b/src/dbus/qdbusmetaobject.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusmetaobject_p.h b/src/dbus/qdbusmetaobject_p.h
index d9b1eedaa9..063234a49e 100644
--- a/src/dbus/qdbusmetaobject_p.h
+++ b/src/dbus/qdbusmetaobject_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp
index 20e8969590..e3ed5b5146 100644
--- a/src/dbus/qdbusmetatype.cpp
+++ b/src/dbus/qdbusmetatype.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusmetatype.h b/src/dbus/qdbusmetatype.h
index 979e28510c..53b4c29591 100644
--- a/src/dbus/qdbusmetatype.h
+++ b/src/dbus/qdbusmetatype.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusmetatype_p.h b/src/dbus/qdbusmetatype_p.h
index d33198f450..68deffbe08 100644
--- a/src/dbus/qdbusmetatype_p.h
+++ b/src/dbus/qdbusmetatype_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusmisc.cpp b/src/dbus/qdbusmisc.cpp
index 24eabfbfa6..e7c7715eaa 100644
--- a/src/dbus/qdbusmisc.cpp
+++ b/src/dbus/qdbusmisc.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp
index 2278db4394..1004146f1d 100644
--- a/src/dbus/qdbuspendingcall.cpp
+++ b/src/dbus/qdbuspendingcall.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbuspendingcall.h b/src/dbus/qdbuspendingcall.h
index 4791c3e6aa..dfdaf4e76a 100644
--- a/src/dbus/qdbuspendingcall.h
+++ b/src/dbus/qdbuspendingcall.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbuspendingcall_p.h b/src/dbus/qdbuspendingcall_p.h
index ae17214834..02057a74b2 100644
--- a/src/dbus/qdbuspendingcall_p.h
+++ b/src/dbus/qdbuspendingcall_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbuspendingreply.cpp b/src/dbus/qdbuspendingreply.cpp
index 2d8c4872ca..5f930c71a1 100644
--- a/src/dbus/qdbuspendingreply.cpp
+++ b/src/dbus/qdbuspendingreply.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbuspendingreply.h b/src/dbus/qdbuspendingreply.h
index 926e3ab48d..596a459009 100644
--- a/src/dbus/qdbuspendingreply.h
+++ b/src/dbus/qdbuspendingreply.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusreply.cpp b/src/dbus/qdbusreply.cpp
index 145412e3c3..6c5b598ea2 100644
--- a/src/dbus/qdbusreply.cpp
+++ b/src/dbus/qdbusreply.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusreply.h b/src/dbus/qdbusreply.h
index 33274f41cf..b9013185b4 100644
--- a/src/dbus/qdbusreply.h
+++ b/src/dbus/qdbusreply.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp
index a892e80faf..078f56aa61 100644
--- a/src/dbus/qdbusserver.cpp
+++ b/src/dbus/qdbusserver.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusserver.h b/src/dbus/qdbusserver.h
index d00702a26f..900c652d37 100644
--- a/src/dbus/qdbusserver.h
+++ b/src/dbus/qdbusserver.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusservicewatcher.cpp b/src/dbus/qdbusservicewatcher.cpp
index c56a3d4841..6db9a28712 100644
--- a/src/dbus/qdbusservicewatcher.cpp
+++ b/src/dbus/qdbusservicewatcher.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusservicewatcher.h b/src/dbus/qdbusservicewatcher.h
index 96318b274d..853064032b 100644
--- a/src/dbus/qdbusservicewatcher.h
+++ b/src/dbus/qdbusservicewatcher.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusthreaddebug_p.h b/src/dbus/qdbusthreaddebug_p.h
index c7e0dc584e..131437d370 100644
--- a/src/dbus/qdbusthreaddebug_p.h
+++ b/src/dbus/qdbusthreaddebug_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusunixfiledescriptor.cpp b/src/dbus/qdbusunixfiledescriptor.cpp
index 0ee29fc20f..5a8835735e 100644
--- a/src/dbus/qdbusunixfiledescriptor.cpp
+++ b/src/dbus/qdbusunixfiledescriptor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusunixfiledescriptor.h b/src/dbus/qdbusunixfiledescriptor.h
index 9afa6ac8a6..46d933ea24 100644
--- a/src/dbus/qdbusunixfiledescriptor.h
+++ b/src/dbus/qdbusunixfiledescriptor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusutil.cpp b/src/dbus/qdbusutil.cpp
index 0c7f0e63e0..70ef22f428 100644
--- a/src/dbus/qdbusutil.cpp
+++ b/src/dbus/qdbusutil.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusutil_p.h b/src/dbus/qdbusutil_p.h
index bda0b923d1..50ef4fc9c2 100644
--- a/src/dbus/qdbusutil_p.h
+++ b/src/dbus/qdbusutil_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusvirtualobject.cpp b/src/dbus/qdbusvirtualobject.cpp
index 992ccbf229..c421e7dfd6 100644
--- a/src/dbus/qdbusvirtualobject.cpp
+++ b/src/dbus/qdbusvirtualobject.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusvirtualobject.h b/src/dbus/qdbusvirtualobject.h
index be323de720..6f0807f16d 100644
--- a/src/dbus/qdbusvirtualobject.h
+++ b/src/dbus/qdbusvirtualobject.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusxmlgenerator.cpp b/src/dbus/qdbusxmlgenerator.cpp
index 076af8a0b7..b49756ebfe 100644
--- a/src/dbus/qdbusxmlgenerator.cpp
+++ b/src/dbus/qdbusxmlgenerator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusxmlparser.cpp b/src/dbus/qdbusxmlparser.cpp
index 19b35e6c07..b1d0b78c96 100644
--- a/src/dbus/qdbusxmlparser.cpp
+++ b/src/dbus/qdbusxmlparser.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/dbus/qdbusxmlparser_p.h b/src/dbus/qdbusxmlparser_p.h
index 3bf31a48e9..f7677e0ae4 100644
--- a/src/dbus/qdbusxmlparser_p.h
+++ b/src/dbus/qdbusxmlparser_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
deleted file mode 100644
index 8ddfd45060..0000000000
--- a/src/gui/Qt5GuiConfigExtras.cmake.in
+++ /dev/null
@@ -1,4 +0,0 @@
-
-set(Qt5Gui_PLUGIN_TYPES imageformats)
-
-set(Qt5_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qtiff)
diff --git a/src/gui/accessible/accessible.pri b/src/gui/accessible/accessible.pri
index be2fe1acf3..70ac033f77 100644
--- a/src/gui/accessible/accessible.pri
+++ b/src/gui/accessible/accessible.pri
@@ -16,16 +16,4 @@ contains(QT_CONFIG, accessibility) {
HEADERS += accessible/qaccessiblebridge.h
SOURCES += accessible/qaccessiblebridge.cpp
-
-### FIXME
-# mac:!qpa {
-# HEADERS += accessible/qaccessible_mac_p.h
-# OBJECTIVE_SOURCES += accessible/qaccessible_mac.mm \
-# accessible/qaccessible_mac_cocoa.mm
-# } else:win32:!qpa {
-# SOURCES += accessible/qaccessible_win.cpp
-# } else {
-# HEADERS += accessible/qaccessiblebridge.h
-# SOURCES += accessible/qaccessible_unix.cpp accessible/qaccessiblebridge.cpp
-# }
}
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index c65e7df327..de37f67943 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -50,10 +50,8 @@
#include <private/qguiapplication_p.h>
#include "qplatformaccessibility_qpa.h"
-#include <QtCore/QDebug>
-#include <QtCore/QHash>
-#include <QtCore/QMetaObject>
-#include <QtCore/QMutex>
+#include <QtCore/qdebug.h>
+#include <QtCore/qmetaobject.h>
#include <private/qfactoryloader_p.h>
QT_BEGIN_NAMESPACE
@@ -61,11 +59,13 @@ QT_BEGIN_NAMESPACE
/*!
\class QAccessible
\brief The QAccessible class provides enums and static functions
- relating to accessibility.
+ related to accessibility.
\ingroup accessibility
\inmodule QtWidgets
+ This class is part of \l {Accessibility for QWidget Applications}.
+
Accessible applications can be used by people who are not able to
use applications by conventional means.
@@ -120,94 +120,64 @@ QT_BEGIN_NAMESPACE
\sa QAccessibleInterface
*/
-/*!
- \enum QAccessible::Action
-
- This enum describes the possible types of action that can occur.
-
- \value DefaultAction
- \value Press
- \value SetFocus
- \value Increase
- \value Decrease
- \value Accept
- \value Cancel
- \value Select
- \value ClearSelection
- \value RemoveSelection
- \value ExtendSelection
- \value AddToSelection
-
- \value FirstStandardAction
- \value LastStandardAction
-*/
/*!
- \enum QAccessible::Method
-
- This enum describes the possible types of methods that can be
- invoked on an accessible object.
+ \class QAccessible::State
- \value ListSupportedMethods
- \value SetCursorPosition
- \value GetCursorPosition
+ This structure defines bit flags that indicate
+ the state of an accessible object. The values are:
- \omitvalue ForegroundColor
- \omitvalue BackgroundColor
+ \value active The object is the active window or the active sub-element in a container (that would get focus when focusing the container).
+ \value adjustable The object represents an adjustable value, e.g. sliders.
+ \value animated The object's appearance changes frequently.
+ \value busy The object cannot accept input at the moment.
+ \value checkable The object is checkable.
+ \value checked The object's check box is checked.
+ \value checkStateMixed The third state of checkboxes (half checked in tri-state check boxes).
+ \value collapsed The object is collapsed, e.g. a closed listview item, or an iconified window.
+ \value defaultButton The object represents the default button in a dialog.
+ \value defunct The object no longer exists.
+ \value editable The object has a text carret (and often implements the text interface).
+ \value expandable The object is expandable, mostly used for cells in a tree view.
+ \value expanded The object is expanded, currently its children are visible.
+ \value extSelectable The object supports extended selection.
+ \value focusable The object can receive focus. Only objects in the active window can receive focus.
+ \value focused The object has keyboard focus.
+ \value hasPopup The object opens a popup.
+ \value hotTracked The object's appearance is sensitive to the mouse cursor position.
+ \value invalid The object is no longer valid (because it has been deleted).
+ \value invalidEntry Input validation current input invalid.
+ \value invisible The object is not visible to the user.
+ \value linked The object is linked to another object, e.g. a hyperlink.
+ \value marqueed The object displays scrolling contents, e.g. a log view.
+ \value modal The object blocks input from other objects.
+ \value movable The object can be moved.
+ \value multiLine The object has multiple lines of text (word wrap), as opposed to a single line.
+ \value multiSelectable The object supports multiple selected items.
+ \value offscreen The object is clipped by the visible area. Objects that are off screen are also invisible.
+ \value passwordEdit The object is a password field, e.g. a line edit for entering a Password.
+ \value playsSound The object produces sound when interacted with.
+ \value pressed The object is pressed.
+ \value readOnly The object can usually be edited, but is explicitly set to read-only.
+ \value selectable The object is selectable.
+ \value selectableText The object has text which can be selected. This is different from selectable which refers to the object's children.
+ \value selected The object is selected.
+ \value selfVoicing The object describes itself through speech or sound.
+ \value sizeable The object can be resized, e.g. top-level windows.
+ \value summaryElement The object summarizes the state of the window and should be treated with priority.
+ \value supportsAutoCompletion The object has auto-completion, for example in line edits or combo boxes.
+ \value traversed The object is linked and has been visited.
+ \value updatesFrequently The object changes frequently and needs to be refreshed when accessing it.
+ \value disabled The object is unavailable to the user, e.g. a disabled widget.
- \sa QAccessibleInterface::invokeMethod()
+ Implementations of QAccessibleInterface::state() return a combination
+ of these flags.
*/
/*!
- \fn QSet<Method> QAccessibleInterface::supportedMethods()
- \since 4.3
+ \fn QAccessible::State::State()
- Returns a QSet of \l{QAccessible::}{Method}s that are supported by this
- accessible interface.
-
- \sa QAccessible::Method invokeMethod()
-*/
-
-/*!
- \enum QAccessible::StateFlag
-
- This enum type defines bit flags that can be combined to indicate
- the state of an accessible object. The values are:
-
- \value Animated The object's appearance changes frequently.
- \value Busy The object cannot accept input at the moment.
- \value Checked The object's check box is checked.
- \value Collapsed The object is collapsed, e.g. a closed listview item, or an iconified window.
- \value DefaultButton The object represents the default button in a dialog.
- \value Expanded The object is expandable, and currently the children are visible.
- \value ExtSelectable The object supports extended selection.
- \value Focusable The object can receive focus. Only objects in the active window can receive focus.
- \value Focused The object has keyboard focus.
- \value HasPopup The object opens a popup.
- \value HotTracked The object's appearance is sensitive to the mouse cursor position.
- \value Invisible The object is not visible to the user.
- \value Linked The object is linked to another object, e.g. a hyperlink.
- \value Marqueed The object displays scrolling contents, e.g. a log view.
- \value Mixed The state of the object is not determined, e.g. a tri-state check box that is neither checked nor unchecked.
- \value Modal The object blocks input from other objects.
- \value Movable The object can be moved.
- \value MultiSelectable The object supports multiple selected items.
- \value Normal The normal state.
- \value Offscreen The object is clipped by the visible area. Objects that are off screen are also invisible.
- \value Pressed The object is pressed.
- \value Protected The object is password protected, e.g. a line edit for entering a Password.
- \value ReadOnly The object can usually be edited, but is explicitly set to read-only.
- \value Selectable The object is selectable.
- \value Selected The object is selected.
- \value SelfVoicing The object describes itself through speech or sound.
- \value Sizeable The object can be resized, e.g. top-level windows.
- \value Traversed The object is linked and has been visited.
- \value Unavailable The object is unavailable to the user, e.g. a disabled widget.
- \omitvalue Moveable
- \omitvalue HasInvokeExtension
-
- Implementations of QAccessibleInterface::state() return a combination
- of these flags.
+ Creates a new QAccessible::State with all states set to false.
*/
/*!
@@ -360,7 +330,7 @@ QT_BEGIN_NAMESPACE
\value PopupMenu A menu which lists options that the user can select to perform an action.
\value ProgressBar The object displays the progress of an operation in progress.
\value PropertyPage A property page where the user can change options and settings.
- \value PushButton A button.
+ \value Button A button.
\value RadioButton An object that represents an option that is mutually exclusive with other options.
\value Row A row of cells, usually within a table.
\value RowHeader A header for a row of data.
@@ -391,10 +361,6 @@ QT_BEGIN_NAMESPACE
\value Unrelated The objects are unrelated.
\value Self The objects are the same.
- \value Ancestor The first object is a parent of the second object.
- \value Child The first object is a direct child of the second object.
- \value Descendent The first object is an indirect child of the second object.
- \value Sibling The objects are siblings.
\value Up The first object is above the second object.
\value Down The first object is below the second object.
@@ -409,7 +375,6 @@ QT_BEGIN_NAMESPACE
\value Controller The first object controls the second object.
\value Controlled The first object is controlled by the second object.
- \omitvalue HierarchyMask
\omitvalue GeometryMask
\omitvalue LogicalMask
@@ -433,6 +398,26 @@ QT_BEGIN_NAMESPACE
\value Help A longer text giving information about how to use the object.
\value Accelerator The keyboard shortcut that executes the object's default action.
\value UserText The first value to be used for user defined text.
+ \omitvalue DebugDescription
+*/
+
+/*!
+ \enum QAccessible::InterfaceType
+
+ \l QAccessibleInterface supports several sub interfaces.
+ In order to provide more information about some objects, their accessible
+ representation should implement one or more of these interfaces.
+ When subclassing one of these interfaces, \l QAccessibleInterface::interface_cast also needs to be implemented.
+
+ \value TextInterface For text that supports selections or is more than one line. Simple labels do not need to implement this interface.
+ \value EditableTextInterface For text that can be edited by the user.
+ \value ValueInterface For objects that are used to manipulate a value, for example slider or scroll bar.
+ \value ActionInterface For interactive objects that allow the user to trigger an action. Basically everything that allows for example mouse interaction.
+ \omitvalue ImageInterface For objects that represent an image. This interface is generally less important.
+ \value TableInterface For lists, tables and trees.
+ \value TableCellInterface For cells in a TableInterface object.
+
+ \sa QAccessibleInterface::interface_cast, QAccessibleTextInterface, QAccessibleEditableTextInterface, QAccessibleValueInterface, QAccessibleActionInterface, QAccessibleTableInterface, QAccessibleTableCellInterface
*/
/*!
@@ -657,15 +642,15 @@ bool QAccessible::isActive()
\sa queryAccessibleInterface()
*/
-void QAccessible::setRootObject(QObject *o)
+void QAccessible::setRootObject(QObject *object)
{
if (rootObjectHandler) {
- rootObjectHandler(o);
+ rootObjectHandler(object);
return;
}
if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
- pfAccessibility->setRootObject(o);
+ pfAccessibility->setRootObject(object);
}
/*!
@@ -686,12 +671,12 @@ void QAccessible::setRootObject(QObject *o)
the parameters of the call is expensive you can test isActive() to
avoid unnecessary computations.
*/
-void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
+void QAccessible::updateAccessibility(QObject *object, int child, Event reason)
{
- Q_ASSERT(o);
+ Q_ASSERT(object);
if (updateHandler) {
- updateHandler(o, who, reason);
+ updateHandler(object, child, reason);
return;
}
@@ -699,7 +684,7 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
return;
if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
- pfAccessibility->notifyAccessibilityUpdate(o, who, reason);
+ pfAccessibility->notifyAccessibilityUpdate(object, child, reason);
}
@@ -711,6 +696,8 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
\ingroup accessibility
\inmodule QtGui
+ This class is part of \l {Accessibility for QWidget Applications}.
+
Accessibility tools (also called AT Clients), such as screen readers
or braille displays, require high-level information about
accessible objects in an application. Accessible objects provide
@@ -740,8 +727,11 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
The functions childCount() and indexOfChild() return the number of
children of an accessible object and the index a child object has
- in its parent. The childAt() function returns the index of a child
- at a given position.
+ in its parent. The childAt() function returns a child QAccessibleInterface
+ that is found at a position. The child does not have to be a direct
+ child. This allows bypassing intermediate layers when the parent already knows the
+ top-most child. childAt() is used for hit testing (finding the object
+ under the mouse).
The relationTo() function provides information about how two
different objects relate to each other, and navigate() allows
@@ -827,9 +817,8 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
/*!
\fn int QAccessibleInterface::indexOfChild(const QAccessibleInterface *child) const
- Returns the 1-based index of the object \a child in this object's
- children list, or -1 if \a child is not a child of this object. 0
- is not a possible return value.
+ Returns the 0-based index of the object \a child in this object's
+ children list, or -1 if \a child is not a child of this object.
All objects provide this information about their children.
@@ -837,12 +826,10 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
*/
/*!
- \fn QAccessible::Relation QAccessibleInterface::relationTo(int child,
-const QAccessibleInterface *other, int otherChild) const
+ \fn QAccessible::Relation QAccessibleInterface::relationTo(const QAccessibleInterface *other) const
- Returns the relationship between this object's \a child and the \a
- other object's \a otherChild. If \a child is 0 the object's own relation
- is returned.
+ Returns the relationship between this object and the \a
+ other object.
The returned value indicates the relation of the called object to
the \a other object, e.g. if this object is a label for \a other
@@ -875,18 +862,21 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterfa
}
/*!
- \fn int QAccessibleInterface::childAt(int x, int y) const
+ \fn QAccessibleInterface *QAccessibleInterface::childAt(int x, int y) const
- Returns the 1-based index of the child that contains the screen
- coordinates (\a x, \a y). This function returns 0 if the point is
- positioned on the object itself. If the tested point is outside
- the boundaries of the object this function returns -1.
+ Returns the QAccessibleInterface of a child that contains the screen coordinates (\a x, \a y).
+ If there are no children at this position this function returns 0.
+ The returned accessible must be a child, but not necessarily a direct child.
This function is only relyable for visible objects (invisible
object might not be laid out correctly).
All visual objects provide this information.
+ A default implementation is provided for objects inheriting QAccessibleObject. This will iterate
+ over all children. If the widget manages its children (e.g. a table) it will be more efficient
+ to write a specialized implementation.
+
\sa rect()
*/
@@ -912,8 +902,7 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterfa
*/
/*!
- \fn int QAccessibleInterface::navigate(RelationFlag relation, int entry, QAccessibleInterface
-**target) const
+ \fn int QAccessibleInterface::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
Navigates from this object to an object that has a relationship
\a relation to this object, and returns the respective object in
@@ -956,18 +945,17 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterfa
*/
/*!
- \fn QString QAccessibleInterface::text(Text t, int child) const
+ \fn QString QAccessibleInterface::text(QAccessible::Text t) const
- Returns the value of the text property \a t of the object, or of
- the object's child if \a child is not 0.
+ Returns the value of the text property \a t of the object.
- The \l Name is a string used by clients to identify, find, or
+ The \l QAccessible::Name is a string used by clients to identify, find, or
announce an accessible object for the user. All objects must have
a name that is unique within their container. The name can be
used differently by clients, so the name should both give a
short description of the object and be unique.
- An accessible object's \l Description provides textual information
+ An accessible object's \l QAccessible::Description provides textual information
about an object's visual appearance. The description is primarily
used to provide greater context for vision-impaired users, but is
also used for context searching or other applications. Not all
@@ -975,17 +963,17 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterfa
description, but a tool button that shows a picture of a smiley
would.
- The \l Value of an accessible object represents visual information
+ The \l QAccessible::Value of an accessible object represents visual information
contained by the object, e.g. the text in a line edit. Usually,
the value can be modified by the user. Not all objects have a
value, e.g. static text labels don't, and some objects have a
state that already is the value, e.g. toggle buttons.
- The \l Help text provides information about the function and
+ The \l QAccessible::Help text provides information about the function and
usage of an accessible object. Not all objects provide this
information.
- The \l Accelerator is a keyboard shortcut that activates the
+ The \l QAccessible::Accelerator is a keyboard shortcut that activates the
object's default action. A keyboard shortcut is the underlined
character in the text of a menu, menu item or widget, and is
either the character itself, or a combination of this character
@@ -993,27 +981,26 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterfa
tool buttons also have shortcut keys and usually display them in
their tooltip.
- All objects provide a string for \l Name.
+ All objects provide a string for \l QAccessible::Name.
\sa role(), state()
*/
/*!
- \fn void QAccessibleInterface::setText(Text t, int child, const QString &text)
+ \fn void QAccessibleInterface::setText(QAccessible::Text t, const QString &text)
- Sets the text property \a t of the object, or of the object's
- child if \a child is not 0, to \a text.
+ Sets the text property \a t of the object to \a text.
- Note that the text properties of most objects are read-only.
+ Note that the text properties of most objects are read-only
+ so calling this function might have no effect.
\sa text()
*/
/*!
- \fn QRect QAccessibleInterface::rect(int child) const
+ \fn QRect QAccessibleInterface::rect() const
- Returns the geometry of the object, or of the object's child if \a child
- is not 0. The geometry is in screen coordinates.
+ Returns the geometry of the object. The geometry is in screen coordinates.
This function is only reliable for visible objects (invisible
objects might not be laid out correctly).
@@ -1024,10 +1011,10 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterfa
*/
/*!
- \fn QAccessible::Role QAccessibleInterface::role(int child) const
+ \fn QAccessible::Role QAccessibleInterface::role() const
- Returns the role of the object, or of the object's child if \a child
- is not 0. The role of an object is usually static.
+ Returns the role of the object.
+ The role of an object is usually static.
All accessible objects have a role.
@@ -1035,10 +1022,10 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterfa
*/
/*!
- \fn QAccessible::State QAccessibleInterface::state(int child) const
+ \fn QAccessible::State QAccessibleInterface::state() const
- Returns the current state of the object, or of the object's child if
- \a child is not 0. The returned value is a combination of the flags in
+ Returns the current state of the object.
+ The returned value is a combination of the flags in
the QAccessible::StateFlag enumeration.
All accessible objects have a state.
@@ -1088,7 +1075,7 @@ QColor QAccessibleInterface::backgroundColor() const
*/
/*!
- \fn QAccessibleTable2Interface *QAccessibleInterface::table2Interface()
+ \fn QAccessibleTableCellInterface *QAccessibleInterface::tableCellInterface()
\internal
*/
@@ -1104,6 +1091,9 @@ QColor QAccessibleInterface::backgroundColor() const
/*!
\class QAccessibleEvent
+
+ \internal
+
\brief The QAccessibleEvent class is used to query addition
accessibility information about complex widgets.
@@ -1127,16 +1117,11 @@ QColor QAccessibleInterface::backgroundColor() const
*/
/*!
- \fn QAccessibleEvent::QAccessibleEvent(Type type, int child)
+ \fn QAccessibleEvent::QAccessibleEvent(Type type)
Constructs an accessibility event of the given \a type, which
must be QEvent::AccessibilityDescription or
QEvent::AccessibilityHelp.
-
- \a child is the (1-based) index of the child to which the request
- applies. If \a child is 0, the request is for the widget itself.
-
- \sa child()
*/
/*!
@@ -1162,6 +1147,7 @@ QColor QAccessibleInterface::backgroundColor() const
\sa value()
*/
+
/*!
Returns the window associated with the underlying object.
For instance, QAccessibleWidget reimplements this and returns
@@ -1191,16 +1177,61 @@ QWindow *QAccessibleInterface::window() const
Returns an invalid QVariant if the object doesn't support the action.
*/
-QVariant QAccessibleInterface::invokeMethod(QAccessible::Method method, const QVariantList &params)
+
+/*!
+ \internal
+ Method to allow extending this class without breaking binary compatibility.
+ The actual behavior and format of \a data depends on \a id argument
+ which must be defined if the class is to be extended with another virtual
+ function.
+ Currently, this is unused.
+*/
+void QAccessibleInterface::virtual_hook(int /*id*/, void * /*data*/)
+{
+}
+
+/*!
+ \fn void *QAccessibleInterface::interface_cast(QAccessible::InterfaceType type)
+
+ \brief Returns a specialized accessibility interface \a type from the generic QAccessibleInterface.
+
+ This function must be reimplemented when providing more information about a widget or object through the
+ specialized interfaces. For example a line edit should implement the QAccessibleTextInterface and QAccessibleEditableTextInterface.
+
+ Qt's QLineEdit for example has its accessibility support implemented in QAccessibleLineEdit.
+ \code
+void *QAccessibleLineEdit::interface_cast(QAccessible::InterfaceType t)
+{
+ if (t == QAccessible::TextInterface)
+ return static_cast<QAccessibleTextInterface*>(this);
+ else if (t == QAccessible::EditableTextInterface)
+ return static_cast<QAccessibleEditableTextInterface*>(this);
+ return QAccessibleWidget::interface_cast(t);
+}
+ \endcode
+
+ \sa QAccessible::InterfaceType, QAccessibleTextInterface, QAccessibleEditableTextInterface, QAccessibleValueInterface, QAccessibleActionInterface, QAccessibleTableInterface, QAccessibleTableCellInterface
+ */
+
+/*! \internal */
+const char *qAccessibleRoleString(QAccessible::Role role)
+{
+ if (role >=0x40)
+ role = QAccessible::UserRole;
+ static int roleEnum = QAccessible::staticMetaObject.indexOfEnumerator("Role");
+ return QAccessible::staticMetaObject.enumerator(roleEnum).valueToKey(role);
+}
+
+/*! \internal */
+const char *qAccessibleEventString(QAccessible::Event event)
{
- Q_UNUSED(method)
- Q_UNUSED(params)
- return QVariant();
+ static int eventEnum = QAccessible::staticMetaObject.indexOfEnumerator("Event");
+ return QAccessible::staticMetaObject.enumerator(eventEnum).valueToKey(event);
}
-QVariant QAccessibleInterface::virtual_hook(const QVariant &)
+bool operator==(const QAccessible::State &first, const QAccessible::State &second)
{
- return QVariant();
+ return memcmp(&first, &second, sizeof(QAccessible::State)) == 0;
}
#ifndef QT_NO_DEBUG_STREAM
@@ -1214,14 +1245,13 @@ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface)
d << "QAccessibleInterface(" << hex << (void *) iface << dec;
if (iface->isValid()) {
d << " name=" << iface->text(QAccessible::Name) << " ";
- d << "role=" << iface->role() << " ";
+ d << "role=" << qAccessibleRoleString(iface->role()) << " ";
if (iface->childCount())
d << "childc=" << iface->childCount() << " ";
if (iface->object()) {
d << "obj=" << iface->object();
}
- bool invisible = iface->state() & QAccessible::Invisible;
- if (invisible) {
+ if (iface->state().invisible) {
d << "invisible";
} else {
d << "rect=" << iface->rect();
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 6ee1885a3d..bafd3a8a6b 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -148,45 +148,78 @@ public:
AcceleratorChanged = 0x80C0
};
+ // 64 bit enums seem hard on some platforms (windows...)
+ // which makes using a bit field a sensible alternative
+ struct State {
+ // http://msdn.microsoft.com/en-us/library/ms697270.aspx
+ quint64 disabled : 1; // used to be Unavailable
+ quint64 selected : 1;
+ quint64 focusable : 1;
+ quint64 focused : 1;
+ quint64 pressed : 1;
+ quint64 checkable : 1;
+ quint64 checked : 1;
+ quint64 checkStateMixed : 1; // used to be Mixed
+ quint64 readOnly : 1;
+ quint64 hotTracked : 1;
+ quint64 defaultButton : 1;
+ quint64 expanded : 1;
+ quint64 collapsed : 1;
+ quint64 busy : 1;
+ quint64 expandable : 1;
+ quint64 marqueed : 1;
+ quint64 animated : 1;
+ quint64 invisible : 1;
+ quint64 offscreen : 1;
+ quint64 sizeable : 1;
+ quint64 movable : 1;
+ quint64 selfVoicing : 1;
+ quint64 selectable : 1;
+ quint64 linked : 1;
+ quint64 traversed : 1;
+ quint64 multiSelectable : 1;
+ quint64 extSelectable : 1;
+ quint64 passwordEdit : 1; // used to be Protected
+ quint64 hasPopup : 1;
+ quint64 modal : 1;
+
+ // IA2 - we chose to not add some IA2 states for now
+ // Below the ones that seem helpful
+ quint64 active : 1;
+ quint64 invalid : 1; // = defunct
+ quint64 editable : 1;
+ quint64 multiLine : 1;
+ quint64 selectableText : 1;
+ quint64 supportsAutoCompletion : 1;
+
+ // quint64 horizontal : 1;
+ // quint64 vertical : 1;
+ // quint64 invalidEntry : 1;
+ // quint64 managesDescendants : 1;
+ // quint64 singleLine : 1; // we have multi line, this is redundant.
+ // quint64 stale : 1;
+ // quint64 transient : 1;
+ // quint64 pinned : 1;
+
+ // Apple - see http://mattgemmell.com/2010/12/19/accessibility-for-iphone-and-ipad-apps/
+ // quint64 playsSound : 1;
+ // quint64 summaryElement : 1;
+ // quint64 updatesFrequently : 1;
+ // quint64 adjustable : 1;
+ // more and not included here: http://developer.apple.com/library/mac/#documentation/UserExperience/Reference/Accessibility_RoleAttribute_Ref/Attributes.html
+
+ // MSAA
+ // quint64 alertLow : 1;
+ // quint64 alertMedium : 1;
+ // quint64 alertHigh : 1;
+
+ State() {
+ qMemSet(this, 0, sizeof(State));
+ }
+ };
+
- enum StateFlag {
- Normal = 0x00000000,
- Unavailable = 0x00000001,
- Selected = 0x00000002,
- Focused = 0x00000004,
- Pressed = 0x00000008,
- Checked = 0x00000010,
- Mixed = 0x00000020,
- ReadOnly = 0x00000040,
- HotTracked = 0x00000080,
- DefaultButton = 0x00000100,
- Expanded = 0x00000200,
- Collapsed = 0x00000400,
- Busy = 0x00000800,
- // Floating = 0x00001000,
- Expandable = 0x00001000,
- Marqueed = 0x00002000,
- Animated = 0x00004000,
- Invisible = 0x00008000,
- Offscreen = 0x00010000,
- Sizeable = 0x00020000,
- Movable = 0x00040000,
- SelfVoicing = 0x00080000,
- Focusable = 0x00100000,
- Selectable = 0x00200000,
- Linked = 0x00400000,
- Traversed = 0x00800000,
- MultiSelectable = 0x01000000,
- ExtSelectable = 0x02000000,
- //AlertLow = 0x04000000,
- //AlertMedium = 0x08000000,
- //AlertHigh = 0x10000000, /* reused for HasInvokeExtension */
- Protected = 0x20000000,
- HasPopup = 0x40000000,
- Modal = 0x80000000
- };
- Q_DECLARE_FLAGS(State, StateFlag)
enum Role {
@@ -274,16 +307,7 @@ public:
enum RelationFlag {
Unrelated = 0x00000000,
Self = 0x00000001,
- Ancestor = 0x00000002,
- Child = 0x00000004,
- Descendent = 0x00000008,
- Sibling = 0x00000010,
- HierarchyMask = 0x000000ff,
-
- Up = 0x00000100,
- Down = 0x00000200,
- Left = 0x00000400,
- Right = 0x00000800,
+
Covers = 0x00001000,
Covered = 0x00002000,
GeometryMask = 0x0000ff00,
@@ -297,12 +321,6 @@ public:
};
Q_DECLARE_FLAGS(Relation, RelationFlag)
- enum Method {
- ListSupportedMethods = 0,
- SetCursorPosition = 1,
- GetCursorPosition = 2
- };
-
enum InterfaceType
{
TextInterface,
@@ -324,9 +342,9 @@ public:
static RootObjectHandler installRootObjectHandler(RootObjectHandler);
static QAccessibleInterface *queryAccessibleInterface(QObject *);
- static void updateAccessibility(QObject *, int who, Event reason);
+ static void updateAccessibility(QObject *object, int child, Event reason);
static bool isActive();
- static void setRootObject(QObject*);
+ static void setRootObject(QObject *object);
static void cleanup();
@@ -341,11 +359,9 @@ private:
QAccessible() {}
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QAccessible::State)
+Q_GUI_EXPORT bool operator==(const QAccessible::State &first, const QAccessible::State &second);
+
Q_DECLARE_OPERATORS_FOR_FLAGS(QAccessible::Relation)
-QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QSet<QAccessible::Method>)
-QT_BEGIN_NAMESPACE
class QAccessible2Interface;
class QAccessibleTextInterface;
@@ -369,7 +385,7 @@ public:
virtual QAccessible::Relation relationTo(const QAccessibleInterface *other) const;
virtual QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > relations() const;
- virtual int childAt(int x, int y) const = 0;
+ virtual QAccessibleInterface *childAt(int x, int y) const = 0;
// navigation, hierarchy
virtual QAccessibleInterface *parent() const = 0;
@@ -384,16 +400,10 @@ public:
virtual QRect rect() const = 0;
virtual QAccessible::Role role() const = 0;
virtual QAccessible::State state() const = 0;
- // FIXME virtual QSet<QAccessible::State> states() const = 0;
virtual QColor foregroundColor() const;
virtual QColor backgroundColor() const;
- virtual QVariant invokeMethod(QAccessible::Method method, const QVariantList &params = QVariantList());
-
- inline QSet<QAccessible::Method> supportedMethods()
- { return qvariant_cast<QSet<QAccessible::Method> >(invokeMethod(QAccessible::ListSupportedMethods)); }
-
inline QAccessibleTextInterface *textInterface()
{ return reinterpret_cast<QAccessibleTextInterface *>(interface_cast(QAccessible::TextInterface)); }
@@ -415,30 +425,19 @@ public:
inline QAccessibleTableCellInterface *tableCellInterface()
{ return reinterpret_cast<QAccessibleTableCellInterface *>(interface_cast(QAccessible::TableCellInterface)); }
- // FIXME
- virtual QVariant virtual_hook(const QVariant &data);
+ virtual void virtual_hook(int id, void *data);
+
virtual void *interface_cast(QAccessible::InterfaceType)
{ return 0; }
private:
};
-class QAccessibleEvent : public QEvent
-{
-public:
- inline QAccessibleEvent(Type type);
- inline QString value() const { return val; }
- inline void setValue(const QString &aText) { val = aText; }
-
-private:
- QString val;
-};
-
-inline QAccessibleEvent::QAccessibleEvent(Type atype)
- : QEvent(atype) {}
-
#define QAccessibleInterface_iid "com.trolltech.Qt.QAccessibleInterface"
Q_DECLARE_INTERFACE(QAccessibleInterface, QAccessibleInterface_iid)
+Q_GUI_EXPORT const char *qAccessibleRoleString(QAccessible::Role role);
+Q_GUI_EXPORT const char *qAccessibleEventString(QAccessible::Event event);
+
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface);
#endif
diff --git a/src/gui/accessible/qaccessible2.cpp b/src/gui/accessible/qaccessible2.cpp
index d8bebdc697..0a7a8b0b6f 100644
--- a/src/gui/accessible/qaccessible2.cpp
+++ b/src/gui/accessible/qaccessible2.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -51,8 +51,6 @@ QT_BEGIN_NAMESPACE
/*!
\namespace QAccessible2
\ingroup accessibility
- \internal
- \preliminary
\brief The QAccessible2 namespace defines constants relating to
IAccessible2-based interfaces
@@ -64,35 +62,196 @@ QT_BEGIN_NAMESPACE
\class QAccessibleTextInterface
\ingroup accessibility
- \internal
- \preliminary
- \brief The QAccessibleTextInterface class implements support for
- the IAccessibleText interface.
+ \brief The QAccessibleTextInterface class implements support for text handling.
+
+ This interface corresponds to the IAccessibleText interface.
+ It should be implemented for widgets that display more text than a plain label.
+ Labels should be represented by only \l QAccessibleInterface
+ and return their text as name (\l QAccessibleInterface::text() with \l QAccessible::Name as type).
+ The QAccessibleTextInterface is typically for text that a screen reader
+ might want to read line by line, and for widgets that support text selection and input.
+ This interface is, for example, implemented for QLineEdit.
+ Editable text objects should also implement \l QAccessibleEditableTextInterface.
\link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
*/
/*!
+ \fn QAccessibleTextInterface::~QAccessibleTextInterface()
+ Destructor.
+*/
+
+/*!
+ \fn void QAccessibleTextInterface::addSelection(int startOffset, int endOffset)
+ Select the text from \a startOffset to \a endOffset.
+ The \a startOffset is the first character that will be selected.
+ The \a endOffset is the first character that will not be selected.
+
+ When the object supports multiple selections (e.g. in a word processor),
+ this adds a new selection, otherwise it replaces the previous selection.
+
+ The selection will be \a endOffset - \a startOffset characters long.
+*/
+
+/*!
+ \fn QString QAccessibleTextInterface::attributes(int offset, int *startOffset, int *endOffset) const
+*/
+
+/*!
+ \fn int QAccessibleTextInterface::cursorPosition() const
+
+ Returns the current cursor position.
+*/
+
+/*!
+ \fn QRect QAccessibleTextInterface::characterRect(int offset, QAccessible2::CoordinateType coordType) const
+*/
+
+/*!
+ \fn int QAccessibleTextInterface::selectionCount() const
+
+ Returns the number of selections in this text.
+*/
+
+/*!
+ \fn int QAccessibleTextInterface::offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType) const
+*/
+
+/*!
+ \fn void QAccessibleTextInterface::selection(int selectionIndex, int *startOffset, int *endOffset) const
+*/
+
+/*!
+ \fn QString QAccessibleTextInterface::text(int startOffset, int endOffset) const
+
+ Returns the text from \a startOffset to \a endOffset.
+ The \a startOffset is the first character that will be returned.
+ The \a endOffset is the first character that will not be returned.
+*/
+
+/*!
+ \fn QString QAccessibleTextInterface::textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset) const
+*/
+
+/*!
+ \fn QString QAccessibleTextInterface::textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset) const
+*/
+
+/*!
+ \fn QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset) const
+*/
+
+/*!
+ \fn void QAccessibleTextInterface::removeSelection(int selectionIndex)
+
+ Clears the selection with \a index selectionIndex.
+*/
+
+/*!
+ \fn void QAccessibleTextInterface::setCursorPosition(int position)
+
+ Moves the cursor to \a position.
+*/
+
+/*!
+ \fn void QAccessibleTextInterface::setSelection(int selectionIndex, int startOffset, int endOffset)
+
+ Set the selection \a selectionIndex to the range from \a startOffset to \a endOffset.
+
+ \sa addSelection(), removeSelection()
+*/
+
+/*!
+ \fn int QAccessibleTextInterface::characterCount() const
+
+ Returns the lenght of the text (total size including spaces).
+*/
+
+/*!
+ \fn void QAccessibleTextInterface::scrollToSubstring(int startIndex, int endIndex)
+
+ Ensures that the text between \a startIndex and \a endIndex is visible.
+*/
+
+/*!
\class QAccessibleEditableTextInterface
\ingroup accessibility
- \internal
- \preliminary
- \brief The QAccessibleEditableTextInterface class implements support for
- the IAccessibleEditableText interface.
+ \brief The QAccessibleEditableTextInterface class implements support for objects with editable text.
+
+ When implementing this interface you will almost certainly also want to implement \l QAccessibleTextInterface.
+
+ Since this interface can be implemented by means of the normal \l QAccessibleTextInterface,
+ \l QAccessibleSimpleEditableTextInterface provides a convenience implementation of this interface.
+ Consider inheriting \l QAccessibleSimpleEditableTextInterface instead.
+
+ \sa QAccessibleInterface
\link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
*/
/*!
+ \fn QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface()
+
+
+*/
+
+/*!
+ \fn void QAccessibleEditableTextInterface::copyText(int startOffset, int endOffset) const
+
+ Copies the text from \a startOffset to \a endOffset to the system clip board.
+ The \a startOffset is the first character that will be copied.
+ The \a endOffset is the first character that will not be copied.
+*/
+
+/*!
+ \fn void QAccessibleEditableTextInterface::deleteText(int startOffset, int endOffset)
+
+ Deletes the text from \a startOffset to \a endOffset.
+*/
+
+/*!
+ \fn void QAccessibleEditableTextInterface::insertText(int offset, const QString &text)
+
+ Inserts \a text at position \a offset.
+*/
+
+/*!
+ \fn void QAccessibleEditableTextInterface::cutText(int startOffset, int endOffset)
+
+ Removes the text from \a startOffset to \a endOffset and puts it in the system clip board.
+*/
+
+/*!
+ \fn void QAccessibleEditableTextInterface::pasteText(int offset)
+
+ Pastes text from the system clip board at the position \a offset.
+*/
+
+/*!
+ \fn void QAccessibleEditableTextInterface::replaceText(int startOffset, int endOffset, const QString &text)
+
+ Removes the text from \a startOffset to \a endOffset and instead inserts \a text.
+*/
+
+/*!
+ \fn void QAccessibleEditableTextInterface::setAttributes(int startOffset, int endOffset, const QString &attributes)
+
+ \sa QAccessibleTextInterface::attributes()
+*/
+
+/*!
\class QAccessibleSimpleEditableTextInterface
\ingroup accessibility
- \internal
- \preliminary
\brief The QAccessibleSimpleEditableTextInterface class is a convenience class for
- text-based widgets.
+ text-based widgets. It can be inherited instead of \l QAccessibleEditableTextInterface.
+
+ \sa QAccessibleInterface, QAccessibleEditableTextInterface
\link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
*/
@@ -100,16 +259,56 @@ QT_BEGIN_NAMESPACE
/*!
\class QAccessibleValueInterface
\ingroup accessibility
- \internal
- \preliminary
- \brief The QAccessibleValueInterface class implements support for
- the IAccessibleValue interface.
+ \brief The QAccessibleValueInterface class implements support for objects that manipulate a value.
+
+ This interface should be implemented by accessible objects that represent a value.
+ Examples are spinner, slider, dial and scroll bar.
+
+ Instead of forcing the user to deal with the individual parts of the widgets, this interface
+ gives an easier approach to the kind of widget it represents.
+
+ Usually this interface is implemented by classes that also implement \l QAccessibleInterface.
\link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
*/
/*!
+ \fn QAccessibleValueInterface::~QAccessibleValueInterface()
+ Destructor.
+*/
+
+/*!
+ \fn QVariant QAccessibleValueInterface::currentValue() const
+
+ Returns the current value of the widget. This is usually a double or int.
+ \sa setCurrentValue()
+*/
+
+/*!
+ \fn void QAccessibleValueInterface::setCurrentValue(const QVariant &value)
+
+ Sets the \a value. If the desired \a value is out of the range of permissible values,
+ this call will be ignored.
+
+ \sa currentValue(), minimumValue(), maximumValue()
+*/
+
+/*!
+ \fn QVariant QAccessibleValueInterface::maximumValue() const
+
+ Returns the maximum value this object accepts.
+ \sa minimumValue(), currentValue()
+*/
+
+/*!
+ \fn QVariant QAccessibleValueInterface::minimumValue() const
+
+ Returns the minimum value this object accepts.
+ \sa maximumValue(), currentValue()
+*/
+
+/*!
\class QAccessibleImageInterface
\ingroup accessibility
\internal
@@ -122,27 +321,62 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \class QAccessibleTableCellInterface
+ \ingroup accessibility
+
+ \brief The QAccessibleTableCellInterface class implements support for
+ the IAccessibleTable2 Cell interface.
+
+ \link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
+*/
+
+/*!
+ \class QAccessibleTableInterface
+ \ingroup accessibility
+
+ \brief The QAccessibleTableInterface class implements support for
+ the IAccessibleTable2 interface.
+
+ \link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
+*/
+
+
+/*!
\class QAccessibleActionInterface
\ingroup accessibility
- \internal
- \preliminary
\brief The QAccessibleActionInterface class implements support for
invocable actions in the interface.
- Each accessible should implement the action interface if it supports any actions.
- The supported actions should adhere to the naming scheme inside the QAccessible2 namespace.
- Custom actions can be added.
+ Accessible objects should implement the action interface if they support user interaction.
+ Usually this interface is implemented by classes that also implement \l QAccessibleInterface.
+
+ The supported actions should use the predefined actions offered in this class unless they do not
+ fit a predefined action. In that case a custom action can be added.
When subclassing QAccessibleActionInterface you need to provide a list of actionNames which
is the primary means to discover the available actions. Action names are never localized.
In order to present actions to the user there are two functions that need to return localized versions
- of the name and give a description of the action.
-
- In order to invoke the action, doAction is called with an action name.
-
- Most widgets will simply implement the PressAction. This is what happens when the widget is activated by
- being clicked on, space pressed or similar.
+ of the name and give a description of the action. For the predefined action names use
+ \l QAccessibleActionInterface::localizedActionName() and \l QAccessibleActionInterface::localizedActionDescription()
+ to return their localized counterparts.
+
+ In general you should use one of the predefined action names, unless describing an action that does not fit these:
+ \table
+ \header \o Action name \o Description
+ \row \o \l checkAction() \o checks the item (checkbox, radio button, ...)
+ \row \o \l decreaseAction() \o decrease the value of the accessible (e.g. spinbox)
+ \row \o \l increaseAction() \o increase the value of the accessible (e.g. spinbox)
+ \row \o \l pressAction() \o press or click or activate the accessible (should correspont to clicking the object with the mouse)
+ \row \o \l setFocusAction() \o set the focus to this accessible
+ \row \o \l showMenuAction() \o show a context menu, corresponds to right-clicks
+ \row \o \l uncheckAction() \o uncheck the item (checkbox, radio button, ...)
+ \endtable
+
+ In order to invoke the action, \l doAction() is called with an action name.
+
+ Most widgets will simply implement \l pressAction(). This is what happens when the widget is activated by
+ being clicked, space pressed or similar.
\link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
*/
@@ -150,42 +384,52 @@ QT_BEGIN_NAMESPACE
/*!
\fn QStringList QAccessibleActionInterface::actionNames() const
- Returns a list of valid actions. The actions returned should be in preferred order,
+ Returns the list of actions supported by this accessible object.
+ The actions returned should be in preferred order,
i.e. the action that the user most likely wants to trigger should be returned first,
while the least likely action should be returned last.
- The list does only contain actions that *can* be invoked. Therefore it,
- won't return disabled actions, or actions associated with disabled UI
- controls.
+ The list does only contain actions that can be invoked.
+ It won't return disabled actions, or actions associated with disabled UI controls.
- The list can also be empty.
+ The list can be empty.
- \sa localizedActionName(), doAction()
+ Note that this list is not localized. For a localized representation re-implement \l localizedActionName()
+ and \l localizedActionDescription()
+
+ \sa doAction(), localizedActionName(), localizedActionDescription()
*/
/*!
- \fn QString QAccessibleActionInterface::localizedActionName(const QString &name) const
+ \fn QString QAccessibleActionInterface::localizedActionName(const QString &actionName) const
+
+ Returns a localized action name of \a actionName.
- Returns a localized action name of \a name.
+ For custom actions this function has to be re-implemented.
+ When using one of the default names, you can call this function in QAccessibleActionInterface
+ to get the localized string.
\sa actionNames(), localizedActionDescription()
*/
/*!
- \fn QString QAccessibleActionInterface::localizedActionDescription(const QString &name) const
+ \fn QString QAccessibleActionInterface::localizedActionDescription(const QString &actionName) const
- Returns a localized action description of \a name.
+ Returns a localized action description of the action \a actionName.
- This is what should be presented to the user. The actionNames should always
- be untranslated to make them consistent for screen readers.
+ When using one of the default names, you can call this function in QAccessibleActionInterface
+ to get the localized string.
\sa actionNames(), localizedActionName()
*/
/*!
- \fn void QAccessibleActionInterface::doAction(const QString &actionName) const
+ \fn void QAccessibleActionInterface::doAction(const QString &actionName)
- Invokes the action specified by \a actionName
+ Invokes the action specified by \a actionName.
+ Note that \a actionName is the non-localized name as returned by \l actionNames()
+ This function is usually implemented by calling the same functions
+ that other user interaction, such as clicking the object, would trigger.
\sa actionNames()
*/
@@ -193,11 +437,14 @@ QT_BEGIN_NAMESPACE
/*!
\fn QStringList QAccessibleActionInterface::keyBindingsForAction(const QString &actionName) const
- Returns a list of the keyboard shortcuts available for invoking the action named \a actionName
+ Returns a list of the keyboard shortcuts available for invoking the action named \a actionName.
+
+ This is important to let users learn alternative ways of using the application by emphasizing the keyboard.
\sa actionNames()
*/
+
struct QAccessibleActionStrings
{
QAccessibleActionStrings() :
@@ -246,36 +493,64 @@ QString QAccessibleActionInterface::localizedActionDescription(const QString &ac
return QString();
}
+/*!
+ Returns the name of the press default action.
+ \sa actionNames(), localizedActionName()
+ */
const QString &QAccessibleActionInterface::pressAction()
{
return accessibleActionStrings()->pressAction;
}
+/*!
+ Returns the name of the increase default action.
+ \sa actionNames(), localizedActionName()
+ */
const QString &QAccessibleActionInterface::increaseAction()
{
return accessibleActionStrings()->increaseAction;
}
+/*!
+ Returns the name of the decrease default action.
+ \sa actionNames(), localizedActionName()
+ */
const QString &QAccessibleActionInterface::decreaseAction()
{
return accessibleActionStrings()->decreaseAction;
}
+/*!
+ Returns the name of the show menu default action.
+ \sa actionNames(), localizedActionName()
+ */
const QString &QAccessibleActionInterface::showMenuAction()
{
return accessibleActionStrings()->showMenuAction;
}
+/*!
+ Returns the name of the set focus default action.
+ \sa actionNames(), localizedActionName()
+ */
const QString &QAccessibleActionInterface::setFocusAction()
{
return accessibleActionStrings()->setFocusAction;
}
+/*!
+ Returns the name of the check default action.
+ \sa actionNames(), localizedActionName()
+ */
const QString &QAccessibleActionInterface::checkAction()
{
return accessibleActionStrings()->checkAction;
}
+/*!
+ Returns the name of the uncheck default action.
+ \sa actionNames(), localizedActionName()
+ */
const QString &QAccessibleActionInterface::uncheckAction()
{
return accessibleActionStrings()->uncheckAction;
@@ -405,7 +680,8 @@ static QString textForRange(QAccessibleInterface *iface, int startOffset, int en
}
#endif
-void QAccessibleSimpleEditableTextInterface::copyText(int startOffset, int endOffset)
+/*! \reimp */
+void QAccessibleSimpleEditableTextInterface::copyText(int startOffset, int endOffset) const
{
#ifdef QT_NO_CLIPBOARD
Q_UNUSED(startOffset);
@@ -415,6 +691,7 @@ void QAccessibleSimpleEditableTextInterface::copyText(int startOffset, int endOf
#endif
}
+/*! \reimp */
void QAccessibleSimpleEditableTextInterface::deleteText(int startOffset, int endOffset)
{
QString txt = iface->text(QAccessible::Value);
@@ -422,6 +699,7 @@ void QAccessibleSimpleEditableTextInterface::deleteText(int startOffset, int end
iface->setText(QAccessible::Value, txt);
}
+/*! \reimp */
void QAccessibleSimpleEditableTextInterface::insertText(int offset, const QString &text)
{
QString txt = iface->text(QAccessible::Value);
@@ -429,6 +707,7 @@ void QAccessibleSimpleEditableTextInterface::insertText(int offset, const QStrin
iface->setText(QAccessible::Value, txt);
}
+/*! \reimp */
void QAccessibleSimpleEditableTextInterface::cutText(int startOffset, int endOffset)
{
#ifdef QT_NO_CLIPBOARD
@@ -441,6 +720,7 @@ void QAccessibleSimpleEditableTextInterface::cutText(int startOffset, int endOff
#endif
}
+/*! \reimp */
void QAccessibleSimpleEditableTextInterface::pasteText(int offset)
{
#ifdef QT_NO_CLIPBOARD
@@ -452,6 +732,7 @@ void QAccessibleSimpleEditableTextInterface::pasteText(int offset)
#endif
}
+/*! \reimp */
void QAccessibleSimpleEditableTextInterface::replaceText(int startOffset, int endOffset, const QString &text)
{
QString txt = iface->text(QAccessible::Value);
diff --git a/src/gui/accessible/qaccessible2.h b/src/gui/accessible/qaccessible2.h
index 93db869364..0b1ddc99b1 100644
--- a/src/gui/accessible/qaccessible2.h
+++ b/src/gui/accessible/qaccessible2.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -97,23 +97,23 @@ public:
virtual ~QAccessibleTextInterface() {}
virtual void addSelection(int startOffset, int endOffset) = 0;
- virtual QString attributes(int offset, int *startOffset, int *endOffset) = 0;
- virtual int cursorPosition() = 0;
- virtual QRect characterRect(int offset, QAccessible2::CoordinateType coordType) = 0;
- virtual int selectionCount() = 0;
- virtual int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType) = 0;
- virtual void selection(int selectionIndex, int *startOffset, int *endOffset) = 0;
- virtual QString text(int startOffset, int endOffset) = 0;
+ virtual QString attributes(int offset, int *startOffset, int *endOffset) const = 0;
+ virtual int cursorPosition() const = 0;
+ virtual QRect characterRect(int offset, QAccessible2::CoordinateType coordType) const = 0;
+ virtual int selectionCount() const = 0;
+ virtual int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType) const = 0;
+ virtual void selection(int selectionIndex, int *startOffset, int *endOffset) const = 0;
+ virtual QString text(int startOffset, int endOffset) const = 0;
virtual QString textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset) = 0;
+ int *startOffset, int *endOffset) const = 0;
virtual QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset) = 0;
+ int *startOffset, int *endOffset) const = 0;
virtual QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset) = 0;
+ int *startOffset, int *endOffset) const = 0;
virtual void removeSelection(int selectionIndex) = 0;
virtual void setCursorPosition(int position) = 0;
virtual void setSelection(int selectionIndex, int startOffset, int endOffset) = 0;
- virtual int characterCount() = 0;
+ virtual int characterCount() const = 0;
virtual void scrollToSubstring(int startIndex, int endIndex) = 0;
};
@@ -122,7 +122,7 @@ class Q_GUI_EXPORT QAccessibleEditableTextInterface
public:
virtual ~QAccessibleEditableTextInterface() {}
- virtual void copyText(int startOffset, int endOffset) = 0;
+ virtual void copyText(int startOffset, int endOffset) const = 0;
virtual void deleteText(int startOffset, int endOffset) = 0;
virtual void insertText(int offset, const QString &text) = 0;
virtual void cutText(int startOffset, int endOffset) = 0;
@@ -136,7 +136,7 @@ class Q_GUI_EXPORT QAccessibleSimpleEditableTextInterface: public QAccessibleEdi
public:
QAccessibleSimpleEditableTextInterface(QAccessibleInterface *accessibleInterface); //###
- void copyText(int startOffset, int endOffset);
+ void copyText(int startOffset, int endOffset) const;
void deleteText(int startOffset, int endOffset);
void insertText(int offset, const QString &text);
void cutText(int startOffset, int endOffset);
@@ -154,15 +154,17 @@ public:
virtual ~QAccessibleValueInterface() {}
- virtual QVariant currentValue() = 0;
+ virtual QVariant currentValue() const = 0;
virtual void setCurrentValue(const QVariant &value) = 0;
- virtual QVariant maximumValue() = 0;
- virtual QVariant minimumValue() = 0;
+ virtual QVariant maximumValue() const = 0;
+ virtual QVariant minimumValue() const = 0;
};
class Q_GUI_EXPORT QAccessibleTableCellInterface
{
public:
+ virtual ~QAccessibleTableCellInterface() {}
+
// Returns the number of columns occupied by this cell accessible.
virtual int columnExtent() const = 0;
@@ -189,6 +191,7 @@ public:
class Q_GUI_EXPORT QAccessibleTableInterface
{
public:
+ virtual ~QAccessibleTableInterface() {}
// Returns the cell at the specified row and column in the table.
virtual QAccessibleInterface *cellAt (int row, int column) const = 0;
@@ -249,6 +252,7 @@ class Q_GUI_EXPORT QAccessibleActionInterface
{
Q_DECLARE_TR_FUNCTIONS(QAccessibleActionInterface)
public:
+ virtual ~QAccessibleActionInterface() {}
virtual QStringList actionNames() const = 0;
virtual QString localizedActionName(const QString &name) const;
@@ -268,10 +272,11 @@ public:
class Q_GUI_EXPORT QAccessibleImageInterface
{
public:
+ virtual ~QAccessibleImageInterface() {}
- virtual QString imageDescription() = 0;
- virtual QSize imageSize() = 0;
- virtual QRect imagePosition(QAccessible2::CoordinateType coordType) = 0;
+ virtual QString imageDescription() const = 0;
+ virtual QSize imageSize() const = 0;
+ virtual QRect imagePosition(QAccessible2::CoordinateType coordType) const = 0;
};
#endif // QT_NO_ACCESSIBILITY
diff --git a/src/gui/accessible/qaccessible_mac.mm b/src/gui/accessible/qaccessible_mac.mm
deleted file mode 100644
index a250730493..0000000000
--- a/src/gui/accessible/qaccessible_mac.mm
+++ /dev/null
@@ -1,2469 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qaccessible.h"
-
-#ifndef QT_NO_ACCESSIBILITY
-#include "qaccessible_mac_p.h"
-#include "qhash.h"
-#include "qset.h"
-#include "qpointer.h"
-#include "qapplication.h"
-#include "qmainwindow.h"
-#include "qtextdocument.h"
-#include "qdebug.h"
-#include "qabstractslider.h"
-#include "qsplitter.h"
-#include "qtabwidget.h"
-#include "qlistview.h"
-#include "qtableview.h"
-#include "qdockwidget.h"
-
-#include <private/qt_mac_p.h>
-#include <private/qwidget_p.h>
-#include <CoreFoundation/CoreFoundation.h>
-
-QT_BEGIN_NAMESPACE
-
-/*
- Set up platform defines. There is a one-to-one correspondence between the
- Carbon and Cocoa roles and attributes, but the prefix and type changes.
-*/
-#ifdef QT_MAC_USE_COCOA
-typedef NSString * const QAXRoleType;
-#define QAXApplicationRole NSAccessibilityApplicationRole
-#define QAXButtonRole NSAccessibilityButtonRole
-#define QAXCancelAction NSAccessibilityCancelAction
-#define QAXCheckBoxRole NSAccessibilityCheckBoxRole
-#define QAXChildrenAttribute NSAccessibilityChildrenAttribute
-#define QAXCloseButtonAttribute NSAccessibilityCloseButtonAttribute
-#define QAXCloseButtonAttribute NSAccessibilityCloseButtonAttribute
-#define QAXColumnRole NSAccessibilityColumnRole
-#define QAXConfirmAction NSAccessibilityConfirmAction
-#define QAXContentsAttribute NSAccessibilityContentsAttribute
-#define QAXDecrementAction NSAccessibilityDecrementAction
-#define QAXDecrementArrowSubrole NSAccessibilityDecrementArrowSubrole
-#define QAXDecrementPageSubrole NSAccessibilityDecrementPageSubrole
-#define QAXDescriptionAttribute NSAccessibilityDescriptionAttribute
-#define QAXEnabledAttribute NSAccessibilityEnabledAttribute
-#define QAXExpandedAttribute NSAccessibilityExpandedAttribute
-#define QAXFocusedAttribute NSAccessibilityFocusedAttribute
-#define QAXFocusedUIElementChangedNotification NSAccessibilityFocusedUIElementChangedNotification
-#define QAXFocusedWindowChangedNotification NSAccessibilityFocusedWindowChangedNotification
-#define QAXGroupRole NSAccessibilityGroupRole
-#define QAXGrowAreaAttribute NSAccessibilityGrowAreaAttribute
-#define QAXGrowAreaRole NSAccessibilityGrowAreaRole
-#define QAXHelpAttribute NSAccessibilityHelpAttribute
-#define QAXHorizontalOrientationValue NSAccessibilityHorizontalOrientationValue
-#define QAXHorizontalScrollBarAttribute NSAccessibilityHorizontalScrollBarAttribute
-#define QAXIncrementAction NSAccessibilityIncrementAction
-#define QAXIncrementArrowSubrole NSAccessibilityIncrementArrowSubrole
-#define QAXIncrementPageSubrole NSAccessibilityIncrementPageSubrole
-#define QAXIncrementorRole NSAccessibilityIncrementorRole
-#define QAXLinkedUIElementsAttribute NSAccessibilityLinkedUIElementsAttribute
-#define QAXListRole NSAccessibilityListRole
-#define QAXMainAttribute NSAccessibilityMainAttribute
-#define QAXMaxValueAttribute NSAccessibilityMaxValueAttribute
-#define QAXMenuBarRole NSAccessibilityMenuBarRole
-#define QAXMenuButtonRole NSAccessibilityMenuButtonRole
-#define QAXMenuClosedNotification NSAccessibilityMenuClosedNotification
-#define QAXMenuItemRole NSAccessibilityMenuItemRole
-#define QAXMenuOpenedNotification NSAccessibilityMenuOpenedNotification
-#define QAXMenuRole NSAccessibilityMenuRole
-#define QAXMinValueAttribute NSAccessibilityMinValueAttribute
-#define QAXMinimizeButtonAttribute NSAccessibilityMinimizeButtonAttribute
-#define QAXMinimizedAttribute NSAccessibilityMinimizedAttribute
-#define QAXNextContentsAttribute NSAccessibilityNextContentsAttribute
-#define QAXOrientationAttribute NSAccessibilityOrientationAttribute
-#define QAXParentAttribute NSAccessibilityParentAttribute
-#define QAXPickAction NSAccessibilityPickAction
-#define QAXPopUpButtonRole NSAccessibilityPopUpButtonRole
-#define QAXPositionAttribute NSAccessibilityPositionAttribute
-#define QAXPressAction NSAccessibilityPressAction
-#define QAXPreviousContentsAttribute NSAccessibilityPreviousContentsAttribute
-#define QAXProgressIndicatorRole NSAccessibilityProgressIndicatorRole
-#define QAXRadioButtonRole NSAccessibilityRadioButtonRole
-#define QAXRoleAttribute NSAccessibilityRoleAttribute
-#define QAXRoleDescriptionAttribute NSAccessibilityRoleDescriptionAttribute
-#define QAXRowRole NSAccessibilityRowRole
-#define QAXRowsAttribute NSAccessibilityRowsAttribute
-#define QAXScrollAreaRole NSAccessibilityScrollAreaRole
-#define QAXScrollBarRole NSAccessibilityScrollBarRole
-#define QAXSelectedAttribute NSAccessibilitySelectedAttribute
-#define QAXSelectedChildrenAttribute NSAccessibilitySelectedChildrenAttribute
-#define QAXSelectedRowsAttribute NSAccessibilitySelectedRowsAttribute
-#define QAXSizeAttribute NSAccessibilitySizeAttribute
-#define QAXSliderRole NSAccessibilitySliderRole
-#define QAXSplitGroupRole NSAccessibilitySplitGroupRole
-#define QAXSplitterRole NSAccessibilitySplitterRole
-#define QAXSplittersAttribute NSAccessibilitySplittersAttribute
-#define QAXStaticTextRole NSAccessibilityStaticTextRole
-#define QAXSubroleAttribute NSAccessibilitySubroleAttribute
-#define QAXSubroleAttribute NSAccessibilitySubroleAttribute
-#define QAXTabGroupRole NSAccessibilityTabGroupRole
-#define QAXTableRole NSAccessibilityTableRole
-#define QAXTabsAttribute NSAccessibilityTabsAttribute
-#define QAXTextFieldRole NSAccessibilityTextFieldRole
-#define QAXTitleAttribute NSAccessibilityTitleAttribute
-#define QAXTitleUIElementAttribute NSAccessibilityTitleUIElementAttribute
-#define QAXToolbarButtonAttribute NSAccessibilityToolbarButtonAttribute
-#define QAXToolbarRole NSAccessibilityToolbarRole
-#define QAXTopLevelUIElementAttribute NSAccessibilityTopLevelUIElementAttribute
-#define QAXUnknownRole NSAccessibilityUnknownRole
-#define QAXValueAttribute NSAccessibilityValueAttribute
-#define QAXValueChangedNotification NSAccessibilityValueChangedNotification
-#define QAXValueIndicatorRole NSAccessibilityValueIndicatorRole
-#define QAXVerticalOrientationValue NSAccessibilityVerticalOrientationValue
-#define QAXVerticalScrollBarAttribute NSAccessibilityVerticalScrollBarAttribute
-#define QAXVisibleRowsAttribute NSAccessibilityVisibleRowsAttribute
-#define QAXWindowAttribute NSAccessibilityWindowAttribute
-#define QAXWindowCreatedNotification NSAccessibilityWindowCreatedNotification
-#define QAXWindowMovedNotification NSAccessibilityWindowMovedNotification
-#define QAXWindowRole NSAccessibilityWindowRole
-#define QAXZoomButtonAttribute NSAccessibilityZoomButtonAttribute
-#else
-typedef CFStringRef const QAXRoleType;
-#define QAXApplicationRole kAXApplicationRole
-#define QAXButtonRole kAXButtonRole
-#define QAXCancelAction kAXCancelAction
-#define QAXCheckBoxRole kAXCheckBoxRole
-#define QAXChildrenAttribute kAXChildrenAttribute
-#define QAXCloseButtonAttribute kAXCloseButtonAttribute
-#define QAXColumnRole kAXColumnRole
-#define QAXConfirmAction kAXConfirmAction
-#define QAXContentsAttribute kAXContentsAttribute
-#define QAXDecrementAction kAXDecrementAction
-#define QAXDecrementArrowSubrole kAXDecrementArrowSubrole
-#define QAXDecrementPageSubrole kAXDecrementPageSubrole
-#define QAXDescriptionAttribute kAXDescriptionAttribute
-#define QAXEnabledAttribute kAXEnabledAttribute
-#define QAXExpandedAttribute kAXExpandedAttribute
-#define QAXFocusedAttribute kAXFocusedAttribute
-#define QAXFocusedUIElementChangedNotification kAXFocusedUIElementChangedNotification
-#define QAXFocusedWindowChangedNotification kAXFocusedWindowChangedNotification
-#define QAXGroupRole kAXGroupRole
-#define QAXGrowAreaAttribute kAXGrowAreaAttribute
-#define QAXGrowAreaRole kAXGrowAreaRole
-#define QAXHelpAttribute kAXHelpAttribute
-#define QAXHorizontalOrientationValue kAXHorizontalOrientationValue
-#define QAXHorizontalScrollBarAttribute kAXHorizontalScrollBarAttribute
-#define QAXIncrementAction kAXIncrementAction
-#define QAXIncrementArrowSubrole kAXIncrementArrowSubrole
-#define QAXIncrementPageSubrole kAXIncrementPageSubrole
-#define QAXIncrementorRole kAXIncrementorRole
-#define QAXLinkedUIElementsAttribute kAXLinkedUIElementsAttribute
-#define QAXListRole kAXListRole
-#define QAXMainAttribute kAXMainAttribute
-#define QAXMaxValueAttribute kAXMaxValueAttribute
-#define QAXMenuBarRole kAXMenuBarRole
-#define QAXMenuButtonRole kAXMenuButtonRole
-#define QAXMenuClosedNotification kAXMenuClosedNotification
-#define QAXMenuItemRole kAXMenuItemRole
-#define QAXMenuOpenedNotification kAXMenuOpenedNotification
-#define QAXMenuRole kAXMenuRole
-#define QAXMinValueAttribute kAXMinValueAttribute
-#define QAXMinimizeButtonAttribute kAXMinimizeButtonAttribute
-#define QAXMinimizedAttribute kAXMinimizedAttribute
-#define QAXNextContentsAttribute kAXNextContentsAttribute
-#define QAXOrientationAttribute kAXOrientationAttribute
-#define QAXParentAttribute kAXParentAttribute
-#define QAXPickAction kAXPickAction
-#define QAXPopUpButtonRole kAXPopUpButtonRole
-#define QAXPositionAttribute kAXPositionAttribute
-#define QAXPressAction kAXPressAction
-#define QAXPreviousContentsAttribute kAXPreviousContentsAttribute
-#define QAXProgressIndicatorRole kAXProgressIndicatorRole
-#define QAXRadioButtonRole kAXRadioButtonRole
-#define QAXRoleAttribute kAXRoleAttribute
-#define QAXRoleDescriptionAttribute kAXRoleDescriptionAttribute
-#define QAXRowRole kAXRowRole
-#define QAXRowsAttribute kAXRowsAttribute
-#define QAXScrollAreaRole kAXScrollAreaRole
-#define QAXScrollBarRole kAXScrollBarRole
-#define QAXSelectedAttribute kAXSelectedAttribute
-#define QAXSelectedChildrenAttribute kAXSelectedChildrenAttribute
-#define QAXSelectedRowsAttribute kAXSelectedRowsAttribute
-#define QAXSizeAttribute kAXSizeAttribute
-#define QAXSliderRole kAXSliderRole
-#define QAXSplitGroupRole kAXSplitGroupRole
-#define QAXSplitterRole kAXSplitterRole
-#define QAXSplittersAttribute kAXSplittersAttribute
-#define QAXStaticTextRole kAXStaticTextRole
-#define QAXSubroleAttribute kAXSubroleAttribute
-#define QAXTabGroupRole kAXTabGroupRole
-#define QAXTableRole kAXTableRole
-#define QAXTabsAttribute kAXTabsAttribute
-#define QAXTextFieldRole kAXTextFieldRole
-#define QAXTitleAttribute kAXTitleAttribute
-#define QAXTitleUIElementAttribute kAXTitleUIElementAttribute
-#define QAXToolbarButtonAttribute kAXToolbarButtonAttribute
-#define QAXToolbarRole kAXToolbarRole
-#define QAXTopLevelUIElementAttribute kAXTopLevelUIElementAttribute
-#define QAXUnknownRole kAXUnknownRole
-#define QAXValueAttribute kAXValueAttribute
-#define QAXValueChangedNotification kAXValueChangedNotification
-#define QAXValueIndicatorRole kAXValueIndicatorRole
-#define QAXVerticalOrientationValue kAXVerticalOrientationValue
-#define QAXVerticalScrollBarAttribute kAXVerticalScrollBarAttribute
-#define QAXVisibleRowsAttribute kAXVisibleRowsAttribute
-#define QAXWindowAttribute kAXWindowAttribute
-#define QAXWindowCreatedNotification kAXWindowCreatedNotification
-#define QAXWindowMovedNotification kAXWindowMovedNotification
-#define QAXWindowRole kAXWindowRole
-#define QAXZoomButtonAttribute kAXZoomButtonAttribute
-#endif
-
-
-/*****************************************************************************
- Externals
- *****************************************************************************/
-extern bool qt_mac_is_macsheet(const QWidget *w); //qwidget_mac.cpp
-extern bool qt_mac_is_macdrawer(const QWidget *w); //qwidget_mac.cpp
-
-/*****************************************************************************
- QAccessible Bindings
- *****************************************************************************/
-//hardcoded bindings between control info and (known) QWidgets
-struct QAccessibleTextBinding {
- int qt;
- QAXRoleType mac;
- bool settable;
-} text_bindings[][10] = {
- { { QAccessible::MenuItem, QAXMenuItemRole, false },
- { -1, 0, false }
- },
- { { QAccessible::MenuBar, QAXMenuBarRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ScrollBar, QAXScrollBarRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Grip, QAXGrowAreaRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Window, QAXWindowRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Dialog, QAXWindowRole, false },
- { -1, 0, false }
- },
- { { QAccessible::AlertMessage, QAXWindowRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ToolTip, QAXWindowRole, false },
- { -1, 0, false }
- },
- { { QAccessible::HelpBalloon, QAXWindowRole, false },
- { -1, 0, false }
- },
- { { QAccessible::PopupMenu, QAXMenuRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Application, QAXApplicationRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Pane, QAXGroupRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Grouping, QAXGroupRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Separator, QAXSplitterRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ToolBar, QAXToolbarRole, false },
- { -1, 0, false }
- },
- { { QAccessible::PageTab, QAXRadioButtonRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ButtonMenu, QAXMenuButtonRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ButtonDropDown, QAXPopUpButtonRole, false },
- { -1, 0, false }
- },
- { { QAccessible::SpinBox, QAXIncrementorRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Slider, QAXSliderRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ProgressBar, QAXProgressIndicatorRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ComboBox, QAXPopUpButtonRole, false },
- { -1, 0, false }
- },
- { { QAccessible::RadioButton, QAXRadioButtonRole, false },
- { -1, 0, false }
- },
- { { QAccessible::CheckBox, QAXCheckBoxRole, false },
- { -1, 0, false }
- },
- { { QAccessible::StaticText, QAXStaticTextRole, false },
- { QAccessible::Name, QAXValueAttribute, false },
- { -1, 0, false }
- },
- { { QAccessible::Table, QAXTableRole, false },
- { -1, 0, false }
- },
- { { QAccessible::StatusBar, QAXStaticTextRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Column, QAXColumnRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ColumnHeader, QAXColumnRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Row, QAXRowRole, false },
- { -1, 0, false }
- },
- { { QAccessible::RowHeader, QAXRowRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Cell, QAXTextFieldRole, false },
- { -1, 0, false }
- },
- { { QAccessible::PushButton, QAXButtonRole, false },
- { -1, 0, false }
- },
- { { QAccessible::EditableText, QAXTextFieldRole, true },
- { -1, 0, false }
- },
- { { QAccessible::Link, QAXTextFieldRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Indicator, QAXValueIndicatorRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Splitter, QAXSplitGroupRole, false },
- { -1, 0, false }
- },
- { { QAccessible::List, QAXListRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ListItem, QAXStaticTextRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Cell, QAXStaticTextRole, false },
- { -1, 0, false }
- },
- { { -1, 0, false } }
-};
-
-class QAInterface;
-static CFStringRef macRole(const QAInterface &interface);
-
-QDebug operator<<(QDebug debug, const QAInterface &interface)
-{
- if (interface.isValid() == false)
- debug << "invalid interface";
- else
- debug << interface.object() << "id" << interface.id() << "role" << hex << interface.role();
- return debug;
-}
-
-// The root of the Qt accessible hiearchy.
-static QObject *rootObject = 0;
-
-
-bool QAInterface::operator==(const QAInterface &other) const
-{
- if (isValid() == false || other.isValid() == false)
- return (isValid() && other.isValid());
-
- // walk up the parent chain, comparing child indexes, until we reach
- // an interface that has a QObject.
- QAInterface currentThis = *this;
- QAInterface currentOther = other;
-
- while (currentThis.object() == 0) {
- if (currentOther.object() != 0)
- return false;
-
- // fail if the child indexes in the two hirearchies don't match.
- if (currentThis.parent().indexOfChild(currentThis) !=
- currentOther.parent().indexOfChild(currentOther))
- return false;
-
- currentThis = currentThis.parent();
- currentOther = currentOther.parent();
- }
-
- return (currentThis.object() == currentOther.object() && currentThis.id() == currentOther.id());
-}
-
-bool QAInterface::operator!=(const QAInterface &other) const
-{
- return !operator==(other);
-}
-
-uint qHash(const QAInterface &item)
-{
- if (item.isValid())
- return qHash(item.object()) + qHash(item.id());
- else
- return qHash(item.cachedObject()) + qHash(item.id());
-}
-
-QAInterface QAInterface::navigate(RelationFlag relation, int entry) const
-{
- if (!checkValid())
- return QAInterface();
-
- // On a QAccessibleInterface that handles its own children we can short-circut
- // the navigation if this QAInterface refers to one of the children:
- if (child != 0) {
- // The Ancestor interface will always be the same QAccessibleInterface with
- // a child value of 0.
- if (relation == QAccessible::Ancestor)
- return QAInterface(*this, 0);
-
- // The child hiearchy is only one level deep, so navigating to a child
- // of a child is not possible.
- if (relation == QAccessible::Child) {
- return QAInterface();
- }
- }
- QAccessibleInterface *child_iface = 0;
-
- const int status = base.interface->navigate(relation, entry, &child_iface);
-
- if (status == -1)
- return QAInterface(); // not found;
-
- // Check if target is a child of this interface.
- if (!child_iface) {
- return QAInterface(*this, status);
- } else {
- // Target is child_iface or a child of that (status decides).
- return QAInterface(child_iface, status);
- }
-}
-
-QAElement::QAElement()
-:elementRef(0)
-{}
-
-QAElement::QAElement(AXUIElementRef elementRef)
-:elementRef(elementRef)
-{
- if (elementRef != 0) {
- CFRetain(elementRef);
- CFRetain(object());
- }
-}
-
-QAElement::QAElement(const QAElement &element)
-:elementRef(element.elementRef)
-{
- if (elementRef != 0) {
- CFRetain(elementRef);
- CFRetain(object());
- }
-}
-
-QAElement::QAElement(HIObjectRef object, int child)
-{
-#ifndef QT_MAC_USE_COCOA
- if (object == 0) {
- elementRef = 0; // Create invalid QAElement.
- } else {
- elementRef = AXUIElementCreateWithHIObjectAndIdentifier(object, child);
- CFRetain(object);
- }
-#else
- Q_UNUSED(object);
- Q_UNUSED(child);
-#endif
-}
-
-QAElement::~QAElement()
-{
- if (elementRef != 0) {
- CFRelease(object());
- CFRelease(elementRef);
- }
-}
-
-void QAElement::operator=(const QAElement &other)
-{
- if (*this == other)
- return;
-
- if (elementRef != 0) {
- CFRelease(object());
- CFRelease(elementRef);
- }
-
- elementRef = other.elementRef;
-
- if (elementRef != 0) {
- CFRetain(elementRef);
- CFRetain(object());
- }
-}
-
-bool QAElement::operator==(const QAElement &other) const
-{
- if (elementRef == 0 || other.elementRef == 0)
- return (elementRef == other.elementRef);
-
- return CFEqual(elementRef, other.elementRef);
-}
-
-uint qHash(QAElement element)
-{
- return qHash(element.object()) + qHash(element.id());
-}
-
-#ifndef QT_MAC_USE_COCOA
-static QInterfaceFactory *createFactory(const QAInterface &interface);
-#endif
-Q_GLOBAL_STATIC(QAccessibleHierarchyManager, accessibleHierarchyManager);
-
-/*
- Reomves all accessibility info accosiated with the sender object.
-*/
-void QAccessibleHierarchyManager::objectDestroyed(QObject *object)
-{
- HIObjectRef hiObject = qobjectHiobjectHash.value(object);
- delete qobjectElementHash.value(object);
- qobjectElementHash.remove(object);
- hiobjectInterfaceHash.remove(hiObject);
-}
-
-/*
- Removes all stored items.
-*/
-void QAccessibleHierarchyManager::reset()
-{
- qDeleteAll(qobjectElementHash);
- qobjectElementHash.clear();
- hiobjectInterfaceHash.clear();
- qobjectHiobjectHash.clear();
-}
-
-QAccessibleHierarchyManager *QAccessibleHierarchyManager::instance()
-{
- return accessibleHierarchyManager();
-}
-
-#ifndef QT_MAC_USE_COCOA
-static bool isItemView(const QAInterface &interface)
-{
- QObject *object = interface.object();
- return (interface.role() == QAccessible::List || interface.role() == QAccessible::Table
- || (object && qobject_cast<QAbstractItemView *>(interface.object()))
- || (object && object->objectName() == QLatin1String("qt_scrollarea_viewport")
- && qobject_cast<QAbstractItemView *>(object->parent())));
-}
-#endif
-
-static bool isTabWidget(const QAInterface &interface)
-{
- if (QObject *object = interface.object())
- return (object->inherits("QTabWidget") && interface.id() == 0);
- return false;
-}
-
-static bool isStandaloneTabBar(const QAInterface &interface)
-{
- QObject *object = interface.object();
- if (interface.role() == QAccessible::PageTabList && object)
- return (qobject_cast<QTabWidget *>(object->parent()) == 0);
-
- return false;
-}
-
-static bool isEmbeddedTabBar(const QAInterface &interface)
-{
- QObject *object = interface.object();
- if (interface.role() == QAccessible::PageTabList && object)
- return (qobject_cast<QTabWidget *>(object->parent()));
-
- return false;
-}
-
-/*
- Decides if a QAInterface is interesting from an accessibility users point of view.
-*/
-bool isItInteresting(const QAInterface &interface)
-{
- // Mac accessibility does not have an attribute that corresponds to the Invisible/Offscreen
- // state, so we disable the interface here.
- const QAccessible::State state = interface.state();
- if (state & QAccessible::Invisible ||
- state & QAccessible::Offscreen )
- return false;
-
- const QAccessible::Role role = interface.role();
-
- if (QObject * const object = interface.object()) {
- const QString className = QLatin1String(object->metaObject()->className());
-
- // VoiceOver focusing on tool tips can be confusing. The contents of the
- // tool tip is avalible through the description attribute anyway, so
- // we disable accessibility for tool tips.
- if (className == QLatin1String("QTipLabel"))
- return false;
-
- // Hide TabBars that has a QTabWidget parent (the tab widget handles the accessibility)
- if (isEmbeddedTabBar(interface))
- return false;
-
- // Hide docked dockwidgets. ### causes infinitie loop in the apple accessibility code.
- /* if (QDockWidget *dockWidget = qobject_cast<QDockWidget *>(object)) {
- if (dockWidget->isFloating() == false)
- return false;
- }
- */
- }
-
- // Client is a generic role returned by plain QWidgets or other
- // widgets that does not have separate QAccessible interface, such
- // as the TabWidget. Return false unless macRole gives the interface
- // a special role.
- if (role == QAccessible::Client && macRole(interface) == CFStringRef(QAXUnknownRole))
- return false;
-
- // Some roles are not interesting:
- if (role == QAccessible::Border || // QFrame
- role == QAccessible::Application || // We use the system-provided application element.
- role == QAccessible::MenuItem) // The system also provides the menu items.
- return false;
-
- // It is probably better to access the toolbar buttons directly than having
- // to navigate through the toolbar.
- if (role == QAccessible::ToolBar)
- return false;
-
- return true;
-}
-
-QAElement QAccessibleHierarchyManager::registerInterface(QObject *object, int child)
-{
-#ifndef QT_MAC_USE_COCOA
- return registerInterface(QAInterface(QAccessible::queryAccessibleInterface(object), child));
-#else
- Q_UNUSED(object);
- Q_UNUSED(child);
- return QAElement();
-#endif
-}
-
-/*
- Creates a QAXUIelement that corresponds to the given QAInterface.
-*/
-QAElement QAccessibleHierarchyManager::registerInterface(const QAInterface &interface)
-{
-#ifndef QT_MAC_USE_COCOA
- if (interface.isValid() == false)
- return QAElement();
- QAInterface objectInterface = interface.objectInterface();
-
- QObject * qobject = objectInterface.object();
- HIObjectRef hiobject = objectInterface.hiObject();
- if (qobject == 0 || hiobject == 0)
- return QAElement();
-
- if (qobjectElementHash.contains(qobject) == false) {
- registerInterface(qobject, hiobject, createFactory(interface));
- HIObjectSetAccessibilityIgnored(hiobject, !isItInteresting(interface));
- }
-
- return QAElement(hiobject, interface.id());
-#else
- Q_UNUSED(interface);
- return QAElement();
-#endif
-}
-
-#ifndef QT_MAC_USE_COCOA
-#include "qaccessible_mac_carbon.cpp"
-#endif
-
-void QAccessibleHierarchyManager::registerInterface(QObject * qobject, HIObjectRef hiobject, QInterfaceFactory *interfaceFactory)
-{
-#ifndef QT_MAC_USE_COCOA
- if (qobjectElementHash.contains(qobject) == false) {
- qobjectElementHash.insert(qobject, interfaceFactory);
- qobjectHiobjectHash.insert(qobject, hiobject);
- connect(qobject, SIGNAL(destroyed(QObject *)), SLOT(objectDestroyed(QObject *)));
- }
-
- if (hiobjectInterfaceHash.contains(hiobject) == false) {
- hiobjectInterfaceHash.insert(hiobject, interfaceFactory);
- installAcessibilityEventHandler(hiobject);
- }
-#else
- Q_UNUSED(qobject);
- Q_UNUSED(hiobject);
- Q_UNUSED(interfaceFactory);
-#endif
-}
-
-void QAccessibleHierarchyManager::registerChildren(const QAInterface &interface)
-{
- QObject * const object = interface.object();
- if (object == 0)
- return;
-
- QInterfaceFactory *interfaceFactory = qobjectElementHash.value(object);
-
- if (interfaceFactory == 0)
- return;
-
- interfaceFactory->registerChildren();
-}
-
-QAInterface QAccessibleHierarchyManager::lookup(const AXUIElementRef &element)
-{
- if (element == 0)
- return QAInterface();
-#ifndef QT_MAC_USE_COCOA
- HIObjectRef hiObject = AXUIElementGetHIObject(element);
-
- QInterfaceFactory *factory = hiobjectInterfaceHash.value(hiObject);
- if (factory == 0) {
- return QAInterface();
- }
-
- UInt64 id;
- AXUIElementGetIdentifier(element, &id);
- return factory->interface(id);
-#else
- return QAInterface();
-#endif
-}
-
-QAInterface QAccessibleHierarchyManager::lookup(const QAElement &element)
-{
- return lookup(element.element());
-}
-
-QAElement QAccessibleHierarchyManager::lookup(const QAInterface &interface)
-{
- if (interface.isValid() == false)
- return QAElement();
-
- QInterfaceFactory *factory = qobjectElementHash.value(interface.objectInterface().object());
- if (factory == 0)
- return QAElement();
-
- return factory->element(interface);
-}
-
-QAElement QAccessibleHierarchyManager::lookup(QObject * const object, int id)
-{
- QInterfaceFactory *factory = qobjectElementHash.value(object);
- if (factory == 0)
- return QAElement();
-
- return factory->element(id);
-}
-
-/*
- Standard interface mapping, return the stored interface
- or HIObjectRef, and there is an one-to-one mapping between
- the identifier and child.
-*/
-class QStandardInterfaceFactory : public QInterfaceFactory
-{
-public:
- QStandardInterfaceFactory(const QAInterface &interface)
- : m_interface(interface), object(interface.hiObject())
- {
- CFRetain(object);
- }
-
- ~QStandardInterfaceFactory()
- {
- CFRelease(object);
- }
-
-
- QAInterface interface(UInt64 identifier)
- {
- const int child = identifier;
- return QAInterface(m_interface, child);
- }
-
- QAElement element(int id)
- {
- return QAElement(object, id);
- }
-
- QAElement element(const QAInterface &interface)
- {
- if (interface.object() == 0)
- return QAElement();
- return QAElement(object, interface.id());
- }
-
- void registerChildren()
- {
- const int childCount = m_interface.childCount();
- for (int i = 1; i <= childCount; ++i) {
- accessibleHierarchyManager()->registerInterface(m_interface.navigate(QAccessible::Child, i));
- }
- }
-
-private:
- QAInterface m_interface;
- HIObjectRef object;
-};
-
-/*
- Interface mapping where that creates one HIObject for each interface child.
-*/
-class QMultipleHIObjectFactory : public QInterfaceFactory
-{
-public:
- QMultipleHIObjectFactory(const QAInterface &interface)
- : m_interface(interface)
- { }
-
- ~QMultipleHIObjectFactory()
- {
- foreach (HIObjectRef object, objects) {
- CFRelease(object);
- }
- }
-
- QAInterface interface(UInt64 identifier)
- {
- const int child = identifier;
- return QAInterface(m_interface, child);
- }
-
- QAElement element(int child)
- {
- if (child == 0)
- return QAElement(m_interface.hiObject(), 0);
-
- if (child > objects.count())
- return QAElement();
-
- return QAElement(objects.at(child - 1), child);
- }
-
- void registerChildren()
- {
-#ifndef QT_MAC_USE_COCOA
- const int childCount = m_interface.childCount();
- for (int i = 1; i <= childCount; ++i) {
- HIObjectRef hiobject;
- HIObjectCreate(kObjectQtAccessibility, 0, &hiobject);
- objects.append(hiobject);
- accessibleHierarchyManager()->registerInterface(m_interface.object(), hiobject, this);
- HIObjectSetAccessibilityIgnored(hiobject, !isItInteresting(m_interface.navigate(QAccessible::Child, i)));
- }
-#endif
- }
-
-private:
- QAInterface m_interface;
- QList<HIObjectRef> objects;
-};
-
-class QItemViewInterfaceFactory : public QInterfaceFactory
-{
-public:
- QItemViewInterfaceFactory(const QAInterface &interface)
- : m_interface(interface), object(interface.hiObject())
- {
- CFRetain(object);
- columnCount = 0;
- if (QTableView * tableView = qobject_cast<QTableView *>(interface.parent().object())) {
- if (tableView->model())
- columnCount = tableView->model()->columnCount();
- if (tableView->verticalHeader())
- ++columnCount;
- }
- }
-
- ~QItemViewInterfaceFactory()
- {
- CFRelease(object);
- }
-
- QAInterface interface(UInt64 identifier)
- {
- if (identifier == 0)
- return m_interface;
-
- if (m_interface.role() == QAccessible::List)
- return m_interface.childAt(identifier);
-
- if (m_interface.role() == QAccessible::Table) {
- const int index = identifier;
- if (index == 0)
- return m_interface; // return the item view interface.
-
- const int rowIndex = (index - 1) / (columnCount + 1);
- const int cellIndex = (index - 1) % (columnCount + 1);
-/*
- qDebug() << "index" << index;
- qDebug() << "rowIndex" << rowIndex;
- qDebug() << "cellIndex" << cellIndex;
-*/
- const QAInterface rowInterface = m_interface.childAt(rowIndex + 1);
-
- if ((cellIndex) == 0) // Is it a row?
- return rowInterface;
- else {
- return rowInterface.childAt(cellIndex);
- }
- }
-
- return QAInterface();
- }
-
- QAElement element(int id)
- {
- if (id != 0) {
- return QAElement();
- }
- return QAElement(object, 0);
- }
-
- QAElement element(const QAInterface &interface)
- {
- if (interface.object() && interface.object() == m_interface.object()) {
- return QAElement(object, 0);
- } else if (m_interface.role() == QAccessible::List) {
- if (interface.parent().object() && interface.parent().object() == m_interface.object())
- return QAElement(object, m_interface.indexOfChild(interface));
- } else if (m_interface.role() == QAccessible::Table) {
- QAInterface currentInterface = interface;
- int index = 0;
-
- while (currentInterface.isValid() && currentInterface.object() == 0) {
- const QAInterface parentInterface = currentInterface.parent();
-/*
- qDebug() << "current index" << index;
- qDebug() << "current interface" << interface;
-
- qDebug() << "parent interface" << parentInterface;
- qDebug() << "grandparent interface" << parentInterface.parent();
- qDebug() << "childCount" << interface.childCount();
- qDebug() << "index of child" << parentInterface.indexOfChild(currentInterface);
-*/
- index += ((parentInterface.indexOfChild(currentInterface) - 1) * (currentInterface.childCount() + 1)) + 1;
- currentInterface = parentInterface;
-// qDebug() << "new current interface" << currentInterface;
- }
- if (currentInterface.object() == m_interface.object())
- return QAElement(object, index);
-
-
- }
- return QAElement();
- }
-
- void registerChildren()
- {
- // Item view child interfraces don't have their own qobjects, so there is nothing to register here.
- }
-
-private:
- QAInterface m_interface;
- HIObjectRef object;
- int columnCount; // for table views;
-};
-
-#ifndef QT_MAC_USE_COCOA
-static bool managesChildren(const QAInterface &interface)
-{
- return (interface.childCount() > 0 && interface.childAt(1).id() > 0);
-}
-
-static QInterfaceFactory *createFactory(const QAInterface &interface)
-{
- if (isItemView(interface)) {
- return new QItemViewInterfaceFactory(interface);
- } if (managesChildren(interface)) {
- return new QMultipleHIObjectFactory(interface);
- }
-
- return new QStandardInterfaceFactory(interface);
-}
-#endif
-
-QList<QAElement> lookup(const QList<QAInterface> &interfaces)
-{
- QList<QAElement> elements;
- foreach (const QAInterface &interface, interfaces)
- if (interface.isValid()) {
- const QAElement element = accessibleHierarchyManager()->lookup(interface);
- if (element.isValid())
- elements.append(element);
- }
- return elements;
-}
-
-// Debug output helpers:
-/*
-static QString nameForEventKind(UInt32 kind)
-{
- switch(kind) {
- case kEventAccessibleGetChildAtPoint: return QString("GetChildAtPoint"); break;
- case kEventAccessibleGetAllAttributeNames: return QString("GetAllAttributeNames"); break;
- case kEventAccessibleGetNamedAttribute: return QString("GetNamedAttribute"); break;
- case kEventAccessibleSetNamedAttribute: return QString("SetNamedAttribute"); break;
- case kEventAccessibleGetAllActionNames: return QString("GetAllActionNames"); break;
- case kEventAccessibleGetFocusedChild: return QString("GetFocusedChild"); break;
- default:
- return QString("Unknown accessibility event type: %1").arg(kind);
- break;
- };
-}
-*/
-#ifndef QT_MAC_USE_COCOA
-static bool qt_mac_append_cf_uniq(CFMutableArrayRef array, CFTypeRef value)
-{
- if (value == 0)
- return false;
-
- CFRange range;
- range.location = 0;
- range.length = CFArrayGetCount(array);
- if(!CFArrayContainsValue(array, range, value)) {
- CFArrayAppendValue(array, value);
- return true;
- }
- return false;
-}
-
-static OSStatus setAttributeValue(EventRef event, const QList<QAElement> &elements)
-{
- CFMutableArrayRef array = CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks);
- foreach (const QAElement &element, elements) {
- if (element.isValid())
- CFArrayAppendValue(array, element.element());
- }
-
- const OSStatus err = SetEventParameter(event, kEventParamAccessibleAttributeValue,
- typeCFTypeRef, sizeof(array), &array);
- CFRelease(array);
- return err;
-}
-#endif //QT_MAC_USE_COCOA
-
-/*
- Gets the AccessibleObject parameter from an event.
-*/
-static inline AXUIElementRef getAccessibleObjectParameter(EventRef event)
-{
- AXUIElementRef element;
- GetEventParameter(event, kEventParamAccessibleObject, typeCFTypeRef, 0,
- sizeof(element), 0, &element);
- return element;
-}
-
-/*
- The application event handler makes sure that all top-level qt windows are registered
- before any accessibility events are handeled.
-*/
-#ifndef QT_MAC_USE_COCOA
-static OSStatus applicationEventHandler(EventHandlerCallRef next_ref, EventRef event, void *)
-{
- QAInterface rootInterface(QAccessible::queryAccessibleInterface(rootObject ? rootObject : qApp), 0);
- accessibleHierarchyManager()->registerChildren(rootInterface);
-
- return CallNextEventHandler(next_ref, event);
-}
-
-/*
- Returns the value for element by combining the QAccessibility::Checked and
- QAccessibility::Mixed flags into an int value that the Mac accessibilty
- system understands. This works for check boxes, radio buttons, and the like.
- The return values are:
- 0: unchecked
- 1: checked
- 2: undecided
-*/
-static int buttonValue(QAInterface element)
-{
- const QAccessible::State state = element.state();
- if (state & QAccessible::Mixed)
- return 2;
- else if(state & QAccessible::Checked)
- return 1;
- else
- return 0;
-}
-
-static QString getValue(const QAInterface &interface)
-{
- const QAccessible::Role role = interface.role();
- if (role == QAccessible::RadioButton || role == QAccessible::CheckBox)
- return QString::number(buttonValue(interface));
- else
- return interface.text(QAccessible::Value);
-}
-#endif //QT_MAC_USE_COCOA
-
-/*
- Translates a QAccessible::Role into a mac accessibility role.
-*/
-static CFStringRef macRole(const QAInterface &interface)
-{
- const QAccessible::Role qtRole = interface.role();
-
-// qDebug() << "role for" << interface.object() << "interface role" << hex << qtRole;
-
- // Qt accessibility: QAccessible::Splitter contains QAccessible::Grip.
- // Mac accessibility: AXSplitGroup contains AXSplitter.
- if (qtRole == QAccessible::Grip) {
- const QAInterface parent = interface.parent();
- if (parent.isValid() && parent.role() == QAccessible::Splitter)
- return CFStringRef(QAXSplitterRole);
- }
-
- // Tab widgets and standalone tab bars get the kAXTabGroupRole. Accessibility
- // for tab bars emebedded in a tab widget is handled by the tab widget.
- if (isTabWidget(interface) || isStandaloneTabBar(interface))
- return kAXTabGroupRole;
-
- if (QObject *object = interface.object()) {
- // ### The interface for an abstract scroll area returns the generic "Client"
- // role, so we have to to an extra detect on the QObject here.
- if (object->inherits("QAbstractScrollArea") && interface.id() == 0)
- return CFStringRef(QAXScrollAreaRole);
-
- if (object->inherits("QDockWidget"))
- return CFStringRef(QAXUnknownRole);
- }
-
- int i = 0;
- int testRole = text_bindings[i][0].qt;
- while (testRole != -1) {
- if (testRole == qtRole)
- return CFStringRef(text_bindings[i][0].mac);
- ++i;
- testRole = text_bindings[i][0].qt;
- }
-
-// qDebug() << "got unknown role!" << interface << interface.parent();
-
- return CFStringRef(QAXUnknownRole);
-}
-
-/*
- Translates a QAccessible::Role and an attribute name into a QAccessible::Text, taking into
- account execptions listed in text_bindings.
-*/
-#ifndef QT_MAC_USE_COCOA
-static int textForRoleAndAttribute(QAccessible::Role role, CFStringRef attribute)
-{
- // Search for exception, return it if found.
- int testRole = text_bindings[0][0].qt;
- int i = 0;
- while (testRole != -1) {
- if (testRole == role) {
- int j = 1;
- int qtRole = text_bindings[i][j].qt;
- CFStringRef testAttribute = CFStringRef(text_bindings[i][j].mac);
- while (qtRole != -1) {
- if (CFStringCompare(attribute, testAttribute, 0) == kCFCompareEqualTo) {
- return (QAccessible::Text)qtRole;
- }
- ++j;
- testAttribute = CFStringRef(text_bindings[i][j].mac); /// ### custom compare
- qtRole = text_bindings[i][j].qt; /// ### custom compare
- }
- break;
- }
- ++i;
- testRole = text_bindings[i][0].qt;
- }
-
- // Return default mappping
- if (CFStringCompare(attribute, CFStringRef(QAXTitleAttribute), 0) == kCFCompareEqualTo)
- return QAccessible::Name;
- else if (CFStringCompare(attribute, CFStringRef(QAXValueAttribute), 0) == kCFCompareEqualTo)
- return QAccessible::Value;
- else if (CFStringCompare(attribute, CFStringRef(QAXHelpAttribute), 0) == kCFCompareEqualTo)
- return QAccessible::Help;
- else if (CFStringCompare(attribute, CFStringRef(QAXDescriptionAttribute), 0) == kCFCompareEqualTo)
- return QAccessible::Description;
- else
- return -1;
-}
-
-/*
- Returns the subrole string constant for the interface if it has one,
- else returns an empty string.
-*/
-static QCFString subrole(const QAInterface &interface)
-{
- const QAInterface parent = interface.parent();
- if (parent.isValid() == false)
- return QCFString();
-
- if (parent.role() == QAccessible::ScrollBar) {
- QCFString subrole;
- switch(interface.id()) {
- case 1: subrole = CFStringRef(QAXDecrementArrowSubrole); break;
- case 2: subrole = CFStringRef(QAXDecrementPageSubrole); break;
- case 4: subrole = CFStringRef(QAXIncrementPageSubrole); break;
- case 5: subrole = CFStringRef(QAXIncrementArrowSubrole); break;
- default:
- break;
- }
- return subrole;
- }
- return QCFString();
-}
-
-// Gets the scroll bar orientation by asking the QAbstractSlider object directly.
-static Qt::Orientation scrollBarOrientation(const QAInterface &scrollBar)
-{
- QObject *const object = scrollBar.object();
- if (QAbstractSlider * const sliderObject = qobject_cast<QAbstractSlider * const>(object))
- return sliderObject->orientation();
-
- return Qt::Vertical; // D'oh! The interface wasn't a scroll bar.
-}
-
-static QAInterface scrollAreaGetScrollBarInterface(const QAInterface &scrollArea, Qt::Orientation orientation)
-{
- if (macRole(scrollArea) != CFStringRef(CFStringRef(QAXScrollAreaRole)))
- return QAInterface();
-
- // Child 1 is the contents widget, 2 and 3 are the scroll bar containers wich contains possible scroll bars.
- for (int i = 2; i <= 3; ++i) {
- QAInterface scrollBarContainer = scrollArea.childAt(i);
- for (int i = 1; i <= scrollBarContainer.childCount(); ++i) {
- QAInterface scrollBar = scrollBarContainer.childAt(i);
- if (scrollBar.isValid() &&
- scrollBar.role() == QAccessible::ScrollBar &&
- scrollBarOrientation(scrollBar) == orientation)
- return scrollBar;
- }
- }
-
- return QAInterface();
-}
-
-static bool scrollAreaHasScrollBar(const QAInterface &scrollArea, Qt::Orientation orientation)
-{
- return scrollAreaGetScrollBarInterface(scrollArea, orientation).isValid();
-}
-
-static QAElement scrollAreaGetScrollBar(const QAInterface &scrollArea, Qt::Orientation orientation)
-{
- return accessibleHierarchyManager()->lookup(scrollAreaGetScrollBarInterface(scrollArea, orientation));
-}
-
-static QAElement scrollAreaGetContents(const QAInterface &scrollArea)
-{
- // Child 1 is the contents widget,
- return accessibleHierarchyManager()->lookup(scrollArea.navigate(QAccessible::Child, 1));
-}
-
-static QAElement tabWidgetGetContents(const QAInterface &interface)
-{
- // A kAXTabGroup has a kAXContents attribute, which consists of the
- // ui elements for the current tab page. Get the current tab page
- // from the QStackedWidget, where the current visible page can
- // be found at index 1.
- QAInterface stackedWidget = interface.childAt(1);
- accessibleHierarchyManager()->registerChildren(stackedWidget);
- QAInterface tabPageInterface = stackedWidget.childAt(1);
- return accessibleHierarchyManager()->lookup(tabPageInterface);
-}
-
-static QList<QAElement> tabBarGetTabs(const QAInterface &interface)
-{
- // Get the tabs by searching for children with the "PageTab" role.
- // This filters out the left/right navigation buttons.
- accessibleHierarchyManager()->registerChildren(interface);
- QList<QAElement> tabs;
- const int numChildren = interface.childCount();
- for (int i = 1; i < numChildren + 1; ++i) {
- QAInterface child = interface.navigate(QAccessible::Child, i);
- if (child.isValid() && child.role() == QAccessible::PageTab) {
- tabs.append(accessibleHierarchyManager()->lookup(child));
- }
- }
- return tabs;
-}
-
-static QList<QAElement> tabWidgetGetTabs(const QAInterface &interface)
-{
- // Each QTabWidget has two children, a QStackedWidget and a QTabBar.
- // Get the tabs from the QTabBar.
- return tabBarGetTabs(interface.childAt(2));
-}
-
-static QList<QAElement> tabWidgetGetChildren(const QAInterface &interface)
-{
- // The children for a kAXTabGroup should consist of the tabs and the
- // contents of the current open tab page.
- QList<QAElement> children = tabWidgetGetTabs(interface);
- children += tabWidgetGetContents(interface);
- return children;
-}
-#endif //QT_MAC_USE_COCOA
-
-/*
- Returns the label (buddy) interface for interface, or 0 if it has none.
-*/
-/*
-static QAInterface findLabel(const QAInterface &interface)
-{
- return interface.navigate(QAccessible::Label, 1);
-}
-*/
-/*
- Returns a list of interfaces this interface labels, or an empty list if it doesn't label any.
-*/
-/*
-static QList<QAInterface> findLabelled(const QAInterface &interface)
-{
- QList<QAInterface> interfaceList;
-
- int count = 1;
- const QAInterface labelled = interface.navigate(QAccessible::Labelled, count);
- while (labelled.isValid()) {
- interfaceList.append(labelled);
- ++count;
- }
- return interfaceList;
-}
-*/
-/*
- Tests if the given QAInterface has data for a mac attribute.
-*/
-#ifndef QT_MAC_USE_COCOA
-static bool supportsAttribute(CFStringRef attribute, const QAInterface &interface)
-{
- const int text = textForRoleAndAttribute(interface.role(), attribute);
-
- // Special case: Static texts don't have a title.
- if (interface.role() == QAccessible::StaticText && attribute == CFStringRef(QAXTitleAttribute))
- return false;
-
- // Return true if we the attribute matched a QAccessible::Role and we get text for that role from the interface.
- if (text != -1) {
- if (text == QAccessible::Value) // Special case for Value, see getValue()
- return !getValue(interface).isEmpty();
- else
- return !interface.text((QAccessible::Text)text).isEmpty();
- }
-
- if (CFStringCompare(attribute, CFStringRef(QAXChildrenAttribute), 0) == kCFCompareEqualTo) {
- if (interface.childCount() > 0)
- return true;
- }
-
- if (CFStringCompare(attribute, CFStringRef(QAXSubroleAttribute), 0) == kCFCompareEqualTo) {
- return (subrole(interface) != QCFString());
- }
-
- return false;
-}
-
-static void appendIfSupported(CFMutableArrayRef array, CFStringRef attribute, const QAInterface &interface)
-{
- if (supportsAttribute(attribute, interface))
- qt_mac_append_cf_uniq(array, attribute);
-}
-
-/*
- Returns the names of the attributes the give QAInterface supports.
-*/
-static OSStatus getAllAttributeNames(EventRef event, const QAInterface &interface, EventHandlerCallRef next_ref)
-{
- // Call system event handler.
- OSStatus err = CallNextEventHandler(next_ref, event);
- if(err != noErr && err != eventNotHandledErr)
- return err;
- CFMutableArrayRef attrs = 0;
- GetEventParameter(event, kEventParamAccessibleAttributeNames, typeCFMutableArrayRef, 0,
- sizeof(attrs), 0, &attrs);
-
- if (!attrs)
- return eventNotHandledErr;
-
- // Append attribute names that are always supported.
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXPositionAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXSizeAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXRoleAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXEnabledAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXWindowAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXTopLevelUIElementAttribute));
-
- // Append these names if the QInterafceItem returns any data for them.
- appendIfSupported(attrs, CFStringRef(QAXTitleAttribute), interface);
- appendIfSupported(attrs, CFStringRef(QAXValueAttribute), interface);
- appendIfSupported(attrs, CFStringRef(QAXDescriptionAttribute), interface);
- appendIfSupported(attrs, CFStringRef(QAXLinkedUIElementsAttribute), interface);
- appendIfSupported(attrs, CFStringRef(QAXHelpAttribute), interface);
- appendIfSupported(attrs, CFStringRef(QAXTitleUIElementAttribute), interface);
- appendIfSupported(attrs, CFStringRef(QAXChildrenAttribute), interface);
- appendIfSupported(attrs, CFStringRef(QAXSubroleAttribute), interface);
-
- // Append attribute names based on the interaface role.
- switch (interface.role()) {
- case QAccessible::Window:
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXMainAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXMinimizedAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXCloseButtonAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXZoomButtonAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXMinimizeButtonAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXToolbarButtonAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXGrowAreaAttribute));
- break;
- case QAccessible::RadioButton:
- case QAccessible::CheckBox:
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXMinValueAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXMaxValueAttribute));
- break;
- case QAccessible::ScrollBar:
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXOrientationAttribute));
- break;
- case QAccessible::Splitter:
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXSplittersAttribute));
- break;
- case QAccessible::Table:
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXRowsAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXVisibleRowsAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXSelectedRowsAttribute));
- break;
- default:
- break;
- }
-
- // Append attribute names based on the mac accessibility role.
- const QCFString mac_role = macRole(interface);
- if (mac_role == CFStringRef(QAXSplitterRole)) {
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXPreviousContentsAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXNextContentsAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXOrientationAttribute));
- } else if (mac_role == CFStringRef(QAXScrollAreaRole)) {
- if (scrollAreaHasScrollBar(interface, Qt::Horizontal))
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXHorizontalScrollBarAttribute));
- if (scrollAreaHasScrollBar(interface, Qt::Vertical))
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXVerticalScrollBarAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXContentsAttribute));
- } else if (mac_role == CFStringRef(QAXTabGroupRole)) {
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXTabsAttribute));
- // Only tab widgets can have the contents attribute, there is no way of getting
- // the contents from a QTabBar.
- if (isTabWidget(interface))
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXContentsAttribute));
- }
-
- return noErr;
-}
-
-static void handleStringAttribute(EventRef event, QAccessible::Text text, const QAInterface &interface)
-{
- QString str = interface.text(text);
- if (str.isEmpty())
- return;
-
- // Remove any html markup from the text string, or VoiceOver will read the html tags.
- static QTextDocument document;
- document.setHtml(str);
- str = document.toPlainText();
-
- CFStringRef cfstr = QCFString::toCFStringRef(str);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFStringRef, sizeof(cfstr), &cfstr);
-}
-
-/*
- Handles the parent attribute for a interface.
- There are basically three cases here:
- 1. interface is a HIView and has only HIView children.
- 2. interface is a HIView but has children that is not a HIView
- 3. interface is not a HIView.
-*/
-static OSStatus handleChildrenAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
-{
- // Add the children for this interface to the global QAccessibelHierachyManager.
- accessibleHierarchyManager()->registerChildren(interface);
-
- if (isTabWidget(interface)) {
- QList<QAElement> children = tabWidgetGetChildren(interface);
- const int childCount = children.count();
-
- CFMutableArrayRef array = 0;
- array = CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks);
- for (int i = 0; i < childCount; ++i) {
- qt_mac_append_cf_uniq(array, children.at(i).element());
- }
-
- OSStatus err;
- err = SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFArrayRef, sizeof(array), &array);
- if (err != noErr)
- qWarning("Qt:Internal error (%s:%d)", __FILE__, __LINE__);
-
- return noErr;
- }
-
- const QList<QAElement> children = lookup(interface.children());
- const int childCount = children.count();
-
- OSStatus err = eventNotHandledErr;
- if (interface.isHIView())
- err = CallNextEventHandler(next_ref, event);
-
- CFMutableArrayRef array = 0;
- int arraySize = 0;
- if (err == noErr) {
- CFTypeRef obj = 0;
- err = GetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, NULL , sizeof(obj), NULL, &obj);
- if (err == noErr && obj != 0) {
- array = (CFMutableArrayRef)obj;
- arraySize = CFArrayGetCount(array);
- }
- }
-
- if (array) {
- CFArrayRemoveAllValues(array);
- for (int i = 0; i < childCount; ++i) {
- qt_mac_append_cf_uniq(array, children.at(i).element());
- }
- } else {
- array = CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks);
- for (int i = 0; i < childCount; ++i) {
- qt_mac_append_cf_uniq(array, children.at(i).element());
- }
-
- err = SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFArrayRef, sizeof(array), &array);
- if (err != noErr)
- qWarning("Qt:Internal error (%s:%d)", __FILE__, __LINE__);
- }
-
- return noErr;
-}
-
-/*
-
-*/
-static OSStatus handleParentAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
-{
- OSStatus err = eventNotHandledErr;
- if (interface.isHIView()) {
- err = CallNextEventHandler(next_ref, event);
- }
- if (err == noErr)
- return err;
-
- const QAInterface parentInterface = interface.navigate(QAccessible::Ancestor, 1);
- const QAElement parentElement = accessibleHierarchyManager()->lookup(parentInterface);
-
- if (parentElement.isValid() == false)
- return eventNotHandledErr;
-
- AXUIElementRef elementRef = parentElement.element();
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, sizeof(elementRef), &elementRef);
- return noErr;
-}
-#endif
-
-struct IsWindowTest
-{
- static inline bool test(const QAInterface &interface)
- {
- return (interface.role() == QAccessible::Window);
- }
-};
-
-struct IsWindowAndNotDrawerOrSheetTest
-{
- static inline bool test(const QAInterface &interface)
- {
- QWidget * const widget = qobject_cast<QWidget*>(interface.object());
- return (interface.role() == QAccessible::Window &&
- widget && widget->isWindow() &&
- !qt_mac_is_macdrawer(widget) &&
- !qt_mac_is_macsheet(widget));
- }
-};
-
-/*
- Navigates up the iterfaces ancestor hierachy until a QAccessibleInterface that
- passes the Test is found. If we reach a interface that is a HIView we stop the
- search and call AXUIElementCopyAttributeValue.
-*/
-template <typename TestType>
-OSStatus navigateAncestors(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface, CFStringRef attribute)
-{
- if (interface.isHIView())
- return CallNextEventHandler(next_ref, event);
-
- QAInterface current = interface;
- QAElement element;
- while (current.isValid()) {
- if (TestType::test(interface)) {
- element = accessibleHierarchyManager()->lookup(current);
- break;
- }
-
- // If we reach an InterfaceItem that is a HiView we can hand of the search to
- // the system event handler. This is the common case.
- if (current.isHIView()) {
- CFTypeRef value = 0;
- const QAElement currentElement = accessibleHierarchyManager()->lookup(current);
- AXError err = AXUIElementCopyAttributeValue(currentElement.element(), attribute, &value);
- AXUIElementRef newElement = (AXUIElementRef)value;
-
- if (err == noErr)
- element = QAElement(newElement);
-
- if (newElement != 0)
- CFRelease(newElement);
- break;
- }
-
- QAInterface next = current.parent();
- if (next.isValid() == false)
- break;
- if (next == current)
- break;
- current = next;
- }
-
- if (element.isValid() == false)
- return eventNotHandledErr;
-
-
- AXUIElementRef elementRef = element.element();
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef,
- sizeof(elementRef), &elementRef);
- return noErr;
-}
-
-/*
- Returns the top-level window for an interface, which is the closest ancestor interface that
- has the Window role, but is not a sheet or a drawer.
-*/
-#ifndef QT_MAC_USE_COCOA
-static OSStatus handleWindowAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
-{
- return navigateAncestors<IsWindowAndNotDrawerOrSheetTest>(next_ref, event, interface, CFStringRef(QAXWindowAttribute));
-}
-
-/*
- Returns the top-level window for an interface, which is the closest ancestor interface that
- has the Window role. (Can also be a sheet or a drawer)
-*/
-static OSStatus handleTopLevelUIElementAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
-{
- return navigateAncestors<IsWindowTest>(next_ref, event, interface, CFStringRef(QAXTopLevelUIElementAttribute));
-}
-
-/*
- Returns the tab buttons for an interface.
-*/
-static OSStatus handleTabsAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
-{
- Q_UNUSED(next_ref);
- if (isTabWidget(interface))
- return setAttributeValue(event, tabWidgetGetTabs(interface));
- else
- return setAttributeValue(event, tabBarGetTabs(interface));
-}
-
-static OSStatus handlePositionAttribute(EventHandlerCallRef, EventRef event, const QAInterface &interface)
-{
- QPoint qpoint(interface.rect().topLeft());
- HIPoint point;
- point.x = qpoint.x();
- point.y = qpoint.y();
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeHIPoint, sizeof(point), &point);
- return noErr;
-}
-
-static OSStatus handleSizeAttribute(EventHandlerCallRef, EventRef event, const QAInterface &interface)
-{
- QSize qSize(interface.rect().size());
- HISize size;
- size.width = qSize.width();
- size.height = qSize.height();
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeHISize, sizeof(size), &size);
- return noErr;
-}
-
-static OSStatus handleSubroleAttribute(EventHandlerCallRef, EventRef event, const QAInterface &interface)
-{
- const QCFString role = subrole(interface);
- CFStringRef rolestr = (CFStringRef)role;
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, sizeof(rolestr), &rolestr);
- return noErr;
-}
-
-static OSStatus handleOrientationAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
-{
- QObject *const object = interface.object();
- Qt::Orientation orientation;
- if (interface.role() == QAccessible::ScrollBar) {
- orientation = scrollBarOrientation(interface);
- } else if (QSplitterHandle * const splitter = qobject_cast<QSplitterHandle * const>(object)) {
- // Qt reports the layout orientation, but we want the splitter handle orientation.
- orientation = (splitter->orientation() == Qt::Horizontal) ? Qt::Vertical : Qt::Horizontal;
- } else {
- return CallNextEventHandler(next_ref, event);
- }
- const CFStringRef orientationString = (orientation == Qt::Vertical)
- ? CFStringRef(QAXVerticalOrientationValue) : CFStringRef(QAXHorizontalOrientationValue);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFStringRef, sizeof(orientationString), &orientationString);
- return noErr;
-}
-
-/*
- Figures out the next or previous contents for a splitter.
-*/
-static OSStatus handleSplitterContentsAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface, QCFString nextOrPrev)
-{
- if (interface.isValid() == false || interface.role() != QAccessible::Grip)
- return eventNotHandledErr;
-
- const QAInterface parent = interface.parent();
- if (parent.isValid() == false)
- return CallNextEventHandler(next_ref, event);
-
- if (parent.role() != QAccessible::Splitter)
- return CallNextEventHandler(next_ref, event);
-
- const QSplitter * const splitter = qobject_cast<const QSplitter * const>(parent.object());
- if (splitter == 0)
- return CallNextEventHandler(next_ref, event);
-
- QWidget * const splitterHandle = qobject_cast<QWidget * const>(interface.object());
- const int splitterHandleIndex = splitter->indexOf(splitterHandle);
- const int widgetIndex = (nextOrPrev == QCFString(CFStringRef(QAXPreviousContentsAttribute))) ? splitterHandleIndex - 1 : splitterHandleIndex;
- const QAElement contentsElement = accessibleHierarchyManager()->lookup(splitter->widget(widgetIndex), 0);
- return setAttributeValue(event, QList<QAElement>() << contentsElement);
-}
-
-/*
- Creates a list of all splitter handles the splitter contains.
-*/
-static OSStatus handleSplittersAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
-{
- const QSplitter * const splitter = qobject_cast<const QSplitter * const>(interface.object());
- if (splitter == 0)
- return CallNextEventHandler(next_ref, event);
-
- accessibleHierarchyManager()->registerChildren(interface);
-
- QList<QAElement> handles;
- const int visibleSplitterCount = splitter->count() -1; // skip first handle, it's always invisible.
- for (int i = 0; i < visibleSplitterCount; ++i)
- handles.append(accessibleHierarchyManager()->lookup(splitter->handle(i + 1), 0));
-
- return setAttributeValue(event, handles);
-}
-
-// This handler gets the scroll bars for a scroll area
-static OSStatus handleScrollBarAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &scrollArea, Qt::Orientation orientation)
-{
- QAElement scrollBar = scrollAreaGetScrollBar(scrollArea, orientation);
- if (scrollBar.isValid() == false)
- return CallNextEventHandler(next_ref, event);
-
- AXUIElementRef elementRef = scrollBar.element();
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, sizeof(elementRef), &elementRef);
- return noErr;
-}
-
-// This handler gets the contents for a scroll area or tab widget.
-static OSStatus handleContentsAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
-{
- const QCFString mac_role = macRole(interface);
-
- QAElement contents;
-
- if (mac_role == kAXTabGroupRole) {
- contents = tabWidgetGetContents(interface);
- } else {
- contents = scrollAreaGetContents(interface);
- if (contents.isValid() == false)
- return CallNextEventHandler(next_ref, event);
- }
-
- return setAttributeValue(event, QList<QAElement>() << contents);
-}
-
-static OSStatus handleRowsAttribute(EventHandlerCallRef, EventRef event, QAInterface &tableView)
-{
- QList<QAElement> rows = lookup(tableView.children());
-
- // kill the first row which is the horizontal header.
- rows.removeAt(0);
-
- return setAttributeValue(event, rows);
-}
-
-static OSStatus handleVisibleRowsAttribute(EventHandlerCallRef, EventRef event, QAInterface &tableView)
-{
- QList<QAElement> visibleRows;
-
- QList<QAInterface> rows = tableView.children();
- // kill the first row which is the horizontal header.
- rows.removeAt(0);
-
- foreach (const QAInterface &interface, rows)
- if ((interface.state() & QAccessible::Invisible) == false)
- visibleRows.append(accessibleHierarchyManager()->lookup(interface));
-
- return setAttributeValue(event, visibleRows);
-}
-
-static OSStatus handleSelectedRowsAttribute(EventHandlerCallRef, EventRef event, QAInterface &tableView)
-{
- QList<QAElement> selectedRows;
- foreach (const QAInterface &interface, tableView.children())
- if ((interface.state() & QAccessible::Selected))
- selectedRows.append(accessibleHierarchyManager()->lookup(interface));
-
- return setAttributeValue(event, selectedRows);
-}
-
-static OSStatus getNamedAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
-{
- CFStringRef var;
- GetEventParameter(event, kEventParamAccessibleAttributeName, typeCFStringRef, 0,
- sizeof(var), 0, &var);
-
- if (CFStringCompare(var, CFStringRef(QAXChildrenAttribute), 0) == kCFCompareEqualTo) {
- return handleChildrenAttribute(next_ref, event, interface);
- } else if(CFStringCompare(var, CFStringRef(QAXTopLevelUIElementAttribute), 0) == kCFCompareEqualTo) {
- return handleTopLevelUIElementAttribute(next_ref, event, interface);
- } else if(CFStringCompare(var, CFStringRef(QAXWindowAttribute), 0) == kCFCompareEqualTo) {
- return handleWindowAttribute(next_ref, event, interface);
- } else if(CFStringCompare(var, CFStringRef(QAXParentAttribute), 0) == kCFCompareEqualTo) {
- return handleParentAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXPositionAttribute), 0) == kCFCompareEqualTo) {
- return handlePositionAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXSizeAttribute), 0) == kCFCompareEqualTo) {
- return handleSizeAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXRoleAttribute), 0) == kCFCompareEqualTo) {
- CFStringRef role = macRole(interface);
-// ###
-// QWidget * const widget = qobject_cast<QWidget *>(interface.object());
-// if (role == CFStringRef(QAXUnknownRole) && widget && widget->isWindow())
-// role = CFStringRef(QAXWindowRole);
-
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFStringRef,
- sizeof(role), &role);
-
- } else if (CFStringCompare(var, CFStringRef(QAXEnabledAttribute), 0) == kCFCompareEqualTo) {
- Boolean val = !((interface.state() & QAccessible::Unavailable))
- && !((interface.state() & QAccessible::Invisible));
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- } else if (CFStringCompare(var, CFStringRef(QAXExpandedAttribute), 0) == kCFCompareEqualTo) {
- Boolean val = (interface.state() & QAccessible::Expanded);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- } else if (CFStringCompare(var, CFStringRef(QAXSelectedAttribute), 0) == kCFCompareEqualTo) {
- Boolean val = (interface.state() & QAccessible::Selection);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- } else if (CFStringCompare(var, CFStringRef(QAXFocusedAttribute), 0) == kCFCompareEqualTo) {
- Boolean val = (interface.state() & QAccessible::Focus);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- } else if (CFStringCompare(var, CFStringRef(QAXSelectedChildrenAttribute), 0) == kCFCompareEqualTo) {
- const int cc = interface.childCount();
- QList<QAElement> selected;
- for (int i = 1; i <= cc; ++i) {
- const QAInterface child_iface = interface.navigate(QAccessible::Child, i);
- if (child_iface.isValid() && child_iface.state() & QAccessible::Selected)
- selected.append(accessibleHierarchyManager()->lookup(child_iface));
- }
-
- return setAttributeValue(event, selected);
-
- } else if (CFStringCompare(var, CFStringRef(QAXCloseButtonAttribute), 0) == kCFCompareEqualTo) {
- if(interface.object() && interface.object()->isWidgetType()) {
- Boolean val = true; //do we want to add a WState for this?
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXZoomButtonAttribute), 0) == kCFCompareEqualTo) {
- if(interface.object() && interface.object()->isWidgetType()) {
- QWidget *widget = (QWidget*)interface.object();
- Boolean val = (widget->windowFlags() & Qt::WindowMaximizeButtonHint);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXMinimizeButtonAttribute), 0) == kCFCompareEqualTo) {
- if(interface.object() && interface.object()->isWidgetType()) {
- QWidget *widget = (QWidget*)interface.object();
- Boolean val = (widget->windowFlags() & Qt::WindowMinimizeButtonHint);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXToolbarButtonAttribute), 0) == kCFCompareEqualTo) {
- if(interface.object() && interface.object()->isWidgetType()) {
- QWidget *widget = (QWidget*)interface.object();
- Boolean val = qobject_cast<QMainWindow *>(widget) != 0;
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXGrowAreaAttribute), 0) == kCFCompareEqualTo) {
- if(interface.object() && interface.object()->isWidgetType()) {
- Boolean val = true; //do we want to add a WState for this?
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXMinimizedAttribute), 0) == kCFCompareEqualTo) {
- if (interface.object() && interface.object()->isWidgetType()) {
- QWidget *widget = (QWidget*)interface.object();
- Boolean val = (widget->windowState() & Qt::WindowMinimized);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXSubroleAttribute), 0) == kCFCompareEqualTo) {
- return handleSubroleAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXRoleDescriptionAttribute), 0) == kCFCompareEqualTo) {
-#if !defined(QT_MAC_USE_COCOA)
- if (HICopyAccessibilityRoleDescription) {
- const CFStringRef roleDescription = HICopyAccessibilityRoleDescription(macRole(interface), 0);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFStringRef,
- sizeof(roleDescription), &roleDescription);
- } else
-#endif
- {
- // Just use Qt::Description on 10.3
- handleStringAttribute(event, QAccessible::Description, interface);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXTitleAttribute), 0) == kCFCompareEqualTo) {
- const QAccessible::Role role = interface.role();
- const QAccessible::Text text = (QAccessible::Text)textForRoleAndAttribute(role, var);
- handleStringAttribute(event, text, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXValueAttribute), 0) == kCFCompareEqualTo) {
- const QAccessible::Role role = interface.role();
- const QAccessible::Text text = (QAccessible::Text)textForRoleAndAttribute(role, var);
- if (role == QAccessible::CheckBox || role == QAccessible::RadioButton) {
- int value = buttonValue(interface);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeUInt32, sizeof(value), &value);
- } else {
- handleStringAttribute(event, text, interface);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXDescriptionAttribute), 0) == kCFCompareEqualTo) {
- const QAccessible::Role role = interface.role();
- const QAccessible::Text text = (QAccessible::Text)textForRoleAndAttribute(role, var);
- handleStringAttribute(event, text, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXLinkedUIElementsAttribute), 0) == kCFCompareEqualTo) {
- return CallNextEventHandler(next_ref, event);
- } else if (CFStringCompare(var, CFStringRef(QAXHelpAttribute), 0) == kCFCompareEqualTo) {
- const QAccessible::Role role = interface.role();
- const QAccessible::Text text = (QAccessible::Text)textForRoleAndAttribute(role, var);
- handleStringAttribute(event, text, interface);
- } else if (CFStringCompare(var, kAXTitleUIElementAttribute, 0) == kCFCompareEqualTo) {
- return CallNextEventHandler(next_ref, event);
- } else if (CFStringCompare(var, CFStringRef(QAXTabsAttribute), 0) == kCFCompareEqualTo) {
- return handleTabsAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXMinValueAttribute), 0) == kCFCompareEqualTo) {
- // tabs we first go to the tab bar which is child #2.
- QAInterface tabBarInterface = interface.childAt(2);
- return handleTabsAttribute(next_ref, event, tabBarInterface);
- } else if (CFStringCompare(var, CFStringRef(QAXMinValueAttribute), 0) == kCFCompareEqualTo) {
- if (interface.role() == QAccessible::RadioButton || interface.role() == QAccessible::CheckBox) {
- uint value = 0;
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeUInt32, sizeof(value), &value);
- } else {
- return CallNextEventHandler(next_ref, event);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXMaxValueAttribute), 0) == kCFCompareEqualTo) {
- if (interface.role() == QAccessible::RadioButton || interface.role() == QAccessible::CheckBox) {
- uint value = 2;
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeUInt32, sizeof(value), &value);
- } else {
- return CallNextEventHandler(next_ref, event);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXOrientationAttribute), 0) == kCFCompareEqualTo) {
- return handleOrientationAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXPreviousContentsAttribute), 0) == kCFCompareEqualTo) {
- return handleSplitterContentsAttribute(next_ref, event, interface, CFStringRef(QAXPreviousContentsAttribute));
- } else if (CFStringCompare(var, CFStringRef(QAXNextContentsAttribute), 0) == kCFCompareEqualTo) {
- return handleSplitterContentsAttribute(next_ref, event, interface, CFStringRef(QAXNextContentsAttribute));
- } else if (CFStringCompare(var, CFStringRef(QAXSplittersAttribute), 0) == kCFCompareEqualTo) {
- return handleSplittersAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXHorizontalScrollBarAttribute), 0) == kCFCompareEqualTo) {
- return handleScrollBarAttribute(next_ref, event, interface, Qt::Horizontal);
- } else if (CFStringCompare(var, CFStringRef(QAXVerticalScrollBarAttribute), 0) == kCFCompareEqualTo) {
- return handleScrollBarAttribute(next_ref, event, interface, Qt::Vertical);
- } else if (CFStringCompare(var, CFStringRef(QAXContentsAttribute), 0) == kCFCompareEqualTo) {
- return handleContentsAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXRowsAttribute), 0) == kCFCompareEqualTo) {
- return handleRowsAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXVisibleRowsAttribute), 0) == kCFCompareEqualTo) {
- return handleVisibleRowsAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXSelectedRowsAttribute), 0) == kCFCompareEqualTo) {
- return handleSelectedRowsAttribute(next_ref, event, interface);
- } else {
- return CallNextEventHandler(next_ref, event);
- }
- return noErr;
-}
-
-static OSStatus isNamedAttributeSettable(EventRef event, const QAInterface &interface)
-{
- CFStringRef var;
- GetEventParameter(event, kEventParamAccessibleAttributeName, typeCFStringRef, 0,
- sizeof(var), 0, &var);
- Boolean settable = false;
- if (CFStringCompare(var, CFStringRef(QAXFocusedAttribute), 0) == kCFCompareEqualTo) {
- settable = true;
- } else {
- for (int r = 0; text_bindings[r][0].qt != -1; r++) {
- if(interface.role() == (QAccessible::Role)text_bindings[r][0].qt) {
- for (int a = 1; text_bindings[r][a].qt != -1; a++) {
- if (CFStringCompare(var, CFStringRef(text_bindings[r][a].mac), 0) == kCFCompareEqualTo) {
- settable = text_bindings[r][a].settable;
- break;
- }
- }
- }
- }
- }
- SetEventParameter(event, kEventParamAccessibleAttributeSettable, typeBoolean,
- sizeof(settable), &settable);
- return noErr;
-}
-
-static OSStatus getChildAtPoint(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
-{
- Q_UNUSED(next_ref);
- if (interface.isValid() == false)
- return eventNotHandledErr;
-
- // Add the children for this interface to the global QAccessibelHierachyManager.
- accessibleHierarchyManager()->registerChildren(interface);
-
- Point where;
- GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, 0, sizeof(where), 0, &where);
- const QAInterface childInterface = interface.childAt(where.h, where.v);
-
- if (childInterface.isValid() == false || childInterface == interface)
- return eventNotHandledErr;
-
- const QAElement element = accessibleHierarchyManager()->lookup(childInterface);
- if (element.isValid() == false)
- return eventNotHandledErr;
-
- AXUIElementRef elementRef = element.element();
- CFRetain(elementRef);
- SetEventParameter(event, kEventParamAccessibleChild, typeCFTypeRef,
- sizeof(elementRef), &elementRef);
-
- return noErr;
-}
-
-/*
- Returns a list of actions the given interface supports.
- Currently implemented by getting the interface role and deciding based on that.
-*/
-static QList<QAccessible::Action> supportedPredefinedActions(const QAInterface &interface)
-{
- QList<QAccessible::Action> actions;
- switch (interface.role()) {
- default:
- // Most things can be pressed.
- actions.append(QAccessible::Press);
- break;
- }
-
- return actions;
-}
-
-/*
- Translates a predefined QAccessible::Action to a Mac action constant.
- Returns an empty string if the Qt Action has no mac equivalent.
-*/
-static QCFString translateAction(const QAccessible::Action action)
-{
- switch (action) {
- case QAccessible::Press:
- return CFStringRef(QAXPressAction);
- break;
- case QAccessible::Increase:
- return CFStringRef(QAXIncrementAction);
- break;
- case QAccessible::Decrease:
- return CFStringRef(QAXDecrementAction);
- break;
- case QAccessible::Accept:
- return CFStringRef(QAXConfirmAction);
- break;
- case QAccessible::Select:
- return CFStringRef(QAXPickAction);
- break;
- case QAccessible::Cancel:
- return CFStringRef(QAXCancelAction);
- break;
- default:
- return QCFString();
- break;
- }
-}
-
-/*
- Translates between a Mac action constant and a QAccessible::Action.
- Returns QAccessible::Default action if there is no Qt predefined equivalent.
-*/
-static QAccessible::Action translateAction(const CFStringRef actionName)
-{
- if(CFStringCompare(actionName, CFStringRef(QAXPressAction), 0) == kCFCompareEqualTo) {
- return QAccessible::Press;
- } else if(CFStringCompare(actionName, CFStringRef(QAXIncrementAction), 0) == kCFCompareEqualTo) {
- return QAccessible::Increase;
- } else if(CFStringCompare(actionName, CFStringRef(QAXDecrementAction), 0) == kCFCompareEqualTo) {
- return QAccessible::Decrease;
- } else if(CFStringCompare(actionName, CFStringRef(QAXConfirmAction), 0) == kCFCompareEqualTo) {
- return QAccessible::Accept;
- } else if(CFStringCompare(actionName, CFStringRef(QAXPickAction), 0) == kCFCompareEqualTo) {
- return QAccessible::Select;
- } else if(CFStringCompare(actionName, CFStringRef(QAXCancelAction), 0) == kCFCompareEqualTo) {
- return QAccessible::Cancel;
- } else {
- return QAccessible::DefaultAction;
- }
-}
-#endif // QT_MAC_USE_COCOA
-
-/*
- Copies the translated names all supported actions for an interface into the kEventParamAccessibleActionNames
- event parameter.
-*/
-#ifndef QT_MAC_USE_COCOA
-static OSStatus getAllActionNames(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
-{
- Q_UNUSED(next_ref);
-
- CFMutableArrayRef actions = 0;
- GetEventParameter(event, kEventParamAccessibleActionNames, typeCFMutableArrayRef, 0,
- sizeof(actions), 0, &actions);
-
- // Add supported predefined actions.
- const QList<QAccessible::Action> predefinedActions = supportedPredefinedActions(interface);
- for (int i = 0; i < predefinedActions.count(); ++i) {
- const QCFString action = translateAction(predefinedActions.at(i));
- if (action != QCFString())
- qt_mac_append_cf_uniq(actions, action);
- }
-
- // Add user actions
- const int actionCount = interface.userActionCount();
- for (int i = 0; i < actionCount; ++i) {
- const QString actionName = interface.actionText(i, QAccessible::Name);
- qt_mac_append_cf_uniq(actions, QCFString::toCFStringRef(actionName));
- }
-
- return noErr;
-}
-#endif
-
-/*
- Handles the perforNamedAction event.
-*/
-#ifndef QT_MAC_USE_COCOA
-static OSStatus performNamedAction(EventHandlerCallRef next_ref, EventRef event, const QAInterface& interface)
-{
- Q_UNUSED(next_ref);
-
- CFStringRef act;
- GetEventParameter(event, kEventParamAccessibleActionName, typeCFStringRef, 0,
- sizeof(act), 0, &act);
-
- const QAccessible::Action action = translateAction(act);
-
- // Perform built-in action
- if (action != QAccessible::DefaultAction) {
- interface.doAction(action, QVariantList());
- return noErr;
- }
-
- // Search for user-defined actions and perform it if found.
- const int actCount = interface.userActionCount();
- const QString qAct = QCFString::toQString(act);
- for(int i = 0; i < actCount; i++) {
- if(interface.actionText(i, QAccessible::Name) == qAct) {
- interface.doAction(i, QVariantList());
- break;
- }
- }
- return noErr;
-}
-
-static OSStatus setNamedAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
-{
- Q_UNUSED(next_ref);
- Q_UNUSED(event);
-
- CFStringRef var;
- GetEventParameter(event, kEventParamAccessibleAttributeName, typeCFStringRef, 0,
- sizeof(var), 0, &var);
- if(CFStringCompare(var, CFStringRef(QAXFocusedAttribute), 0) == kCFCompareEqualTo) {
- CFTypeRef val;
- if(GetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, 0,
- sizeof(val), 0, &val) == noErr) {
- if(CFGetTypeID(val) == CFBooleanGetTypeID() &&
- CFEqual(static_cast<CFBooleanRef>(val), kCFBooleanTrue)) {
- interface.doAction(QAccessible::SetFocus);
- }
- }
- } else {
- bool found = false;
- for(int r = 0; text_bindings[r][0].qt != -1; r++) {
- if(interface.role() == (QAccessible::Role)text_bindings[r][0].qt) {
- for(int a = 1; text_bindings[r][a].qt != -1; a++) {
- if(CFStringCompare(var, CFStringRef(text_bindings[r][a].mac), 0) == kCFCompareEqualTo) {
- if(!text_bindings[r][a].settable) {
- } else {
- CFTypeRef val;
- if(GetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, 0,
- sizeof(val), 0, &val) == noErr) {
- if(CFGetTypeID(val) == CFStringGetTypeID())
- interface.setText((QAccessible::Text)text_bindings[r][a].qt,
- QCFString::toQString(static_cast<CFStringRef>(val)));
-
- }
- }
- found = true;
- break;
- }
- }
- break;
- }
- }
- }
- return noErr;
-}
-
-/*
- This is the main accessibility event handler.
-*/
-static OSStatus accessibilityEventHandler(EventHandlerCallRef next_ref, EventRef event, void *data)
-{
- Q_UNUSED(data)
-
- // Return if this event is not a AccessibleGetNamedAttribute event.
- const UInt32 eclass = GetEventClass(event);
- if (eclass != kEventClassAccessibility)
- return eventNotHandledErr;
-
- // Get the AXUIElementRef and QAInterface pointer
- AXUIElementRef element = 0;
- GetEventParameter(event, kEventParamAccessibleObject, typeCFTypeRef, 0, sizeof(element), 0, &element);
- QAInterface interface = accessibleHierarchyManager()->lookup(element);
- if (interface.isValid() == false)
- return eventNotHandledErr;
-
- const UInt32 ekind = GetEventKind(event);
- OSStatus status = noErr;
- switch (ekind) {
- case kEventAccessibleGetAllAttributeNames:
- status = getAllAttributeNames(event, interface, next_ref);
- break;
- case kEventAccessibleGetNamedAttribute:
- status = getNamedAttribute(next_ref, event, interface);
- break;
- case kEventAccessibleIsNamedAttributeSettable:
- status = isNamedAttributeSettable(event, interface);
- break;
- case kEventAccessibleGetChildAtPoint:
- status = getChildAtPoint(next_ref, event, interface);
- break;
- case kEventAccessibleGetAllActionNames:
- status = getAllActionNames(next_ref, event, interface);
- break;
- case kEventAccessibleGetFocusedChild:
- status = CallNextEventHandler(next_ref, event);
- break;
- case kEventAccessibleSetNamedAttribute:
- status = setNamedAttribute(next_ref, event, interface);
- break;
- case kEventAccessiblePerformNamedAction:
- status = performNamedAction(next_ref, event, interface);
- break;
- default:
- status = CallNextEventHandler(next_ref, event);
- break;
- };
- return status;
-}
-#endif
-
-void QAccessible::initialize()
-{
-#ifndef QT_MAC_USE_COCOA
- registerQtAccessibilityHIObjectSubclass();
- installApplicationEventhandler();
-#endif
-}
-
-// Sets thre root object for the application
-void QAccessible::setRootObject(QObject *object)
-{
- // Call installed root object handler if we have one
- if (rootObjectHandler) {
- rootObjectHandler(object);
- return;
- }
-
- rootObject = object;
-}
-
-void QAccessible::cleanup()
-{
- accessibleHierarchyManager()->reset();
-#ifndef QT_MAC_USE_COCOA
- removeEventhandler(applicationEventHandlerUPP);
- removeEventhandler(objectCreateEventHandlerUPP);
- removeEventhandler(accessibilityEventHandlerUPP);
-#endif
-}
-
-void QAccessible::updateAccessibility(QObject *object, int child, Event reason)
-{
- // Call installed update handler if we have one.
- if (updateHandler) {
- updateHandler(object, child, reason);
- return;
- }
-
-#ifndef QT_MAC_USE_COCOA
- // Return if the mac accessibility is not enabled.
- if(!AXAPIEnabled())
- return;
-
- // Work around crash, disable accessiblity for focus frames.
- if (qstrcmp(object->metaObject()->className(), "QFocusFrame") == 0)
- return;
-
-// qDebug() << "updateAccessibility" << object << child << hex << reason;
-
- if (reason == ObjectShow) {
- QAInterface interface = QAInterface(QAccessible::queryAccessibleInterface(object), child);
- accessibleHierarchyManager()->registerInterface(interface);
- }
-
- const QAElement element = accessibleHierarchyManager()->lookup(object, child);
- if (element.isValid() == false)
- return;
-
-
- CFStringRef notification = 0;
- if(object && object->isWidgetType() && reason == ObjectCreated) {
- notification = CFStringRef(QAXWindowCreatedNotification);
- } else if(reason == ValueChanged) {
- notification = CFStringRef(QAXValueChangedNotification);
- } else if(reason == MenuStart) {
- notification = CFStringRef(QAXMenuOpenedNotification);
- } else if(reason == MenuEnd) {
- notification = CFStringRef(QAXMenuClosedNotification);
- } else if(reason == LocationChanged) {
- notification = CFStringRef(QAXWindowMovedNotification);
- } else if(reason == ObjectShow || reason == ObjectHide ) {
- // When a widget is deleted we get a ObjectHide before the destroyed(QObject *)
- // signal is emitted (which makes sense). However, at this point we are in the
- // middle of the QWidget destructor which means that we have to be careful when
- // using the widget pointer. Since we can't control what the accessibilty interfaces
- // does when navigate() is called below we ignore the hide update in this case.
- // (the widget will be deleted soon anyway.)
- extern QWidgetPrivate * qt_widget_private(QWidget *);
- if (QWidget *widget = qobject_cast<QWidget*>(object)) {
- if (qt_widget_private(widget)->data.in_destructor)
- return;
-
- // Check widget parent as well, special case for preventing crash
- // when the viewport() of an abstract scroll area is hidden when
- // the QWidget destructor hides all its children.
- QWidget *parentWidget = widget->parentWidget();
- if (parentWidget && qt_widget_private(parentWidget)->data.in_destructor)
- return;
- }
-
- // There is no equivalent Mac notification for ObjectShow/Hide, so we call HIObjectSetAccessibilityIgnored
- // and isItInteresting which will mark the HIObject accociated with the element as ignored if the
- // QAccessible::Invisible state bit is set.
- QAInterface interface = accessibleHierarchyManager()->lookup(element);
- if (interface.isValid()) {
- HIObjectSetAccessibilityIgnored(element.object(), !isItInteresting(interface));
- }
-
- // If the interface manages its own children, also check if we should ignore those.
- if (isItemView(interface) == false && managesChildren(interface)) {
- for (int i = 1; i <= interface.childCount(); ++i) {
- QAInterface childInterface = interface.navigate(QAccessible::Child, i);
- if (childInterface.isValid() && childInterface.isHIView() == false) {
- const QAElement element = accessibleHierarchyManager()->lookup(childInterface);
- if (element.isValid()) {
- HIObjectSetAccessibilityIgnored(element.object(), !isItInteresting(childInterface));
- }
- }
- }
- }
-
- } else if(reason == Focus) {
- if(object && object->isWidgetType()) {
- QWidget *w = static_cast<QWidget*>(object);
- if(w->isWindow())
- notification = CFStringRef(QAXFocusedWindowChangedNotification);
- else
- notification = CFStringRef(QAXFocusedUIElementChangedNotification);
- }
- }
-
- if (!notification)
- return;
-
- AXNotificationHIObjectNotify(notification, element.object(), element.id());
-#endif
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_ACCESSIBILITY
diff --git a/src/gui/accessible/qaccessible_mac_carbon.cpp b/src/gui/accessible/qaccessible_mac_carbon.cpp
deleted file mode 100644
index 32a242f274..0000000000
--- a/src/gui/accessible/qaccessible_mac_carbon.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-static OSStatus applicationEventHandler(EventHandlerCallRef next_ref, EventRef event, void *data);
-static EventHandlerUPP applicationEventHandlerUPP = 0;
-static EventTypeSpec application_events[] = {
- { kEventClassAccessibility, kEventAccessibleGetChildAtPoint },
- { kEventClassAccessibility, kEventAccessibleGetNamedAttribute }
-};
-
-static CFStringRef kObjectQtAccessibility = CFSTR("com.trolltech.qt.accessibility");
-static EventHandlerUPP objectCreateEventHandlerUPP = 0;
-static EventTypeSpec objectCreateEvents[] = {
- { kEventClassHIObject, kEventHIObjectConstruct },
- { kEventClassHIObject, kEventHIObjectInitialize },
- { kEventClassHIObject, kEventHIObjectDestruct },
- { kEventClassHIObject, kEventHIObjectPrintDebugInfo }
-};
-
-static OSStatus accessibilityEventHandler(EventHandlerCallRef next_ref, EventRef event, void *data);
-static EventHandlerUPP accessibilityEventHandlerUPP = 0;
-static EventTypeSpec accessibilityEvents[] = {
- { kEventClassAccessibility, kEventAccessibleGetChildAtPoint },
- { kEventClassAccessibility, kEventAccessibleGetFocusedChild },
- { kEventClassAccessibility, kEventAccessibleGetAllAttributeNames },
- { kEventClassAccessibility, kEventAccessibleGetNamedAttribute },
- { kEventClassAccessibility, kEventAccessibleSetNamedAttribute },
- { kEventClassAccessibility, kEventAccessibleIsNamedAttributeSettable },
- { kEventClassAccessibility, kEventAccessibleGetAllActionNames },
- { kEventClassAccessibility, kEventAccessiblePerformNamedAction },
- { kEventClassAccessibility, kEventAccessibleGetNamedActionDescription }
-};
-
-static void installAcessibilityEventHandler(HIObjectRef hiObject)
-{
- if (!accessibilityEventHandlerUPP)
- accessibilityEventHandlerUPP = NewEventHandlerUPP(accessibilityEventHandler);
-
- InstallHIObjectEventHandler(hiObject, accessibilityEventHandlerUPP,
- GetEventTypeCount(accessibilityEvents),
- accessibilityEvents, 0, 0);
-}
-
-static OSStatus objectCreateEventHandler(EventHandlerCallRef next_ref, EventRef event, void *data)
-{
- Q_UNUSED(data)
- Q_UNUSED(event)
- Q_UNUSED(next_ref)
- return noErr;
-}
-
-static void registerQtAccessibilityHIObjectSubclass()
-{
- if (!objectCreateEventHandlerUPP)
- objectCreateEventHandlerUPP = NewEventHandlerUPP(objectCreateEventHandler);
- OSStatus err = HIObjectRegisterSubclass(kObjectQtAccessibility, 0, 0, objectCreateEventHandlerUPP,
- GetEventTypeCount(objectCreateEvents), objectCreateEvents, 0, 0);
- if (err && err != hiObjectClassExistsErr)
- qWarning("qaccessible_mac internal error: Could not register accessibility HIObject subclass");
-}
-
-static void installApplicationEventhandler()
-{
- if (!applicationEventHandlerUPP)
- applicationEventHandlerUPP = NewEventHandlerUPP(applicationEventHandler);
-
- OSStatus err = InstallApplicationEventHandler(applicationEventHandlerUPP,
- GetEventTypeCount(application_events), application_events,
- 0, 0);
-
- if (err && err != eventHandlerAlreadyInstalledErr)
- qWarning("qaccessible_mac internal error: Could not install application accessibility event handler");
-}
-
-static void removeEventhandler(EventHandlerUPP eventHandler)
-{
- if (eventHandler) {
- DisposeEventHandlerUPP(eventHandler);
- eventHandler = 0;
- }
-}
diff --git a/src/gui/accessible/qaccessible_mac_cocoa.mm b/src/gui/accessible/qaccessible_mac_cocoa.mm
deleted file mode 100644
index 461b61aacf..0000000000
--- a/src/gui/accessible/qaccessible_mac_cocoa.mm
+++ /dev/null
@@ -1,239 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include "qaccessible.h"
-#include "qaccessible_mac_p.h"
-#include "qdebug.h"
-#include "qtabwidget.h"
-
-#include <private/qt_mac_p.h>
-#include <private/qcocoaview_mac_p.h>
-#include <private/qwidget_p.h>
-
-
-#ifndef QT_NO_ACCESSIBILITY
-
-#ifdef QT_MAC_USE_COCOA
-
-QT_BEGIN_NAMESPACE
-
-//#define MAC_ACCESSIBILTY_DEVELOPER_MODE
-
-#ifndef QT_NO_DEBUG_STREAM
-#ifdef MAC_ACCESSIBILTY_DEVELOPER_MODE
-#define MAC_ACCESSIBILTY_DEBUG QT_PREPEND_NAMESPACE(qDebug)
-#else
-#define MAC_ACCESSIBILTY_DEBUG if (0) QT_PREPEND_NAMESPACE(qDebug)
-#endif
-#else
-#define MAC_ACCESSIBILTY_DEBUG if (0) QT_PREPEND_NAMESPACE(QNoDebug)
-#endif
-
-typedef QMap<QAccessible::Role, NSString *> QMacAccessibiltyRoleMap;
-Q_GLOBAL_STATIC(QMacAccessibiltyRoleMap, qMacAccessibiltyRoleMap);
-
-static QAInterface interfaceForView(QT_MANGLE_NAMESPACE(QCocoaView) *view)
-{
- return QAInterface(QAccessible::queryAccessibleInterface([view qt_qwidget]));
-}
-
-/*
- Set up mappings from Qt accessibilty roles to Mac accessibilty roles.
-*/
-static void populateRoleMap()
-{
- QMacAccessibiltyRoleMap &roleMap = *qMacAccessibiltyRoleMap();
- roleMap[QAccessible::MenuItem] = NSAccessibilityMenuItemRole;
- roleMap[QAccessible::MenuBar] = NSAccessibilityMenuBarRole;
- roleMap[QAccessible::ScrollBar] = NSAccessibilityScrollBarRole;
- roleMap[QAccessible::Grip] = NSAccessibilityGrowAreaRole;
- roleMap[QAccessible::Window] = NSAccessibilityWindowRole;
- roleMap[QAccessible::Dialog] = NSAccessibilityWindowRole;
- roleMap[QAccessible::AlertMessage] = NSAccessibilityWindowRole;
- roleMap[QAccessible::ToolTip] = NSAccessibilityWindowRole;
- roleMap[QAccessible::HelpBalloon] = NSAccessibilityWindowRole;
- roleMap[QAccessible::PopupMenu] = NSAccessibilityMenuRole;
- roleMap[QAccessible::Application] = NSAccessibilityApplicationRole;
- roleMap[QAccessible::Pane] = NSAccessibilityGroupRole;
- roleMap[QAccessible::Grouping] = NSAccessibilityGroupRole;
- roleMap[QAccessible::Separator] = NSAccessibilitySplitterRole;
- roleMap[QAccessible::ToolBar] = NSAccessibilityToolbarRole;
- roleMap[QAccessible::PageTab] = NSAccessibilityRadioButtonRole;
- roleMap[QAccessible::ButtonMenu] = NSAccessibilityMenuButtonRole;
- roleMap[QAccessible::ButtonDropDown] = NSAccessibilityPopUpButtonRole;
- roleMap[QAccessible::SpinBox] = NSAccessibilityIncrementorRole;
- roleMap[QAccessible::Slider] = NSAccessibilitySliderRole;
- roleMap[QAccessible::ProgressBar] = NSAccessibilityProgressIndicatorRole;
- roleMap[QAccessible::ComboBox] = NSAccessibilityPopUpButtonRole;
- roleMap[QAccessible::RadioButton] = NSAccessibilityRadioButtonRole;
- roleMap[QAccessible::CheckBox] = NSAccessibilityCheckBoxRole;
- roleMap[QAccessible::StaticText] = NSAccessibilityStaticTextRole;
- roleMap[QAccessible::Table] = NSAccessibilityTableRole;
- roleMap[QAccessible::StatusBar] = NSAccessibilityStaticTextRole;
- roleMap[QAccessible::Column] = NSAccessibilityColumnRole;
- roleMap[QAccessible::ColumnHeader] = NSAccessibilityColumnRole;
- roleMap[QAccessible::Row] = NSAccessibilityRowRole;
- roleMap[QAccessible::RowHeader] = NSAccessibilityRowRole;
- roleMap[QAccessible::Cell] = NSAccessibilityTextFieldRole;
- roleMap[QAccessible::PushButton] = NSAccessibilityButtonRole;
- roleMap[QAccessible::EditableText] = NSAccessibilityTextFieldRole;
- roleMap[QAccessible::Link] = NSAccessibilityTextFieldRole;
- roleMap[QAccessible::Indicator] = NSAccessibilityValueIndicatorRole;
- roleMap[QAccessible::Splitter] = NSAccessibilitySplitGroupRole;
- roleMap[QAccessible::List] = NSAccessibilityListRole;
- roleMap[QAccessible::ListItem] = NSAccessibilityStaticTextRole;
- roleMap[QAccessible::Cell] = NSAccessibilityStaticTextRole;
-}
-
-/*
- Returns a Mac accessibility role for the given interface, or
- NSAccessibilityUnknownRole if no role mapping is found.
-*/
-static NSString *macRoleForInterface(QAInterface interface)
-{
- const QAccessible::Role qtRole = interface.role();
- QMacAccessibiltyRoleMap &roleMap = *qMacAccessibiltyRoleMap();
-
- if (roleMap.isEmpty())
- populateRoleMap();
-
- MAC_ACCESSIBILTY_DEBUG() << "role for" << interface.object() << "interface role" << hex << qtRole;
-
- if (roleMap.contains(qtRole)) {
- MAC_ACCESSIBILTY_DEBUG() << "return" << roleMap[qtRole];
- return roleMap[qtRole];
- }
-
- MAC_ACCESSIBILTY_DEBUG() << "return NSAccessibilityUnknownRole";
- return NSAccessibilityUnknownRole;
-}
-
-/*
- Is the interface a QTabBar embedded in a QTabWidget?
- (as opposed to a stand-alone tab bar)
-*/
-static bool isEmbeddedTabBar(const QAInterface &interface)
-{
- QObject *object = interface.object();
- if (interface.role() == QAccessible::PageTabList && object)
- return (qobject_cast<QTabWidget *>(object->parent()));
-
- return false;
-}
-
-static bool isInterfaceIgnored(QAInterface interface)
-{
- // Mac accessibility does not have an attribute that corresponds to the
- // Invisible/Offscreen state. Use the ignore facility to disable them.
- const QAccessible::State state = interface.state();
- if (state & QAccessible::Invisible ||
- state & QAccessible::Offscreen )
- return false;
-
- // Hide QTabBars that has a QTabWidget parent (the QTabWidget handles the accessibility)
- if (isEmbeddedTabBar(interface))
- return false;
-
- if (QObject * const object = interface.object()) {
- const QString className = QLatin1String(object->metaObject()->className());
-
- // Prevent VoiceOver from focusing on tool tips by ignoring those
- // interfaces. Shifting VoiceOver focus to the tool tip is confusing
- // and the contents of the tool tip is avalible through the description
- // attribute anyway.
- if (className == QLatin1String("QTipLabel"))
- return false;
- }
-
- // Hide interfaces with an unknown role. When developing it's often useful to disable
- // this check to see all interfaces in the hierarchy.
-#ifndef MAC_ACCESSIBILTY_DEVELOPER_MODE
- return [macRoleForInterface(interface) isEqualToString: NSAccessibilityUnknownRole];
-#else
- return NO;
-#endif
-}
-
-QT_END_NAMESPACE
-
-@implementation QT_MANGLE_NAMESPACE(QCocoaView) (Accessibility)
-
-- (BOOL)accessibilityIsIgnored
-{
- QT_PREPEND_NAMESPACE(QAInterface) interface = QT_PREPEND_NAMESPACE(interfaceForView)(self);
- return isInterfaceIgnored(interface);
-}
-
-- (NSArray *)accessibilityAttributeNames
-{
- QT_PREPEND_NAMESPACE(QAInterface) interface = QT_PREPEND_NAMESPACE(interfaceForView)(self);
-
- static NSArray *attributes = nil;
- if (attributes == nil) {
- attributes = [super accessibilityAttributeNames];
-
- }
- return attributes;
-}
-
-- (id)accessibilityAttributeValue:(NSString *)attribute
-{
- MAC_ACCESSIBILTY_DEBUG() << "accessibilityAttributeValue" << self <<
- QT_PREPEND_NAMESPACE(QCFString)::toQString(reinterpret_cast<CFStringRef>(attribute));
-
- QT_PREPEND_NAMESPACE(QAInterface) interface = QT_PREPEND_NAMESPACE(interfaceForView)(self);
-
- // Switch on the attribute name and call the appropriate handler function.
- // Pass the call on to the NSView class for attributes we don't handle.
- if ([attribute isEqualToString:@"AXRole"]) {
- return macRoleForInterface(interface);
- } else {
- return [super accessibilityAttributeValue:attribute];
- }
-}
-
-@end
-
-#endif // QT_MAC_USE_COCOA
-
-#endif // QT_NO_ACCESSIBILITY
-
diff --git a/src/gui/accessible/qaccessible_mac_p.h b/src/gui/accessible/qaccessible_mac_p.h
deleted file mode 100644
index 9b7d25a334..0000000000
--- a/src/gui/accessible/qaccessible_mac_p.h
+++ /dev/null
@@ -1,479 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QACCESSIBLE_MAC_P_H
-#define QACCESSIBLE_MAC_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 <qglobal.h>
-#include <private/qt_mac_p.h>
-#include <qaccessible.h>
-#include <qwidget.h>
-#include <qdebug.h>
-
-//#define Q_ACCESSIBLE_MAC_DEBUG
-
-QT_BEGIN_NAMESPACE
-
-/*
- QAccessibleInterfaceWrapper wraps QAccessibleInterface and adds
- a ref count. QAccessibleInterfaceWrapper is a "by-value" class.
-*/
-class Q_AUTOTEST_EXPORT QAccessibleInterfaceWrapper
-{
-public:
- QAccessibleInterfaceWrapper()
- : interface(0), childrenIsRegistered(new bool(false)), refCount(new int(1)) { }
-
- QAccessibleInterfaceWrapper(QAccessibleInterface *interface)
- :interface(interface), childrenIsRegistered(new bool(false)), refCount(new int(1)) { }
-
- ~QAccessibleInterfaceWrapper()
- {
- if (--(*refCount) == 0) {
- delete interface;
- delete refCount;
- delete childrenIsRegistered;
- }
- }
-
- QAccessibleInterfaceWrapper(const QAccessibleInterfaceWrapper &other)
- :interface(other.interface), childrenIsRegistered(other.childrenIsRegistered), refCount(other.refCount)
- {
- ++(*refCount);
- }
-
- void operator=(const QAccessibleInterfaceWrapper &other)
- {
- if (other.interface == interface)
- return;
-
- if (--(*refCount) == 0) {
- delete interface;
- delete refCount;
- delete childrenIsRegistered;
- }
-
- interface = other.interface;
- childrenIsRegistered = other.childrenIsRegistered;
- refCount = other.refCount;
- ++(*refCount);
- }
-
- QAccessibleInterface *interface;
- bool *childrenIsRegistered;
-private:
- int *refCount;
-};
-
-/*
- QAInterface represents one accessiblity item. It hides the fact that
- one QAccessibleInterface may represent more than one item, and it also
- automates the memory management for QAccessibleInterfaces using the
- QAccessibleInterfaceWrapper wrapper class.
-
- It has the same API as QAccessibleInterface, minus the child parameter
- in the functions.
-*/
-class Q_AUTOTEST_EXPORT QAInterface : public QAccessible
-{
-public:
- QAInterface()
- : base(QAccessibleInterfaceWrapper())
- { }
-
- QAInterface(QAccessibleInterface *interface, int child = 0)
- {
- if (interface == 0 || child > interface->childCount()) {
- base = QAccessibleInterfaceWrapper();
- } else {
- base = QAccessibleInterfaceWrapper(interface);
- m_cachedObject = interface->object();
- this->child = child;
- }
- }
-
- QAInterface(QAccessibleInterfaceWrapper wrapper, int child = 0)
- :base(wrapper), m_cachedObject(wrapper.interface->object()), child(child)
- { }
-
- QAInterface(const QAInterface &other, int child)
- {
- if (other.isValid() == false || child > other.childCount()) {
- base = QAccessibleInterfaceWrapper();
- } else {
- base = other.base;
- m_cachedObject = other.m_cachedObject;
- this->child = child;
- }
- }
-
- bool operator==(const QAInterface &other) const;
- bool operator!=(const QAInterface &other) const;
-
- inline QString actionText (int action, Text text) const
- { return base.interface->actionText(action, text, child); }
-
- QAInterface childAt(int x, int y) const
- {
- if (!checkValid())
- return QAInterface();
-
- const int foundChild = base.interface->childAt(x, y);
-
- if (foundChild == -1)
- return QAInterface();
-
- if (child == 0)
- return navigate(QAccessible::Child, foundChild);
-
- if (foundChild == child)
- return *this;
- return QAInterface();
- }
-
- int indexOfChild(const QAInterface &child) const
- {
- if (!checkValid())
- return -1;
-
- if (*this != child.parent())
- return -1;
-
- if (object() == child.object())
- return child.id();
-
- return base.interface->indexOfChild(child.base.interface);
- }
-
- inline int childCount() const
- {
- if (!checkValid())
- return 0;
-
- if (child != 0)
- return 0;
- return base.interface->childCount();
- }
-
- QList<QAInterface> children() const
- {
- if (!checkValid())
- return QList<QAInterface>();
-
- QList<QAInterface> children;
- for (int i = 1; i <= childCount(); ++i) {
- children.append(navigate(QAccessible::Child, i));
- }
- return children;
- }
-
- QAInterface childAt(int index) const
- {
- return navigate(QAccessible::Child, index);
- }
-
- inline void doAction(int action, const QVariantList &params = QVariantList()) const
- {
- if (!checkValid())
- return;
-
- base.interface->doAction(action, child, params);
- }
-
- QAInterface navigate(RelationFlag relation, int entry) const;
-
- inline QObject * object() const
- {
- if (!checkValid())
- return 0;
-
- return base.interface->object();
- }
-
- QAInterface objectInterface() const
- {
- if (!checkValid())
- return QAInterface();
-
- QObject *obj = object();
- QAInterface current = *this;
- while (obj == 0)
- {
- QAInterface parent = current.parent();
- if (parent.isValid() == false)
- break;
- obj = parent.object();
- current = parent;
- }
- return current;
- }
-
- inline HIObjectRef hiObject() const
- {
- if (!checkValid())
- return 0;
- QWidget * const widget = qobject_cast<QWidget * const>(object());
- if (widget)
- return (HIObjectRef)widget->winId();
- else
- return 0;
- }
-
- inline QObject * cachedObject() const
- {
- if (!checkValid())
- return 0;
- return m_cachedObject;
- }
-
- inline QRect rect() const
- {
- if (!checkValid())
- return QRect();
- return base.interface->rect(child);
- }
-
- inline Role role() const
- {
- if (!checkValid())
- return QAccessible::NoRole;
- return base.interface->role(child);
- }
-
- inline void setText(Text t, const QString &text) const
- {
- if (!checkValid())
- return;
- base.interface->setText(t, child, text);
- }
-
- inline State state() const
- {
- if (!checkValid())
- return 0;
- return base.interface->state(child);
- }
-
- inline QString text (Text text) const
- {
- if (!checkValid())
- return QString();
- return base.interface->text(text, child);
- }
-
- inline QString value() const
- { return text(QAccessible::Value); }
-
- inline QString name() const
- { return text(QAccessible::Name); }
-
- inline int userActionCount() const
- {
- if (!checkValid())
- return 0;
- return base.interface->userActionCount(child);
- }
-
- inline QString className() const
- {
- if (!checkValid())
- return QString();
- return QLatin1String(base.interface->object()->metaObject()->className());
- }
-
- inline bool isHIView() const
- { return (child == 0 && object() != 0); }
-
- inline int id() const
- { return child; }
-
- inline bool isValid() const
- {
- return (base.interface != 0 && base.interface->isValid());
- }
-
- QAInterface parent() const
- { return navigate(QAccessible::Ancestor, 1); }
-
- QAccessibleInterfaceWrapper interfaceWrapper() const
- { return base; }
-
-protected:
- bool checkValid() const
- {
- const bool valid = isValid();
-#ifdef Q_ACCESSIBLE_MAC_DEBUG
- if (!valid)
- qFatal("QAccessible_mac: tried to use invalid interface.");
-#endif
- return valid;
- }
-
- QAccessibleInterfaceWrapper base;
- QObject *m_cachedObject;
- int child;
-};
-
-Q_AUTOTEST_EXPORT QDebug operator<<(QDebug debug, const QAInterface &interface);
-
-/*
- QAElement is a thin wrapper around an AXUIElementRef that automates
- the ref-counting.
-*/
-class Q_AUTOTEST_EXPORT QAElement
-{
-public:
- QAElement();
- explicit QAElement(AXUIElementRef elementRef);
- QAElement(const QAElement &element);
- QAElement(HIObjectRef, int child);
- ~QAElement();
-
- inline HIObjectRef object() const
- {
-#ifndef Q_WS_MAC64
- return AXUIElementGetHIObject(elementRef);
-#else
- return 0;
-#endif
- }
-
- inline int id() const
- {
- UInt64 theId;
-#ifndef QT_MAC_USE_COCOA
- AXUIElementGetIdentifier(elementRef, &theId);
-#else
- theId = 0;
-#endif
- return theId;
- }
-
- inline AXUIElementRef element() const
- {
- return elementRef;
- }
-
- inline bool isValid() const
- {
- return (elementRef != 0);
- }
-
- void operator=(const QAElement &other);
- bool operator==(const QAElement &other) const;
-private:
- AXUIElementRef elementRef;
-};
-
-
-class QInterfaceFactory
-{
-public:
- virtual QAInterface interface(UInt64 identifier) = 0;
- virtual QAElement element(int id) = 0;
- virtual QAElement element(const QAInterface &interface)
- {
- return element(interface.id());
- }
- virtual void registerChildren() = 0;
- virtual ~QInterfaceFactory() {}
-};
-
-/*
- QAccessibleHierarchyManager bridges the Mac and Qt accessibility hierarchies.
- There is a one-to-one relationship between QAElements on the Mac side
- and QAInterfaces on the Qt side, and this class provides lookup functions
- that translates between these to items.
-
- The identity of a QAInterface is determined by its QAccessibleInterface and
- child identifier, and the identity of a QAElement is determined by its
- HIObjectRef and identifier.
-
- QAccessibleHierarchyManager receives QObject::destroyed() signals and deletes
- the accessibility objects for destroyed objects.
-*/
-class Q_AUTOTEST_EXPORT QAccessibleHierarchyManager : public QObject
-{
-Q_OBJECT
-public:
- ~QAccessibleHierarchyManager() { reset(); }
- static QAccessibleHierarchyManager *instance();
- void reset();
-
- QAElement registerInterface(QObject *object, int child);
- QAElement registerInterface(const QAInterface &interface);
- void registerInterface(QObject *object, HIObjectRef hiobject, QInterfaceFactory *interfaceFactory);
-
- void registerChildren(const QAInterface &interface);
-
- QAInterface lookup(const AXUIElementRef &element);
- QAInterface lookup(const QAElement &element);
- QAElement lookup(const QAInterface &interface);
- QAElement lookup(QObject * const object, int id);
-private slots:
- void objectDestroyed(QObject *);
-private:
- typedef QHash<QObject *, QInterfaceFactory *> QObjectElementHash;
- typedef QHash<HIObjectRef, QInterfaceFactory *> HIObjectInterfaceHash;
- typedef QHash<QObject *, HIObjectRef> QObjectHIObjectHash;
-
- QObjectElementHash qobjectElementHash;
- HIObjectInterfaceHash hiobjectInterfaceHash;
- QObjectHIObjectHash qobjectHiobjectHash;
-};
-
-Q_AUTOTEST_EXPORT bool isItInteresting(const QAInterface &interface);
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/accessible/qaccessiblebridge.cpp b/src/gui/accessible/qaccessiblebridge.cpp
index b08a2e83bf..d702972cd2 100644
--- a/src/gui/accessible/qaccessiblebridge.cpp
+++ b/src/gui/accessible/qaccessiblebridge.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/accessible/qaccessiblebridge.h b/src/gui/accessible/qaccessiblebridge.h
index 73edf51183..d0470f38e6 100644
--- a/src/gui/accessible/qaccessiblebridge.h
+++ b/src/gui/accessible/qaccessiblebridge.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp
index 18941437fe..e271df2a13 100644
--- a/src/gui/accessible/qaccessibleobject.cpp
+++ b/src/gui/accessible/qaccessibleobject.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -96,6 +96,8 @@ QList<QByteArray> QAccessibleObjectPrivate::actionList() const
\ingroup accessibility
\inmodule QtWidgets
+ This class is part of \l {Accessibility for QWidget Applications}.
+
This class is mainly provided for convenience. All subclasses of
the QAccessibleInterface that provide implementations of non-widget objects
should use this class as their base class.
@@ -154,6 +156,18 @@ void QAccessibleObject::setText(QAccessible::Text, const QString &)
{
}
+/*! \reimp */
+QAccessibleInterface *QAccessibleObject::childAt(int x, int y) const
+{
+ for (int i = 0; i < childCount(); ++i) {
+ QAccessibleInterface *childIface = child(i);
+ if (childIface->rect().contains(x,y)) {
+ return childIface;
+ }
+ }
+ return 0;
+}
+
/*!
\class QAccessibleApplication
\brief The QAccessibleApplication class implements the QAccessibleInterface for QApplication.
@@ -207,23 +221,7 @@ int QAccessibleApplication::childCount() const
int QAccessibleApplication::indexOfChild(const QAccessibleInterface *child) const
{
const QObjectList tlw(topLevelObjects());
- int index = tlw.indexOf(child->object());
- if (index != -1)
- ++index;
- return index;
-}
-
-/*! \reimp */
-int QAccessibleApplication::childAt(int x, int y) const
-{
- for (int i = 0; i < childCount(); ++i) {
- QAccessibleInterface *childIface = child(i);
- QRect geom = childIface->rect();
- if (geom.contains(x,y))
- return i+1;
- delete childIface;
- }
- return rect().contains(x,y) ? 0 : -1;
+ return tlw.indexOf(child->object());
}
/*! \reimp */
@@ -273,9 +271,6 @@ int QAccessibleApplication::navigate(QAccessible::RelationFlag relation, int,
return 0;
}
break;
- case QAccessible::Ancestor:
- *target = parent();
- return 0;
default:
break;
}
@@ -306,7 +301,7 @@ QAccessible::Role QAccessibleApplication::role() const
/*! \reimp */
QAccessible::State QAccessibleApplication::state() const
{
- return QGuiApplication::activeWindow() ? QAccessible::Focused : QAccessible::Normal;
+ return QAccessible::State();
}
diff --git a/src/gui/accessible/qaccessibleobject.h b/src/gui/accessible/qaccessibleobject.h
index f2a9fd0430..58b95baffa 100644
--- a/src/gui/accessible/qaccessibleobject.h
+++ b/src/gui/accessible/qaccessibleobject.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -67,6 +67,7 @@ public:
// properties
QRect rect() const;
void setText(QAccessible::Text t, const QString &text);
+ QAccessibleInterface *childAt(int x, int y) const;
protected:
virtual ~QAccessibleObject();
@@ -89,7 +90,6 @@ public:
// navigation
QAccessibleInterface *parent() const;
- int childAt(int x, int y) const;
QAccessibleInterface *child(int index) const;
int navigate(QAccessible::RelationFlag, int, QAccessibleInterface **) const;
diff --git a/src/gui/accessible/qaccessibleplugin.cpp b/src/gui/accessible/qaccessibleplugin.cpp
index 618a31ad5e..0d9d57b0ec 100644
--- a/src/gui/accessible/qaccessibleplugin.cpp
+++ b/src/gui/accessible/qaccessibleplugin.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/accessible/qaccessibleplugin.h b/src/gui/accessible/qaccessibleplugin.h
index 4e09034dfd..d3610e40f6 100644
--- a/src/gui/accessible/qaccessibleplugin.h
+++ b/src/gui/accessible/qaccessibleplugin.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/accessible/qplatformaccessibility_qpa.cpp b/src/gui/accessible/qplatformaccessibility_qpa.cpp
index 7df827552d..47c351921e 100644
--- a/src/gui/accessible/qplatformaccessibility_qpa.cpp
+++ b/src/gui/accessible/qplatformaccessibility_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -123,10 +123,7 @@ void QPlatformAccessibility::initialize()
if (isInit)
return;
isInit = true; // ### not atomic
-#ifdef Q_OS_UNIX
- if (qgetenv("QT_ACCESSIBILITY") != "1")
- return;
-#endif
+
#ifndef QT_NO_LIBRARY
const QStringList l = bridgeloader()->keys();
for (int i = 0; i < l.count(); ++i) {
diff --git a/src/gui/accessible/qplatformaccessibility_qpa.h b/src/gui/accessible/qplatformaccessibility_qpa.h
index 2931f4180a..15297110b8 100644
--- a/src/gui/accessible/qplatformaccessibility_qpa.h
+++ b/src/gui/accessible/qplatformaccessibility_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index 4675533144..4ee656f777 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index db8d8b7a38..02712b4026 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/egl/qegl_qpa.cpp b/src/gui/egl/qegl_qpa.cpp
index c3eb044b22..2b7daf47b2 100644
--- a/src/gui/egl/qegl_qpa.cpp
+++ b/src/gui/egl/qegl_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/egl/qegl_stub.cpp b/src/gui/egl/qegl_stub.cpp
index 783393c148..3d9d72587e 100644
--- a/src/gui/egl/qegl_stub.cpp
+++ b/src/gui/egl/qegl_stub.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/egl/qeglcontext_p.h b/src/gui/egl/qeglcontext_p.h
index 7ea18627d1..70cdfc72ac 100644
--- a/src/gui/egl/qeglcontext_p.h
+++ b/src/gui/egl/qeglcontext_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp
index 7f4785499d..29b1cd371d 100644
--- a/src/gui/egl/qeglproperties.cpp
+++ b/src/gui/egl/qeglproperties.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/egl/qeglproperties_p.h b/src/gui/egl/qeglproperties_p.h
index ec596200fb..d7bc0893d4 100644
--- a/src/gui/egl/qeglproperties_p.h
+++ b/src/gui/egl/qeglproperties_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/egl/qeglproperties_stub.cpp b/src/gui/egl/qeglproperties_stub.cpp
index c04f6a1070..7be8a0a4b9 100644
--- a/src/gui/egl/qeglproperties_stub.cpp
+++ b/src/gui/egl/qeglproperties_stub.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp
index 4c03379550..6c1320e868 100644
--- a/src/gui/image/qbitmap.cpp
+++ b/src/gui/image/qbitmap.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qbitmap.h b/src/gui/image/qbitmap.h
index a3104f5083..5740b874db 100644
--- a/src/gui/image/qbitmap.h
+++ b/src/gui/image/qbitmap.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp
index 3011a6c130..3d9f8228f2 100644
--- a/src/gui/image/qbmphandler.cpp
+++ b/src/gui/image/qbmphandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qbmphandler_p.h b/src/gui/image/qbmphandler_p.h
index 373f8fbaaf..f2eb8f69b2 100644
--- a/src/gui/image/qbmphandler_p.h
+++ b/src/gui/image/qbmphandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qgifhandler.cpp b/src/gui/image/qgifhandler.cpp
index 2708790947..6968ca6736 100644
--- a/src/gui/image/qgifhandler.cpp
+++ b/src/gui/image/qgifhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qgifhandler_p.h b/src/gui/image/qgifhandler_p.h
index ca82f3c979..0d9724a071 100644
--- a/src/gui/image/qgifhandler_p.h
+++ b/src/gui/image/qgifhandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index c107fea919..564abd2af2 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -114,17 +114,6 @@ static QImage rotated90(const QImage &src);
static QImage rotated180(const QImage &src);
static QImage rotated270(const QImage &src);
-// ### Qt 5: remove
-Q_GUI_EXPORT qint64 qt_image_id(const QImage &image)
-{
- return image.cacheKey();
-}
-
-const QVector<QRgb> *qt_image_colortable(const QImage &image)
-{
- return &image.d->colortable;
-}
-
QBasicAtomicInt qimage_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1);
QImageData::QImageData()
@@ -5874,4 +5863,12 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla
\internal
*/
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QImage &i)
+{
+ dbg.nospace() << "QImage(" << i.size() << ')';
+ return dbg.space();
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index a18d81068e..7a5a732c9a 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -295,8 +295,6 @@ private:
friend class QRasterPlatformPixmap;
friend class QBlittablePlatformPixmap;
friend class QPixmapCacheEntry;
- friend Q_GUI_EXPORT qint64 qt_image_id(const QImage &image);
- friend const QVector<QRgb> *qt_image_colortable(const QImage &image);
public:
typedef QImageData * DataPtr;
@@ -363,9 +361,9 @@ inline QString QImage::text(const QImageTextKeyLang&kl) const
{
if (!d)
return QString();
- QString k = QString::fromAscii(kl.key);
+ QString k = QString::fromAscii(kl.key.constData());
if (!kl.lang.isEmpty())
- k += QLatin1Char('/') + QString::fromAscii(kl.lang);
+ k += QLatin1Char('/') + QString::fromAscii(kl.lang.constData());
return text(k);
}
@@ -408,6 +406,11 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QImage &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QImage &);
#endif
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QImage &);
+#endif
+
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/image/qimage_neon.cpp b/src/gui/image/qimage_neon.cpp
index a91bd94b03..cdf817b051 100644
--- a/src/gui/image/qimage_neon.cpp
+++ b/src/gui/image/qimage_neon.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index 77b9a7d1a1..6e846fd0cf 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimage_sse2.cpp b/src/gui/image/qimage_sse2.cpp
index fe0bf8b303..872d1d6be7 100644
--- a/src/gui/image/qimage_sse2.cpp
+++ b/src/gui/image/qimage_sse2.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimage_ssse3.cpp b/src/gui/image/qimage_ssse3.cpp
index fcdd4e5eb2..95cf694d2a 100644
--- a/src/gui/image/qimage_ssse3.cpp
+++ b/src/gui/image/qimage_ssse3.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimageiohandler.cpp b/src/gui/image/qimageiohandler.cpp
index 80e8fec9d0..d9691563b1 100644
--- a/src/gui/image/qimageiohandler.cpp
+++ b/src/gui/image/qimageiohandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimageiohandler.h b/src/gui/image/qimageiohandler.h
index ace49c9be0..188b4ef1a8 100644
--- a/src/gui/image/qimageiohandler.h
+++ b/src/gui/image/qimageiohandler.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp
index 7901045593..e83897aced 100644
--- a/src/gui/image/qimagepixmapcleanuphooks.cpp
+++ b/src/gui/image/qimagepixmapcleanuphooks.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimagepixmapcleanuphooks_p.h b/src/gui/image/qimagepixmapcleanuphooks_p.h
index c98da6110a..11abe173c4 100644
--- a/src/gui/image/qimagepixmapcleanuphooks_p.h
+++ b/src/gui/image/qimagepixmapcleanuphooks_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 4bf4b08349..b6345191d6 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimagereader.h b/src/gui/image/qimagereader.h
index b85ef2b61d..f132991d92 100644
--- a/src/gui/image/qimagereader.h
+++ b/src/gui/image/qimagereader.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index 82ae64593a..b7d57fa4d3 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimagewriter.h b/src/gui/image/qimagewriter.h
index cc7fdd2871..5aac7e8599 100644
--- a/src/gui/image/qimagewriter.h
+++ b/src/gui/image/qimagewriter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp
index 673a6d63d9..f0f9368e22 100644
--- a/src/gui/image/qjpeghandler.cpp
+++ b/src/gui/image/qjpeghandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qjpeghandler_p.h b/src/gui/image/qjpeghandler_p.h
index c573b4944e..7827804959 100644
--- a/src/gui/image/qjpeghandler_p.h
+++ b/src/gui/image/qjpeghandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qmnghandler.cpp b/src/gui/image/qmnghandler.cpp
index 179fff8e93..6a6ee8d2cf 100644
--- a/src/gui/image/qmnghandler.cpp
+++ b/src/gui/image/qmnghandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qmnghandler_p.h b/src/gui/image/qmnghandler_p.h
index f217f0da7f..42b4fd06a8 100644
--- a/src/gui/image/qmnghandler_p.h
+++ b/src/gui/image/qmnghandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp
index ff00059f51..0be6833a87 100644
--- a/src/gui/image/qmovie.cpp
+++ b/src/gui/image/qmovie.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1017,15 +1017,6 @@ void QMovie::setCacheMode(CacheMode cacheMode)
d->cacheMode = cacheMode;
}
-/*!
- \internal
-*/
-QMovie::CacheMode QMovie::cacheMode()
-{
- Q_D(QMovie);
- return d->cacheMode;
-}
-
QT_END_NAMESPACE
#include "moc_qmovie.cpp"
diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h
index 0278957091..eb2b81d0b5 100644
--- a/src/gui/image/qmovie.h
+++ b/src/gui/image/qmovie.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -125,8 +125,6 @@ public:
CacheMode cacheMode() const;
void setCacheMode(CacheMode mode);
- CacheMode cacheMode(); // ### Qt 5: remove me
-
Q_SIGNALS:
void started();
void resized(const QSize &size);
diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp
index 30c1c0621e..776a17857e 100644
--- a/src/gui/image/qnativeimage.cpp
+++ b/src/gui/image/qnativeimage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qnativeimage_p.h b/src/gui/image/qnativeimage_p.h
index 433460b463..0d8834cad3 100644
--- a/src/gui/image/qnativeimage_p.h
+++ b/src/gui/image/qnativeimage_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpaintengine_pic.cpp b/src/gui/image/qpaintengine_pic.cpp
index ec3a4a050a..cf9ecc17da 100644
--- a/src/gui/image/qpaintengine_pic.cpp
+++ b/src/gui/image/qpaintengine_pic.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpaintengine_pic_p.h b/src/gui/image/qpaintengine_pic_p.h
index 4307e3ad69..830867d89d 100644
--- a/src/gui/image/qpaintengine_pic_p.h
+++ b/src/gui/image/qpaintengine_pic_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp
index dfc84c56d8..1ca34df356 100644
--- a/src/gui/image/qpicture.cpp
+++ b/src/gui/image/qpicture.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1008,17 +1008,6 @@ int QPicture::metric(PaintDeviceMetric m) const
\internal
*/
-/*! \internal
-### Qt 5 - remove me
- */
-void QPicture::detach_helper()
-{
- // QExplicitelySharedDataPointer takes care of cloning using
- // QPicturePrivate's copy constructor. Do not call detach_helper() anymore
- // and remove in Qt 5, please.
- Q_ASSERT_X(false, "QPicture::detach_helper()", "Do not call this function");
-}
-
/*!
Assigns picture \a p to this picture and returns a reference to
this picture.
diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h
index 1c5d3a9c8f..e408d65cbc 100644
--- a/src/gui/image/qpicture.h
+++ b/src/gui/image/qpicture.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -107,7 +107,6 @@ protected:
private:
bool exec(QPainter *p, QDataStream &ds, int i);
- void detach_helper();
QExplicitlySharedDataPointer<QPicturePrivate> d_ptr;
friend class QPicturePaintEngine;
diff --git a/src/gui/image/qpicture_p.h b/src/gui/image/qpicture_p.h
index 097ba72e60..8c68d19558 100644
--- a/src/gui/image/qpicture_p.h
+++ b/src/gui/image/qpicture_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpictureformatplugin.cpp b/src/gui/image/qpictureformatplugin.cpp
index 175406e661..558d4febce 100644
--- a/src/gui/image/qpictureformatplugin.cpp
+++ b/src/gui/image/qpictureformatplugin.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpictureformatplugin.h b/src/gui/image/qpictureformatplugin.h
index b030c05913..9fd79c001d 100644
--- a/src/gui/image/qpictureformatplugin.h
+++ b/src/gui/image/qpictureformatplugin.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 2a2bd5d6fa..48d393cc24 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1631,4 +1631,12 @@ QPlatformPixmap* QPixmap::handle() const
return data.data();
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QPixmap &r)
+{
+ dbg.nospace() << "QPixmap(" << r.size() << ')';
+ return dbg.space();
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index ea73119538..5e8ef70828 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -238,6 +238,10 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPixmap &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPixmap &);
#endif
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QPixmap &);
+#endif
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index 2a47a891c7..041c11af3a 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h
index b0a9b7f848..42d649642f 100644
--- a/src/gui/image/qpixmap_blitter_p.h
+++ b/src/gui/image/qpixmap_blitter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -72,8 +72,11 @@ public:
void markRasterOverlay(const QRectF &);
void markRasterOverlay(const QPointF &, const QTextItem &);
void markRasterOverlay(const QVectorPath &);
+ void markRasterOverlay(const QPainterPath &);
void markRasterOverlay(const QRect *rects, int rectCount);
void markRasterOverlay(const QRectF *rects, int rectCount);
+ void markRasterOverlay(const QPointF *points, int pointCount);
+ void markRasterOverlay(const QPoint *points, int pointCount);
void unmarkRasterOverlay(const QRectF &);
#ifdef QT_BLITTER_RASTEROVERLAY
@@ -153,6 +156,35 @@ inline void QBlittablePlatformPixmap::markRasterOverlay(const QRectF *rects, int
#endif
}
+inline void QBlittablePlatformPixmap::markRasterOverlay(const QPointF *points, int pointCount)
+{
+#ifdef QT_BLITTER_RASTEROVERLAY
+#error "not ported yet"
+#else
+ Q_UNUSED(points);
+ Q_UNUSED(pointCount);
+#endif
+}
+
+inline void QBlittablePlatformPixmap::markRasterOverlay(const QPoint *points, int pointCount)
+{
+#ifdef QT_BLITTER_RASTEROVERLAY
+#error "not ported yet"
+#else
+ Q_UNUSED(points);
+ Q_UNUSED(pointCount);
+#endif
+}
+
+inline void QBlittablePlatformPixmap::markRasterOverlay(const QPainterPath& path)
+{
+#ifdef QT_BLITTER_RASTEROVERLAY
+#error "not ported yet"
+#else
+ Q_UNUSED(path);
+#endif
+}
+
inline void QBlittablePlatformPixmap::unmarkRasterOverlay(const QRectF &rect)
{
#ifdef QT_BLITTER_RASTEROVERLAY
diff --git a/src/gui/image/qpixmap_qpa.cpp b/src/gui/image/qpixmap_qpa.cpp
index 4fe162efd8..7f2ff2e266 100644
--- a/src/gui/image/qpixmap_qpa.cpp
+++ b/src/gui/image/qpixmap_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 887074c7b7..424572ebd4 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h
index 91ed4cfdc5..de4d0e6f17 100644
--- a/src/gui/image/qpixmap_raster_p.h
+++ b/src/gui/image/qpixmap_raster_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp
index f46d503936..5ee7ca9eba 100644
--- a/src/gui/image/qpixmap_win.cpp
+++ b/src/gui/image/qpixmap_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 94f38347c1..0f874bee6c 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpixmapcache.h b/src/gui/image/qpixmapcache.h
index e5c20c8e78..81f9f4b028 100644
--- a/src/gui/image/qpixmapcache.h
+++ b/src/gui/image/qpixmapcache.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h
index 7b96f5a2cf..2f609a8471 100644
--- a/src/gui/image/qpixmapcache_p.h
+++ b/src/gui/image/qpixmapcache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qplatformpixmap.cpp b/src/gui/image/qplatformpixmap.cpp
index e1bf944d9b..30f1f4819b 100644
--- a/src/gui/image/qplatformpixmap.cpp
+++ b/src/gui/image/qplatformpixmap.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qplatformpixmap_qpa.h b/src/gui/image/qplatformpixmap_qpa.h
index ad0a8dc69e..13c3bc2fe8 100644
--- a/src/gui/image/qplatformpixmap_qpa.h
+++ b/src/gui/image/qplatformpixmap_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 1714442eb6..a935ea3a28 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpnghandler_p.h b/src/gui/image/qpnghandler_p.h
index 1ee22d73c9..8f17bd18a4 100644
--- a/src/gui/image/qpnghandler_p.h
+++ b/src/gui/image/qpnghandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp
index e4dbde8ece..b08f97a3ca 100644
--- a/src/gui/image/qppmhandler.cpp
+++ b/src/gui/image/qppmhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qppmhandler_p.h b/src/gui/image/qppmhandler_p.h
index a1cd9594e9..43e9b09f70 100644
--- a/src/gui/image/qppmhandler_p.h
+++ b/src/gui/image/qppmhandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qtiffhandler.cpp b/src/gui/image/qtiffhandler.cpp
index 4dc9775d46..475622021b 100644
--- a/src/gui/image/qtiffhandler.cpp
+++ b/src/gui/image/qtiffhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -496,13 +496,13 @@ bool QTiffHandler::write(const QImage &image)
}
//// write the color table
// allocate the color tables
- uint16 *redTable = static_cast<uint16 *>(qMalloc(256 * sizeof(uint16)));
- uint16 *greenTable = static_cast<uint16 *>(qMalloc(256 * sizeof(uint16)));
- uint16 *blueTable = static_cast<uint16 *>(qMalloc(256 * sizeof(uint16)));
+ uint16 *redTable = static_cast<uint16 *>(malloc(256 * sizeof(uint16)));
+ uint16 *greenTable = static_cast<uint16 *>(malloc(256 * sizeof(uint16)));
+ uint16 *blueTable = static_cast<uint16 *>(malloc(256 * sizeof(uint16)));
if (!redTable || !greenTable || !blueTable) {
- qFree(redTable);
- qFree(greenTable);
- qFree(blueTable);
+ free(redTable);
+ free(greenTable);
+ free(blueTable);
TIFFClose(tiff);
return false;
}
@@ -519,9 +519,9 @@ bool QTiffHandler::write(const QImage &image)
const bool setColorTableSuccess = TIFFSetField(tiff, TIFFTAG_COLORMAP, redTable, greenTable, blueTable);
- qFree(redTable);
- qFree(greenTable);
- qFree(blueTable);
+ free(redTable);
+ free(greenTable);
+ free(blueTable);
if (!setColorTableSuccess) {
TIFFClose(tiff);
diff --git a/src/gui/image/qtiffhandler_p.h b/src/gui/image/qtiffhandler_p.h
index 4cbcfacaec..16e68b0ad6 100644
--- a/src/gui/image/qtiffhandler_p.h
+++ b/src/gui/image/qtiffhandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qvolatileimage.cpp b/src/gui/image/qvolatileimage.cpp
index 8fd3620b4b..e675e4ca67 100644
--- a/src/gui/image/qvolatileimage.cpp
+++ b/src/gui/image/qvolatileimage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qvolatileimage_p.h b/src/gui/image/qvolatileimage_p.h
index 91f8ce3598..8f1664c429 100644
--- a/src/gui/image/qvolatileimage_p.h
+++ b/src/gui/image/qvolatileimage_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qvolatileimagedata.cpp b/src/gui/image/qvolatileimagedata.cpp
index a2a7f71697..32f265e9d9 100644
--- a/src/gui/image/qvolatileimagedata.cpp
+++ b/src/gui/image/qvolatileimagedata.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qvolatileimagedata_p.h b/src/gui/image/qvolatileimagedata_p.h
index 9f817874a4..2890530aaa 100644
--- a/src/gui/image/qvolatileimagedata_p.h
+++ b/src/gui/image/qvolatileimagedata_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qvolatileimagedata_symbian.cpp b/src/gui/image/qvolatileimagedata_symbian.cpp
index 6984722c0f..f438d96e68 100644
--- a/src/gui/image/qvolatileimagedata_symbian.cpp
+++ b/src/gui/image/qvolatileimagedata_symbian.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp
index 04756ac351..dda57239cc 100644
--- a/src/gui/image/qxbmhandler.cpp
+++ b/src/gui/image/qxbmhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qxbmhandler_p.h b/src/gui/image/qxbmhandler_p.h
index 8fc6bda3f9..13ab343f8b 100644
--- a/src/gui/image/qxbmhandler_p.h
+++ b/src/gui/image/qxbmhandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp
index a3779fc041..48047d2d55 100644
--- a/src/gui/image/qxpmhandler.cpp
+++ b/src/gui/image/qxpmhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qxpmhandler_p.h b/src/gui/image/qxpmhandler_p.h
index 35cf142db5..092d9bb3f1 100644
--- a/src/gui/image/qxpmhandler_p.h
+++ b/src/gui/image/qxpmhandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 57ed3a983a..bf552c9991 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -13,6 +13,7 @@ HEADERS += \
kernel/qplatformintegration_qpa.h \
kernel/qplatformdrag_qpa.h \
kernel/qplatformscreen_qpa.h \
+ kernel/qplatformscreen_qpa_p.h \
kernel/qplatforminputcontext_qpa.h \
kernel/qplatformintegrationfactory_qpa_p.h \
kernel/qplatformintegrationplugin_qpa.h \
@@ -50,6 +51,7 @@ HEADERS += \
kernel/qsessionmanager.h \
kernel/qwindowdefs.h \
kernel/qscreen.h \
+ kernel/qscreen_p.h \
kernel/qstylehints.h \
kernel/qtouchdevice.h \
kernel/qtouchdevice_p.h
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index 970d365af8..341b042328 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h
index 6902a1362b..b909889815 100644
--- a/src/gui/kernel/qclipboard.h
+++ b/src/gui/kernel/qclipboard.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qclipboard_qpa.cpp b/src/gui/kernel/qclipboard_qpa.cpp
index 737b2131c0..edcf21babc 100644
--- a/src/gui/kernel/qclipboard_qpa.cpp
+++ b/src/gui/kernel/qclipboard_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index faa9500f9f..bd327e1eb1 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -49,6 +49,7 @@
#include <qdatastream.h>
#include <qvariant.h>
#include <private/qcursor_p.h>
+#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -564,6 +565,15 @@ QCursor::operator QVariant() const
{
return QVariant(QVariant::Cursor, this);
}
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QCursor &c)
+{
+ dbg.nospace() << "QCursor(Qt::CursorShape(" << c.shape() << "))";
+ return dbg.space();
+}
+#endif
+
QT_END_NAMESPACE
#endif // QT_NO_CURSOR
diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h
index 584aff42d3..7437da4aba 100644
--- a/src/gui/kernel/qcursor.h
+++ b/src/gui/kernel/qcursor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -126,6 +126,11 @@ private:
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &outS, const QCursor &cursor);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &inS, QCursor &cursor);
#endif
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QCursor &);
+#endif
+
#endif // QT_NO_CURSOR
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qcursor_p.h b/src/gui/kernel/qcursor_p.h
index 71a07cca49..a904260388 100644
--- a/src/gui/kernel/qcursor_p.h
+++ b/src/gui/kernel/qcursor_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qcursor_qpa.cpp b/src/gui/kernel/qcursor_qpa.cpp
index 7b3059e1df..6a12f977d3 100644
--- a/src/gui/kernel/qcursor_qpa.cpp
+++ b/src/gui/kernel/qcursor_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index 4edcfa886f..4010fd73ff 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index 548e3d2e77..47018edde8 100644
--- a/src/gui/kernel/qdnd_p.h
+++ b/src/gui/kernel/qdnd_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index 399c467643..284b1e5c1b 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qdrag.h b/src/gui/kernel/qdrag.h
index b590c4f015..ccadd8f1cc 100644
--- a/src/gui/kernel/qdrag.h
+++ b/src/gui/kernel/qdrag.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 035f1b2666..61ccaa5cfd 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -941,15 +941,6 @@ QFocusEvent::~QFocusEvent()
{
}
-// ### Qt 5: remove
-/*!
- \internal
- */
-Qt::FocusReason QFocusEvent::reason()
-{
- return m_reason;
-}
-
/*!
Returns the reason for this focus event.
*/
@@ -3232,13 +3223,6 @@ QClipboardEvent::~QClipboardEvent()
Returns the key sequence that triggered the event.
*/
-// ### Qt 5: remove
-/*!
- \fn const QKeySequence &QShortcutEvent::key()
-
- \internal
-*/
-
/*!
\fn int QShortcutEvent::shortcutId() const
@@ -3248,14 +3232,6 @@ QClipboardEvent::~QClipboardEvent()
\sa QShortcut::id()
*/
-// ### Qt 5: remove
-/*!
- \fn int QShortcutEvent::shortcutId()
- \overload
-
- \internal
-*/
-
/*!
\fn bool QShortcutEvent::isAmbiguous() const
@@ -3265,13 +3241,6 @@ QClipboardEvent::~QClipboardEvent()
\sa QShortcut::activatedAmbiguously()
*/
-// ### Qt 5: remove
-/*!
- \fn bool QShortcutEvent::isAmbiguous()
-
- \internal
-*/
-
/*!
\class QWindowStateChangeEvent
\ingroup events
@@ -3354,7 +3323,7 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent()
\section1 Event Delivery and Propagation
- By default, QWidget::event() translates the first non-primary touch point in a QTouchEvent into
+ By default, QGuiApplication translates the first touch point in a QTouchEvent into
a QMouseEvent. This makes it possible to enable touch events on existing widgets that do not
normally handle QTouchEvent. See below for information on some special considerations needed
when doing this.
@@ -3392,17 +3361,12 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent()
This makes it possible for sibling widgets to handle touch events independently while making
sure that the sequence of QTouchEvents is always correct.
- \section1 Mouse Events and the Primary Touch Point
+ \section1 Mouse Events and Touch Event synthesizing
- QTouchEvent delivery is independent from that of QMouseEvent. On some windowing systems, mouse
- events are also sent for the \l{QTouchEvent::TouchPoint::isPrimary()}{primary touch point}.
- This means it is possible for your widget to receive both QTouchEvent and QMouseEvent for the
- same user interaction point. You can use the QTouchEvent::TouchPoint::isPrimary() function to
- identify the primary touch point.
-
- Note that on some systems, it is possible to receive touch events without a primary touch
- point. All this means is that there will be no mouse event generated for the touch points in
- the QTouchEvent.
+ QTouchEvent delivery is independent from that of QMouseEvent. The application flags
+ Qt::AA_SynthesizeTouchForUnhandledMouseEvents and Qt::AA_SynthesizeMouseForUnhandledTouchEvents
+ can be used to enable or disable automatic synthesizing of touch events to mouse events and
+ mouse events to touch events.
\section1 Caveats
@@ -3441,9 +3405,6 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent()
\value TouchPointMoved The touch point moved.
\value TouchPointStationary The touch point did not move.
\value TouchPointReleased The touch point was released.
-
- \omitvalue TouchPointStateMask
- \omitvalue TouchPointPrimary
*/
/*! \enum QTouchEvent::DeviceType
@@ -3467,7 +3428,8 @@ QTouchEvent::QTouchEvent(QEvent::Type eventType,
Qt::TouchPointStates touchPointStates,
const QList<QTouchEvent::TouchPoint> &touchPoints)
: QInputEvent(eventType, modifiers),
- _widget(0),
+ _window(0),
+ _target(0),
_device(device),
_touchPointStates(touchPointStates),
_touchPoints(touchPoints)
@@ -3479,11 +3441,6 @@ QTouchEvent::QTouchEvent(QEvent::Type eventType,
QTouchEvent::~QTouchEvent()
{ }
-/*! \fn QWidget *QTouchEvent::widget() const
-
- Returns the widget on which the event occurred.
-*/
-
/*! \fn QWindow *QTouchEvent::window() const
Returns the window on which the event occurred. Useful for doing
@@ -3492,6 +3449,12 @@ QTouchEvent::~QTouchEvent()
touch event.
*/
+/*! \fn QObject *QTouchEvent::target() const
+
+ Returns the target object within the window on which the event occurred.
+ This is typically a QWidget or a QQuickItem. May be 0 when no specific target is available.
+*/
+
/*! \fn QTouchEvent::DeviceType QTouchEvent::deviceType() const
Returns the touch device Type, which is of type \l {QTouchEvent::DeviceType} {DeviceType}.
@@ -3521,18 +3484,18 @@ QTouchEvent::~QTouchEvent()
Returns the touch device from which this touch event originates.
*/
-/*! \fn void QTouchEvent::setWidget(QWidget *widget)
+/*! \fn void QTouchEvent::setWindow(QWindow *window)
\internal
- Sets the widget for this event.
+ Sets the window for this event.
*/
-/*! \fn void QTouchEvent::setWindow(QWindow *window)
+/*! \fn void QTouchEvent::setTarget(QObject *target)
\internal
- Sets the window for this event.
+ Sets the target within the window (typically a widget) for this event.
*/
/*! \fn void QTouchEvent::setTouchPointStates(Qt::TouchPointStates touchPointStates)
@@ -3621,16 +3584,7 @@ int QTouchEvent::TouchPoint::id() const
*/
Qt::TouchPointState QTouchEvent::TouchPoint::state() const
{
- return Qt::TouchPointState(int(d->state) & Qt::TouchPointStateMask);
-}
-
-/*!
- Returns true if this touch point is the primary touch point. The primary touch point is the
- point for which the windowing system generates mouse events.
-*/
-bool QTouchEvent::TouchPoint::isPrimary() const
-{
- return (d->state & Qt::TouchPointPrimary) != 0;
+ return Qt::TouchPointState(int(d->state));
}
/*!
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 6a0442509c..a59b178cec 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -266,7 +266,6 @@ public:
inline bool gotFocus() const { return type() == FocusIn; }
inline bool lostFocus() const { return type() == FocusOut; }
- Qt::FocusReason reason();
Qt::FocusReason reason() const;
private:
@@ -639,11 +638,8 @@ public:
QShortcutEvent(const QKeySequence &key, int id, bool ambiguous = false);
~QShortcutEvent();
- inline const QKeySequence &key() { return sequence; }
inline const QKeySequence &key() const { return sequence; }
- inline int shortcutId() { return sid; }
inline int shortcutId() const { return sid; }
- inline bool isAmbiguous() { return ambig; }
inline bool isAmbiguous() const { return ambig; }
protected:
QKeySequence sequence;
@@ -694,7 +690,7 @@ public:
{
public:
enum InfoFlag {
- Pen = 0x0001
+ Pen = 0x0001
};
Q_DECLARE_FLAGS(InfoFlags, InfoFlag)
@@ -705,7 +701,6 @@ public:
int id() const;
Qt::TouchPointState state() const;
- bool isPrimary() const;
QPointF pos() const;
QPointF startPos() const;
@@ -776,23 +771,23 @@ public:
const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>());
~QTouchEvent();
- inline QWidget *widget() const { return _widget; }
inline QWindow *window() const { return _window; }
+ inline QObject *target() const { return _target; }
QT_DEPRECATED inline QTouchEvent::DeviceType deviceType() const { return static_cast<DeviceType>(int(_device->type())); }
inline Qt::TouchPointStates touchPointStates() const { return _touchPointStates; }
inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; }
inline QTouchDevice *device() const { return _device; }
// internal
- inline void setWidget(QWidget *awidget) { _widget = awidget; }
inline void setWindow(QWindow *awindow) { _window = awindow; }
+ inline void setTarget(QObject *atarget) { _target = atarget; }
inline void setTouchPointStates(Qt::TouchPointStates aTouchPointStates) { _touchPointStates = aTouchPointStates; }
inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &atouchPoints) { _touchPoints = atouchPoints; }
- inline void setDevice(QTouchDevice *device) { _device = device; }
+ inline void setDevice(QTouchDevice *adevice) { _device = adevice; }
protected:
- QWidget *_widget;
QWindow *_window;
+ QObject *_target;
QTouchDevice *_device;
Qt::TouchPointStates _touchPointStates;
QList<QTouchEvent::TouchPoint> _touchPoints;
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 1eee92d176..6dff55ca14 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qgenericplugin_qpa.cpp b/src/gui/kernel/qgenericplugin_qpa.cpp
index e7b65b730e..23733e3ea9 100644
--- a/src/gui/kernel/qgenericplugin_qpa.cpp
+++ b/src/gui/kernel/qgenericplugin_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qgenericplugin_qpa.h b/src/gui/kernel/qgenericplugin_qpa.h
index c4dd5a9df0..196304d2a4 100644
--- a/src/gui/kernel/qgenericplugin_qpa.h
+++ b/src/gui/kernel/qgenericplugin_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.cpp b/src/gui/kernel/qgenericpluginfactory_qpa.cpp
index 7c0975ac1d..4735604837 100644
--- a/src/gui/kernel/qgenericpluginfactory_qpa.cpp
+++ b/src/gui/kernel/qgenericpluginfactory_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.h b/src/gui/kernel/qgenericpluginfactory_qpa.h
index 2359de9aa9..2d1550ffac 100644
--- a/src/gui/kernel/qgenericpluginfactory_qpa.h
+++ b/src/gui/kernel/qgenericpluginfactory_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 6d5e210e82..f92e66b38e 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -57,6 +57,7 @@
#include <QtDebug>
#include <qpalette.h>
#include <qscreen.h>
+#include <private/qscreen_p.h>
#include <QtGui/QPlatformIntegration>
#include <QtGui/QGenericPluginFactory>
@@ -68,7 +69,6 @@
#include <QWindowSystemInterface>
#include "private/qwindowsysteminterface_qpa_p.h"
#include "private/qwindow_p.h"
-#include "private/qkeymapper_p.h"
#include "private/qcursor_p.h"
#include "private/qdnd_p.h"
#include <private/qplatformthemefactory_qpa_p.h>
@@ -113,6 +113,7 @@ static Qt::LayoutDirection layout_direction = Qt::LeftToRight;
static bool force_reverse = false;
QGuiApplicationPrivate *QGuiApplicationPrivate::self = 0;
+QTouchDevice *QGuiApplicationPrivate::m_fakeTouchDevice = 0;
#ifndef QT_NO_CLIPBOARD
QClipboard *QGuiApplicationPrivate::qt_clipboard = 0;
@@ -186,6 +187,7 @@ QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags
inputPanel(0)
{
self = this;
+ application_type = QCoreApplication::GuiClient;
}
QWindow *QGuiApplication::focusWindow()
@@ -333,6 +335,16 @@ void QGuiApplicationPrivate::createPlatformIntegration()
// Load the platform integration
QString platformPluginPath = QLatin1String(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH"));
+
+ // On Mac, look inside the application bundle for the platform plugin.
+ // TODO (msorvig): Create proper cross-platform solution for loading
+ // deployed platform plugins
+#ifdef Q_OS_MAC
+ if (platformPluginPath.isEmpty()) {
+ platformPluginPath = QCoreApplication::applicationDirPath() + QLatin1String("../Plugins/");
+ }
+#endif
+
QByteArray platformName;
#ifdef QT_QPA_DEFAULT_PLATFORM_NAME
platformName = QT_QPA_DEFAULT_PLATFORM_NAME;
@@ -678,7 +690,38 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
cursors.at(i).data()->pointerEvent(ev);
#endif
QGuiApplication::sendSpontaneousEvent(window, &ev);
- return;
+ if (!e->synthetic && !ev.isAccepted() && qApp->testAttribute(Qt::AA_SynthesizeTouchForUnhandledMouseEvents)) {
+ if (!m_fakeTouchDevice) {
+ m_fakeTouchDevice = new QTouchDevice;
+ QWindowSystemInterface::registerTouchDevice(m_fakeTouchDevice);
+ }
+ QList<QWindowSystemInterface::TouchPoint> points;
+ QWindowSystemInterface::TouchPoint point;
+ point.id = 1;
+ point.area = QRectF(globalPoint.x() - 2, globalPoint.y() - 2, 4, 4);
+
+ // only translate left button related events to
+ // avoid strange touch event sequences when several
+ // buttons are pressed
+ if (type == QEvent::MouseButtonPress && button == Qt::LeftButton) {
+ point.state = Qt::TouchPointPressed;
+ } else if (type == QEvent::MouseButtonRelease && button == Qt::LeftButton) {
+ point.state = Qt::TouchPointReleased;
+ } else if (type == QEvent::MouseMove && (buttons & Qt::LeftButton)) {
+ point.state = Qt::TouchPointMoved;
+ } else {
+ return;
+ }
+
+ points << point;
+
+ QEvent::Type type;
+ QList<QTouchEvent::TouchPoint> touchPoints = QWindowSystemInterfacePrivate::convertTouchPoints(points, &type);
+
+ QWindowSystemInterfacePrivate::TouchEvent fake(window, e->timestamp, type, m_fakeTouchDevice, touchPoints, e->modifiers);
+ fake.synthetic = true;
+ processTouchEvent(&fake);
+ }
}
}
@@ -742,9 +785,6 @@ void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Le
void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e)
{
- if (!e->activated)
- return;
-
QWindow *previous = QGuiApplicationPrivate::focus_window;
QGuiApplicationPrivate::focus_window = e->activated.data();
@@ -754,10 +794,18 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
if (previous) {
QFocusEvent focusOut(QEvent::FocusOut);
QCoreApplication::sendSpontaneousEvent(previous, &focusOut);
+ } else {
+ QEvent appActivate(QEvent::ApplicationActivate);
+ qApp->sendSpontaneousEvent(qApp, &appActivate);
}
- QFocusEvent focusIn(QEvent::FocusIn);
- QCoreApplication::sendSpontaneousEvent(QGuiApplicationPrivate::focus_window, &focusIn);
+ if (QGuiApplicationPrivate::focus_window) {
+ QFocusEvent focusIn(QEvent::FocusIn);
+ QCoreApplication::sendSpontaneousEvent(QGuiApplicationPrivate::focus_window, &focusIn);
+ } else {
+ QEvent appActivate(QEvent::ApplicationDeactivate);
+ qApp->sendSpontaneousEvent(qApp, &appActivate);
+ }
if (self)
self->notifyActiveWindowChange(previous);
@@ -822,6 +870,18 @@ void QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::Cl
QGuiApplication::sendSpontaneousEvent(e->window.data(), &event);
}
+Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k)
+{
+ return qHash(k.device) + k.touchPointId;
+}
+
+Q_GUI_EXPORT bool operator==(const QGuiApplicationPrivate::ActiveTouchPointsKey &a,
+ const QGuiApplicationPrivate::ActiveTouchPointsKey &b)
+{
+ return a.device == b.device
+ && a.touchPointId == b.touchPointId;
+}
+
void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e)
{
QWindow *window = e->window.data();
@@ -839,13 +899,15 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
// update state
QWeakPointer<QWindow> w;
QTouchEvent::TouchPoint previousTouchPoint;
+ ActiveTouchPointsKey touchInfoKey(e->device, touchPoint.id());
+ ActiveTouchPointsValue &touchInfo = d->activeTouchPoints[touchInfoKey];
switch (touchPoint.state()) {
case Qt::TouchPointPressed:
if (e->device->type() == QTouchDevice::TouchPad) {
// on touch-pads, send all touch points to the same widget
- w = d->windowForTouchPointId.isEmpty()
+ w = d->activeTouchPoints.isEmpty()
? QWeakPointer<QWindow>()
- : d->windowForTouchPointId.constBegin().value();
+ : d->activeTouchPoints.constBegin().value().window;
}
if (!w) {
@@ -857,7 +919,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
w = window;
}
- d->windowForTouchPointId[touchPoint.id()] = w;
+ touchInfo.window = w;
touchPoint.d->startScreenPos = touchPoint.screenPos();
touchPoint.d->lastScreenPos = touchPoint.screenPos();
touchPoint.d->startNormalizedPos = touchPoint.normalizedPos();
@@ -865,14 +927,15 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
if (touchPoint.pressure() < qreal(0.))
touchPoint.d->pressure = qreal(1.);
- d->appCurrentTouchPoints.insert(touchPoint.id(), touchPoint);
+ touchInfo.touchPoint = touchPoint;
break;
case Qt::TouchPointReleased:
- w = d->windowForTouchPointId.take(touchPoint.id());
+ w = touchInfo.window;
if (!w)
continue;
- previousTouchPoint = d->appCurrentTouchPoints.take(touchPoint.id());
+
+ previousTouchPoint = touchInfo.touchPoint;
touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos();
touchPoint.d->lastScreenPos = previousTouchPoint.screenPos();
touchPoint.d->startPos = previousTouchPoint.startPos();
@@ -881,14 +944,15 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos();
if (touchPoint.pressure() < qreal(0.))
touchPoint.d->pressure = qreal(0.);
+
break;
default:
- w = d->windowForTouchPointId.value(touchPoint.id());
+ w = touchInfo.window;
if (!w)
continue;
- Q_ASSERT(d->appCurrentTouchPoints.contains(touchPoint.id()));
- previousTouchPoint = d->appCurrentTouchPoints.value(touchPoint.id());
+
+ previousTouchPoint = touchInfo.touchPoint;
touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos();
touchPoint.d->lastScreenPos = previousTouchPoint.screenPos();
touchPoint.d->startPos = previousTouchPoint.startPos();
@@ -901,7 +965,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
// Stationary points might not be delivered down to the receiving item
// and get their position transformed, keep the old values instead.
if (touchPoint.state() != Qt::TouchPointStationary)
- d->appCurrentTouchPoints[touchPoint.id()] = touchPoint;
+ touchInfo.touchPoint = touchPoint;
break;
}
@@ -914,8 +978,6 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
StatesAndTouchPoints &maskAndPoints = windowsNeedingEvents[w.data()];
maskAndPoints.first |= touchPoint.state();
- if (touchPoint.isPrimary())
- maskAndPoints.first |= Qt::TouchPointPrimary;
maskAndPoints.second.append(touchPoint);
}
@@ -928,7 +990,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
QWindow *w = it.key();
QEvent::Type eventType;
- switch (it.value().first & Qt::TouchPointStateMask) {
+ switch (it.value().first) {
case Qt::TouchPointPressed:
eventType = QEvent::TouchBegin;
break;
@@ -969,6 +1031,28 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
}
QGuiApplication::sendSpontaneousEvent(w, &touchEvent);
+ if (!e->synthetic && !touchEvent.isAccepted() && qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents)) {
+ // exclude touchpads as those generate their own mouse events
+ if (touchEvent.device()->type() != QTouchDevice::TouchPad) {
+ Qt::MouseButtons b = eventType == QEvent::TouchEnd ? Qt::NoButton : Qt::LeftButton;
+
+ const QTouchEvent::TouchPoint &touchPoint = touchEvent.touchPoints().first();
+
+ QWindowSystemInterfacePrivate::MouseEvent fake(w, e->timestamp, touchPoint.pos(), touchPoint.screenPos(), b, e->modifiers);
+ fake.synthetic = true;
+ processMouseEvent(&fake);
+ }
+ }
+ }
+
+ // Remove released points from the hash table only after the event is
+ // delivered. When the receiver is a widget, QApplication will access
+ // activeTouchPoints during delivery and therefore nothing can be removed
+ // before sending the event.
+ for (int i = 0; i < e->points.count(); ++i) {
+ QTouchEvent::TouchPoint touchPoint = e->points.at(i);
+ if (touchPoint.state() == Qt::TouchPointReleased)
+ d->activeTouchPoints.remove(ActiveTouchPointsKey(e->device, touchPoint.id()));
}
}
@@ -982,6 +1066,8 @@ void QGuiApplicationPrivate::reportScreenOrientationChange(QWindowSystemInterfac
return;
QScreen *s = e->screen.data();
+ s->d_func()->currentOrientation = e->orientation;
+
emit s->currentOrientationChanged(s->currentOrientation());
QScreenOrientationChangeEvent event(s, s->currentOrientation());
@@ -998,6 +1084,7 @@ void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate:
return;
QScreen *s = e->screen.data();
+ s->d_func()->geometry = e->geometry;
emit s->sizeChanged(s->size());
emit s->geometryChanged(s->geometry());
@@ -1019,6 +1106,7 @@ void QGuiApplicationPrivate::reportAvailableGeometryChange(
return;
QScreen *s = e->screen.data();
+ s->d_func()->availableGeometry = e->availableGeometry;
emit s->availableSizeChanged(s->availableSize());
emit s->availableGeometryChanged(s->availableGeometry());
@@ -1034,6 +1122,7 @@ void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfa
return;
QScreen *s = e->screen.data();
+ s->d_func()->logicalDpi = QDpi(e->dpiX, e->dpiY);
emit s->logicalDotsPerInchXChanged(s->logicalDotsPerInchX());
emit s->logicalDotsPerInchYChanged(s->logicalDotsPerInchY());
@@ -1140,6 +1229,16 @@ QPalette QGuiApplication::palette()
return *QGuiApplicationPrivate::app_pal;
}
+void QGuiApplication::setPalette(const QPalette &pal)
+{
+ if (QGuiApplicationPrivate::app_pal && pal.isCopyOf(*QGuiApplicationPrivate::app_pal))
+ return;
+ if (!QGuiApplicationPrivate::app_pal)
+ QGuiApplicationPrivate::app_pal = new QPalette(pal);
+ else
+ *QGuiApplicationPrivate::app_pal = pal;
+}
+
QFont QGuiApplication::font()
{
QMutexLocker locker(applicationFontMutex());
@@ -1423,26 +1522,24 @@ uint QGuiApplicationPrivate::currentKeyPlatform()
/*!
\since 4.2
+ \obsolete
- Returns the current keyboard input locale.
+ Returns the current keyboard input locale. Replaced with QInputPanel::locale()
*/
QLocale QGuiApplication::keyboardInputLocale()
{
- if (!QGuiApplicationPrivate::checkInstance("keyboardInputLocale"))
- return QLocale::c();
- return qt_keymapper_private()->keyboardInputLocale;
+ return qApp ? qApp->inputPanel()->locale() : QLocale::c();
}
/*!
\since 4.2
+ \obsolete
- Returns the current keyboard input direction.
+ Returns the current keyboard input direction. Replaced with QInputPanel::inputDirection()
*/
Qt::LayoutDirection QGuiApplication::keyboardInputDirection()
{
- if (!QGuiApplicationPrivate::checkInstance("keyboardInputDirection"))
- return Qt::LeftToRight;
- return qt_keymapper_private()->keyboardInputDirection;
+ return qApp ? qApp->inputPanel()->inputDirection() : Qt::LeftToRight;
}
/*!
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index 1afbf17cf7..dd7b1f8806 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -108,6 +108,7 @@ public:
#endif
static QPalette palette();
+ static void setPalette(const QPalette &pal);
static Qt::KeyboardModifiers keyboardModifiers();
static Qt::MouseButtons mouseButtons();
@@ -118,9 +119,8 @@ public:
static inline bool isRightToLeft() { return layoutDirection() == Qt::RightToLeft; }
static inline bool isLeftToRight() { return layoutDirection() == Qt::LeftToRight; }
- // ### move to QInputPanel
- static QLocale keyboardInputLocale();
- static Qt::LayoutDirection keyboardInputDirection();
+ QT_DEPRECATED static QLocale keyboardInputLocale();
+ QT_DEPRECATED static Qt::LayoutDirection keyboardInputDirection();
QStyleHints *styleHints() const;
QInputPanel *inputPanel() const;
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 9c8a2ca642..9c965cd109 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -189,15 +189,30 @@ public:
QShortcutMap shortcutMap;
#endif
+ struct ActiveTouchPointsKey {
+ ActiveTouchPointsKey(QTouchDevice *dev, int id) : device(dev), touchPointId(id) { }
+ QTouchDevice *device;
+ int touchPointId;
+ };
+ struct ActiveTouchPointsValue {
+ QWeakPointer<QWindow> window;
+ QWeakPointer<QObject> target;
+ QTouchEvent::TouchPoint touchPoint;
+ };
+ QHash<ActiveTouchPointsKey, ActiveTouchPointsValue> activeTouchPoints;
+
private:
void init();
static QGuiApplicationPrivate *self;
-
- QMap<int, QWeakPointer<QWindow> > windowForTouchPointId;
- QMap<int, QTouchEvent::TouchPoint> appCurrentTouchPoints;
+ static QTouchDevice *m_fakeTouchDevice;
};
+Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k);
+
+Q_GUI_EXPORT bool operator==(const QGuiApplicationPrivate::ActiveTouchPointsKey &a,
+ const QGuiApplicationPrivate::ActiveTouchPointsKey &b);
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index 3b60f29e83..532a5353e2 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -79,6 +79,7 @@
#include "qstringlist.h"
#include "qurl.h"
#include "qlocale.h"
+#include "quuid.h"
#ifndef QT_NO_GEOM_VARIANT
#include "qsize.h"
@@ -94,8 +95,6 @@
QT_BEGIN_NAMESPACE
-Q_GUI_EXPORT const QVariant::Handler *qt_widgets_variant_handler = 0;
-
Q_CORE_EXPORT const QVariant::Handler *qcoreVariantHandler();
namespace {
@@ -136,53 +135,35 @@ template<> struct TypeDefiniton<QVector4D> { static const bool IsAvailable = fal
template<> struct TypeDefiniton<QQuaternion> { static const bool IsAvailable = false; };
#endif
-struct CoreAndGuiTypesFilter {
+struct GuiTypesFilter {
template<typename T>
struct Acceptor {
- static const bool IsAccepted = (QTypeModuleInfo<T>::IsCore || QTypeModuleInfo<T>::IsGui) && TypeDefiniton<T>::IsAvailable;
+ static const bool IsAccepted = QTypeModuleInfo<T>::IsGui && TypeDefiniton<T>::IsAvailable;
};
};
-} // namespace
+} // namespace used to hide TypeDefinition
+namespace {
static void construct(QVariant::Private *x, const void *copy)
{
const int type = x->type;
- QVariantConstructor<CoreAndGuiTypesFilter> constructor(x, copy);
- QMetaTypeSwitcher::switcher<void>(constructor, type, 0);
-
- // FIXME This is an ugly hack if QVariantConstructor fails to build a value it constructs an invalid type
- if (Q_UNLIKELY(x->type == QVariant::Invalid)) {
- if (type == 62) {
- // small 'trick' to let a QVariant(Qt::blue) create a variant
- // of type QColor
- // TODO Get rid of this hack.
- x->type = QVariant::Color;
- QColor color(*reinterpret_cast<const Qt::GlobalColor *>(copy));
- v_construct<QColor>(x, &color);
- return;
- }
- if (type == QVariant::Icon || type == QVariant::SizePolicy) {
- // TODO we need to clean up variant handlers, so they are replacament, not extension
- x->type = type;
- if (qt_widgets_variant_handler) {
- qt_widgets_variant_handler->construct(x, copy);
- }
- }
+ if (Q_UNLIKELY(type == 62)) {
+ // small 'trick' to let a QVariant(Qt::blue) create a variant
+ // of type QColor
+ // TODO Get rid of this hack.
+ x->type = QVariant::Color;
+ QColor color(*reinterpret_cast<const Qt::GlobalColor *>(copy));
+ v_construct<QColor>(x, &color);
+ return;
}
+ QVariantConstructor<GuiTypesFilter> constructor(x, copy);
+ QMetaTypeSwitcher::switcher<void>(constructor, type, 0);
}
static void clear(QVariant::Private *d)
{
- const int type = d->type;
- if (type == QVariant::Icon || type == QVariant::SizePolicy) {
- // TODO we need to clean up variant handlers, so they are replacament, not extension
- if (qt_widgets_variant_handler) {
- qt_widgets_variant_handler->clear(d);
- return;
- }
- }
- QVariantDestructor<CoreAndGuiTypesFilter> destructor(d);
- QMetaTypeSwitcher::switcher<void>(destructor, type, 0);
+ QVariantDestructor<GuiTypesFilter> destructor(d);
+ QMetaTypeSwitcher::switcher<void>(destructor, d->type, 0);
}
// This class is a hack that customizes access to QPolygon
@@ -200,7 +181,7 @@ public:
};
static bool isNull(const QVariant::Private *d)
{
- QGuiVariantIsNull<CoreAndGuiTypesFilter> isNull(d);
+ QGuiVariantIsNull<GuiTypesFilter> isNull(d);
return QMetaTypeSwitcher::switcher<bool>(isNull, d->type, 0);
}
@@ -215,11 +196,6 @@ public:
template<typename T>
bool delegate(const T *p)
{
- if (Q_UNLIKELY(Base::m_a->type == QVariant::Icon || Base::m_a->type == QVariant::SizePolicy)) {
- // TODO we need to clean up variant handlers, so they are replacament, not extension
- if (Q_LIKELY(qt_widgets_variant_handler))
- return qt_widgets_variant_handler->compare(Base::m_a, Base::m_b);
- }
return Base::delegate(p);
}
bool delegate(const QPixmap*)
@@ -241,7 +217,7 @@ public:
static bool compare(const QVariant::Private *a, const QVariant::Private *b)
{
- QGuiVariantComparator<CoreAndGuiTypesFilter> comparator(a, b);
+ QGuiVariantComparator<GuiTypesFilter> comparator(a, b);
return QMetaTypeSwitcher::switcher<bool>(comparator, a->type, 0);
}
@@ -369,90 +345,9 @@ static bool convert(const QVariant::Private *d, QVariant::Type t,
#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
static void streamDebug(QDebug dbg, const QVariant &v)
{
- switch(v.type()) {
- case QVariant::Cursor:
-#ifndef QT_NO_CURSOR
-// dbg.nospace() << qvariant_cast<QCursor>(v); //FIXME
-#endif
- break;
- case QVariant::Bitmap:
-// dbg.nospace() << qvariant_cast<QBitmap>(v); //FIXME
- break;
- case QVariant::Polygon:
- dbg.nospace() << qvariant_cast<QPolygon>(v);
- break;
- case QVariant::Region:
- dbg.nospace() << qvariant_cast<QRegion>(v);
- break;
- case QVariant::Font:
-// dbg.nospace() << qvariant_cast<QFont>(v); //FIXME
- break;
- case QVariant::Matrix:
- dbg.nospace() << qvariant_cast<QMatrix>(v);
- break;
- case QVariant::Transform:
- dbg.nospace() << qvariant_cast<QTransform>(v);
- break;
- case QVariant::Pixmap:
-// dbg.nospace() << qvariant_cast<QPixmap>(v); //FIXME
- break;
- case QVariant::Image:
-// dbg.nospace() << qvariant_cast<QImage>(v); //FIXME
- break;
- case QVariant::Brush:
- dbg.nospace() << qvariant_cast<QBrush>(v);
- break;
- case QVariant::Color:
- dbg.nospace() << qvariant_cast<QColor>(v);
- break;
- case QVariant::Palette:
-// dbg.nospace() << qvariant_cast<QPalette>(v); //FIXME
- break;
-#ifndef QT_NO_ICON
- case QVariant::Icon:
-// dbg.nospace() << qvariant_cast<QIcon>(v); // FIXME
- break;
-#endif
- case QVariant::SizePolicy:
-// dbg.nospace() << qvariant_cast<QSizePolicy>(v); //FIXME
- break;
-#ifndef QT_NO_SHORTCUT
- case QVariant::KeySequence:
- dbg.nospace() << qvariant_cast<QKeySequence>(v);
- break;
-#endif
- case QVariant::Pen:
- dbg.nospace() << qvariant_cast<QPen>(v);
- break;
-#ifndef QT_NO_MATRIX4X4
- case QVariant::Matrix4x4:
- dbg.nospace() << qvariant_cast<QMatrix4x4>(v);
- break;
-#endif
-#ifndef QT_NO_VECTOR2D
- case QVariant::Vector2D:
- dbg.nospace() << qvariant_cast<QVector2D>(v);
- break;
-#endif
-#ifndef QT_NO_VECTOR3D
- case QVariant::Vector3D:
- dbg.nospace() << qvariant_cast<QVector3D>(v);
- break;
-#endif
-#ifndef QT_NO_VECTOR4D
- case QVariant::Vector4D:
- dbg.nospace() << qvariant_cast<QVector4D>(v);
- break;
-#endif
-#ifndef QT_NO_QUATERNION
- case QVariant::Quaternion:
- dbg.nospace() << qvariant_cast<QQuaternion>(v);
- break;
-#endif
- default:
- qcoreVariantHandler()->debugStream(dbg, v);
- break;
- }
+ QVariant::Private *d = const_cast<QVariant::Private *>(&v.data_ptr());
+ QVariantDebugStream<GuiTypesFilter> stream(dbg, d);
+ QMetaTypeSwitcher::switcher<void>(stream, d->type, 0);
}
#endif
@@ -474,29 +369,28 @@ const QVariant::Handler qt_gui_variant_handler = {
#endif
};
-extern Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeGuiHelper;
-
#define QT_IMPL_METATYPEINTERFACE_GUI_TYPES(MetaTypeName, MetaTypeId, RealName) \
- QMetaTypeInterface(static_cast<RealName*>(0)),
+ QT_METATYPE_INTERFACE_INIT(RealName),
static const QMetaTypeInterface qVariantGuiHelper[] = {
QT_FOR_EACH_STATIC_GUI_CLASS(QT_IMPL_METATYPEINTERFACE_GUI_TYPES)
};
#undef QT_IMPL_METATYPEINTERFACE_GUI_TYPES
+} // namespace used to hide QVariant handler
+
+extern Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeGuiHelper;
-static const QVariant::Handler *qt_guivariant_last_handler = 0;
void qRegisterGuiVariant()
{
- qt_guivariant_last_handler = QVariant::handler;
- QVariant::handler = &qt_gui_variant_handler;
+ QVariantPrivate::registerHandler(QModulesPrivate::Gui, &qt_gui_variant_handler);
qMetaTypeGuiHelper = qVariantGuiHelper;
}
Q_CONSTRUCTOR_FUNCTION(qRegisterGuiVariant)
void qUnregisterGuiVariant()
{
- QVariant::handler = qt_guivariant_last_handler;
+ QVariantPrivate::unregisterHandler(QModulesPrivate::Gui);
qMetaTypeGuiHelper = 0;
}
Q_DESTRUCTOR_FUNCTION(qUnregisterGuiVariant)
diff --git a/src/gui/kernel/qinputpanel.cpp b/src/gui/kernel/qinputpanel.cpp
index d6d58bf1c5..d6dd55b651 100644
--- a/src/gui/kernel/qinputpanel.cpp
+++ b/src/gui/kernel/qinputpanel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -158,9 +158,9 @@ QRectF QInputPanel::cursorRectangle() const
\property QInputPanel::keyboardRectangle
\brief Virtual keyboard's geometry in window coordinates.
*/
-QRectF QInputPanel::keyboardRectangle()
+QRectF QInputPanel::keyboardRectangle() const
{
- Q_D(QInputPanel);
+ Q_D(const QInputPanel);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
return ic->keyboardRect();
@@ -248,6 +248,32 @@ bool QInputPanel::isAnimating() const
}
/*!
+ \property QInputPanel::locale
+ \brief Current input locale.
+*/
+QLocale QInputPanel::locale() const
+{
+ Q_D(const QInputPanel);
+ QPlatformInputContext *ic = d->platformInputContext();
+ if (ic)
+ return ic->locale();
+ return QLocale::c();
+}
+
+/*!
+ \property QInputPanel::inputDirection
+ \brief Current input direction.
+*/
+Qt::LayoutDirection QInputPanel::inputDirection() const
+{
+ Q_D(const QInputPanel);
+ QPlatformInputContext *ic = d->platformInputContext();
+ if (ic)
+ return ic->inputDirection();
+ return Qt::LeftToRight;
+}
+
+/*!
Called by the input item to inform the platform input methods when there has been
state changes in editor's input method query attributes. When calling the function
\a queries parameter has to be used to tell what has changes, which input method
diff --git a/src/gui/kernel/qinputpanel.h b/src/gui/kernel/qinputpanel.h
index 4edc902104..c33bd13451 100644
--- a/src/gui/kernel/qinputpanel.h
+++ b/src/gui/kernel/qinputpanel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -64,6 +64,8 @@ class Q_GUI_EXPORT QInputPanel : public QObject
Q_PROPERTY(QRectF keyboardRectangle READ keyboardRectangle NOTIFY keyboardRectangleChanged)
Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
Q_PROPERTY(bool animating READ isAnimating NOTIFY animatingChanged)
+ Q_PROPERTY(QLocale locale READ locale NOTIFY localeChanged)
+ Q_PROPERTY(Qt::LayoutDirection inputDirection READ inputDirection NOTIFY inputDirectionChanged)
Q_ENUMS(Action)
public:
@@ -80,7 +82,7 @@ public:
QRectF cursorRectangle() const; // ### what if we have rotations for the item?
// keyboard geometry in window coords
- QRectF keyboardRectangle();
+ QRectF keyboardRectangle() const;
enum Action {
Click,
@@ -92,6 +94,9 @@ public:
bool isAnimating() const;
+ QLocale locale() const;
+ Qt::LayoutDirection inputDirection() const;
+
public Q_SLOTS:
void show();
void hide();
@@ -108,6 +113,8 @@ Q_SIGNALS:
void keyboardRectangleChanged();
void visibleChanged();
void animatingChanged();
+ void localeChanged();
+ void inputDirectionChanged(Qt::LayoutDirection newDirection);
private:
friend class QGuiApplication;
diff --git a/src/gui/kernel/qinputpanel_p.h b/src/gui/kernel/qinputpanel_p.h
index 6fcf2d7243..f30c8a1b80 100644
--- a/src/gui/kernel/qinputpanel_p.h
+++ b/src/gui/kernel/qinputpanel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qkeymapper.cpp b/src/gui/kernel/qkeymapper.cpp
index 4ee7d66dd8..a411ee5904 100644
--- a/src/gui/kernel/qkeymapper.cpp
+++ b/src/gui/kernel/qkeymapper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h
index 1fada6f59a..bf19f1d80a 100644
--- a/src/gui/kernel/qkeymapper_p.h
+++ b/src/gui/kernel/qkeymapper_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qkeymapper_qpa.cpp b/src/gui/kernel/qkeymapper_qpa.cpp
index 13c6d6c28b..fd04ff234c 100644
--- a/src/gui/kernel/qkeymapper_qpa.cpp
+++ b/src/gui/kernel/qkeymapper_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 6ea502b70b..986701bd7b 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1259,13 +1259,20 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
// Rational: A modifier will contain the name AND +, so longer than 1, a length of 1 is just
// the remaining part of the shortcut (ei. The 'C' in "Ctrl+C"), so no need to check that.
if (sub.length() > 1) {
+ bool validModifier = false;
for (int j = 0; j < modifs.size(); ++j) {
const QModifKeyName &mkf = modifs.at(j);
if (sub == mkf.name) {
ret |= mkf.qt_key;
+ validModifier = true;
break; // Shortcut, since if we find an other it would/should just be a dup
}
}
+ // We couldn't match the string with a modifier. This is only
+ // possible if this part is the key. The key is never followed by a
+ // '+'. And if the key is '+' the if() above would have skipped it.
+ if (!validModifier)
+ return Qt::Key_unknown;
}
lastI = i + 1;
}
@@ -1309,6 +1316,9 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
if (found)
break;
}
+ // We couldn't translate the key.
+ if (!found)
+ return Qt::Key_unknown;
}
return ret;
}
@@ -1335,6 +1345,11 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
{
bool nativeText = (format == QKeySequence::NativeText);
QString s;
+
+ // Handle -1 (Invalid Key) and Qt::Key_unknown gracefully
+ if (key == -1 || key == Qt::Key_unknown)
+ return s;
+
#if defined(Q_OS_MAC)
if (nativeText) {
// On Mac OS X the order (by default) is Meta, Alt, Shift, Control.
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index 31cec17fb1..1127e8afca 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h
index 7fa98dd5eb..57f6e1927f 100644
--- a/src/gui/kernel/qkeysequence_p.h
+++ b/src/gui/kernel/qkeysequence_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 6a9cb43028..93a4b3582b 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -174,6 +174,8 @@ bool QOpenGLContext::create()
void QOpenGLContext::destroy()
{
Q_D(QOpenGLContext);
+ if (d->platformGLContext)
+ emit aboutToBeDestroyed();
if (QOpenGLContext::currentContext() == this)
doneCurrent();
if (d->shareGroup)
@@ -186,6 +188,17 @@ void QOpenGLContext::destroy()
}
/*!
+ \fn void QOpenGLContext::aboutToBeDestroyed()
+
+ This signal is emitted before the underlying native OpenGL context is
+ destroyed, such that users may clean up OpenGL resources that might otherwise
+ be left dangling in the case of shared OpenGL contexts.
+
+ If you wish to make the context current in order to do clean-up, make sure to
+ only connect to the signal using a direct connection.
+*/
+
+/*!
If this is the current context for the thread, doneCurrent is called
*/
QOpenGLContext::~QOpenGLContext()
@@ -297,7 +310,7 @@ void QOpenGLContext::swapBuffers(QSurface *surface)
d->platformGLContext->swapBuffers(surfaceHandle);
}
-void (*QOpenGLContext::getProcAddress(const QByteArray &procName)) ()
+QFunctionPointer QOpenGLContext::getProcAddress(const QByteArray &procName)
{
Q_D(QOpenGLContext);
if (!d->platformGLContext)
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index b5a19a0ebc..a8ac39c7d5 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -106,7 +106,7 @@ public:
void doneCurrent();
void swapBuffers(QSurface *surface);
- void (*getProcAddress(const QByteArray &procName)) ();
+ QFunctionPointer getProcAddress(const QByteArray &procName);
QSurface *surface() const;
@@ -118,6 +118,9 @@ public:
QOpenGLFunctions *functions() const;
+Q_SIGNALS:
+ void aboutToBeDestroyed();
+
private:
friend class QGLContext;
friend class QOpenGLContextResourceBase;
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index aff1042c5b..7040b883bf 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 893cc5eff6..2dd2ef00c5 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -43,6 +43,7 @@
#include "qguiapplication.h"
#include "qdatastream.h"
#include "qvariant.h"
+#include "qdebug.h"
QT_BEGIN_NAMESPACE
@@ -1081,4 +1082,12 @@ void QPalette::setColorGroup(ColorGroup cg, const QBrush &foreground, const QBru
setBrush(cg, ToolTipText, toolTipText);
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QPalette &)
+{
+ dbg.nospace() << "QPalette()";
+ return dbg.space();
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index dd59d121a0..d47854df07 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -190,6 +190,10 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &ds, const QPalette &p);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &ds, QPalette &p);
#endif // QT_NO_DATASTREAM
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QPalette &);
+#endif
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/kernel/qplatformclipboard_qpa.cpp b/src/gui/kernel/qplatformclipboard_qpa.cpp
index c7c779e4eb..4d8d65de0a 100644
--- a/src/gui/kernel/qplatformclipboard_qpa.cpp
+++ b/src/gui/kernel/qplatformclipboard_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformclipboard_qpa.h b/src/gui/kernel/qplatformclipboard_qpa.h
index fc0505b87e..643733fdf7 100644
--- a/src/gui/kernel/qplatformclipboard_qpa.h
+++ b/src/gui/kernel/qplatformclipboard_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformcursor_qpa.cpp b/src/gui/kernel/qplatformcursor_qpa.cpp
index 752de18969..a3824381d3 100644
--- a/src/gui/kernel/qplatformcursor_qpa.cpp
+++ b/src/gui/kernel/qplatformcursor_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformcursor_qpa.h b/src/gui/kernel/qplatformcursor_qpa.h
index da3c4752a0..a2026425db 100644
--- a/src/gui/kernel/qplatformcursor_qpa.h
+++ b/src/gui/kernel/qplatformcursor_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformdrag_qpa.h b/src/gui/kernel/qplatformdrag_qpa.h
index 0b65174f71..fb71f29de9 100644
--- a/src/gui/kernel/qplatformdrag_qpa.h
+++ b/src/gui/kernel/qplatformdrag_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatforminputcontext_qpa.cpp b/src/gui/kernel/qplatforminputcontext_qpa.cpp
index bc0bcf8f4f..1e82507653 100644
--- a/src/gui/kernel/qplatforminputcontext_qpa.cpp
+++ b/src/gui/kernel/qplatforminputcontext_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,6 +42,7 @@
#include <qplatforminputcontext_qpa.h>
#include <qguiapplication.h>
#include <QRect>
+#include "private/qkeymapper_p.h"
QT_BEGIN_NAMESPACE
@@ -207,4 +208,25 @@ void QPlatformInputContext::emitInputPanelVisibleChanged()
emit qApp->inputPanel()->visibleChanged();
}
+QLocale QPlatformInputContext::locale() const
+{
+ return qt_keymapper_private()->keyboardInputLocale;
+}
+
+void QPlatformInputContext::emitLocaleChanged()
+{
+ emit qApp->inputPanel()->localeChanged();
+}
+
+Qt::LayoutDirection QPlatformInputContext::inputDirection() const
+{
+ return qt_keymapper_private()->keyboardInputDirection;
+}
+
+void QPlatformInputContext::emitInputDirectionChanged(Qt::LayoutDirection newDirection)
+{
+ emit qApp->inputPanel()->inputDirectionChanged(newDirection);
+}
+
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatforminputcontext_qpa.h b/src/gui/kernel/qplatforminputcontext_qpa.h
index 76aa122720..463238f336 100644
--- a/src/gui/kernel/qplatforminputcontext_qpa.h
+++ b/src/gui/kernel/qplatforminputcontext_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -77,6 +77,11 @@ public:
virtual void hideInputPanel();
virtual bool isInputPanelVisible() const;
void emitInputPanelVisibleChanged();
+
+ virtual QLocale locale() const;
+ void emitLocaleChanged();
+ virtual Qt::LayoutDirection inputDirection() const;
+ void emitInputDirectionChanged(Qt::LayoutDirection newDirection);
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp
index 956180c728..23ecf3add4 100644
--- a/src/gui/kernel/qplatformintegration_qpa.cpp
+++ b/src/gui/kernel/qplatformintegration_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -46,6 +46,7 @@
#include <QtGui/QPlatformAccessibility>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qpixmap_raster_p.h>
+#include <QtGui/private/qplatformscreen_qpa_p.h>
#include <private/qdnd_p.h>
QT_BEGIN_NAMESPACE
@@ -227,12 +228,16 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return 1000;
case KeyboardInputInterval:
return 400;
+ case KeyboardAutoRepeatRate:
+ return 30;
case MouseDoubleClickInterval:
return 400;
case StartDragDistance:
return 10;
case StartDragTime:
return 500;
+ case ShowIsFullScreen:
+ return false;
}
return 0;
@@ -251,11 +256,10 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
*/
void QPlatformIntegration::screenAdded(QPlatformScreen *ps)
{
- QScreen *screen = ps ? ps->screen() : 0;
- if (screen && !QGuiApplicationPrivate::screen_list.contains(screen)) {
- QGuiApplicationPrivate::screen_list << screen;
- emit qGuiApp->screenAdded(screen);
- }
+ QScreen *screen = new QScreen(ps);
+ ps->d_func()->screen = screen;
+ QGuiApplicationPrivate::screen_list << screen;
+ emit qGuiApp->screenAdded(screen);
}
class QPlatformTheme *QPlatformIntegration::platformTheme() const
diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h
index d5eb14bc50..3975d82288 100644
--- a/src/gui/kernel/qplatformintegration_qpa.h
+++ b/src/gui/kernel/qplatformintegration_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -106,7 +106,9 @@ public:
KeyboardInputInterval,
MouseDoubleClickInterval,
StartDragDistance,
- StartDragTime
+ StartDragTime,
+ KeyboardAutoRepeatRate,
+ ShowIsFullScreen
};
virtual QVariant styleHint(StyleHint hint) const;
diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp
index c40494c408..7f2260b5f6 100644
--- a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp
+++ b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa_p.h b/src/gui/kernel/qplatformintegrationfactory_qpa_p.h
index 5ffdf85425..189b352139 100644
--- a/src/gui/kernel/qplatformintegrationfactory_qpa_p.h
+++ b/src/gui/kernel/qplatformintegrationfactory_qpa_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformintegrationplugin_qpa.cpp b/src/gui/kernel/qplatformintegrationplugin_qpa.cpp
index 0181b98ad7..a57b980ea3 100644
--- a/src/gui/kernel/qplatformintegrationplugin_qpa.cpp
+++ b/src/gui/kernel/qplatformintegrationplugin_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformintegrationplugin_qpa.h b/src/gui/kernel/qplatformintegrationplugin_qpa.h
index b397f56d7c..f53d66d1c8 100644
--- a/src/gui/kernel/qplatformintegrationplugin_qpa.h
+++ b/src/gui/kernel/qplatformintegrationplugin_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
index 5c1f8458db..f9ddd1f72a 100644
--- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp
+++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h
index bfcf78813b..47e2f82810 100644
--- a/src/gui/kernel/qplatformnativeinterface_qpa.h
+++ b/src/gui/kernel/qplatformnativeinterface_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformopenglcontext_qpa.cpp b/src/gui/kernel/qplatformopenglcontext_qpa.cpp
index e764419825..7c5e8245df 100644
--- a/src/gui/kernel/qplatformopenglcontext_qpa.cpp
+++ b/src/gui/kernel/qplatformopenglcontext_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformopenglcontext_qpa.h b/src/gui/kernel/qplatformopenglcontext_qpa.h
index 1b3bfc9a34..ac5cf969d9 100644
--- a/src/gui/kernel/qplatformopenglcontext_qpa.h
+++ b/src/gui/kernel/qplatformopenglcontext_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp
index 3fdb809137..26c685ff1a 100644
--- a/src/gui/kernel/qplatformscreen_qpa.cpp
+++ b/src/gui/kernel/qplatformscreen_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,23 +42,18 @@
#include "qplatformscreen_qpa.h"
#include <QtGui/qguiapplication.h>
#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qplatformscreen_qpa_p.h>
#include <QtGui/qplatformintegration_qpa.h>
#include <QtGui/qscreen.h>
#include <QtGui/qwindow.h>
QT_BEGIN_NAMESPACE
-class QPlatformScreenPrivate
-{
-public:
- QScreen *screen;
-};
-
QPlatformScreen::QPlatformScreen()
: d_ptr(new QPlatformScreenPrivate)
{
Q_D(QPlatformScreen);
- d->screen = new QScreen(this);
+ d->screen = 0;
}
QPlatformScreen::~QPlatformScreen()
diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen_qpa.h
index 64115a6cd5..586a29279c 100644
--- a/src/gui/kernel/qplatformscreen_qpa.h
+++ b/src/gui/kernel/qplatformscreen_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -120,6 +120,8 @@ protected:
private:
Q_DISABLE_COPY(QPlatformScreen)
+
+ friend class QPlatformIntegration;
};
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/icd/iapmonitor.h b/src/gui/kernel/qplatformscreen_qpa_p.h
index 9f7c3b2cef..67c222bdf3 100644
--- a/src/plugins/bearer/icd/iapmonitor.h
+++ b/src/gui/kernel/qplatformscreen_qpa_p.h
@@ -1,10 +1,10 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the plugins of the Qt Toolkit.
+** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@@ -39,30 +39,36 @@
**
****************************************************************************/
+#ifndef QPLATFORMSCREEN_QPA_P_H
+#define QPLATFORMSCREEN_QPA_P_H
-#ifndef IAPMONITOR_H
-#define IAPMONITOR_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 <QString>
+QT_BEGIN_HEADER
-namespace Maemo {
+QT_BEGIN_NAMESPACE
-class IAPMonitorPrivate;
-class IAPMonitor {
-public:
- IAPMonitor();
- ~IAPMonitor();
+QT_MODULE(Gui)
-protected:
- virtual void iapAdded(const QString &id);
- virtual void iapRemoved(const QString &id);
+class QScreen;
-private:
- IAPMonitorPrivate *d_ptr;
- Q_DECLARE_PRIVATE(IAPMonitor);
+class QPlatformScreenPrivate
+{
+public:
+ QScreen *screen;
};
-} // namespace Maemo
+QT_END_NAMESPACE
-#endif // IAPMONITOR_H
+QT_END_HEADER
+#endif // QPLATFORMSCREEN_QPA_P_H
diff --git a/src/gui/kernel/qplatformsurface_qpa.cpp b/src/gui/kernel/qplatformsurface_qpa.cpp
index dcfd201ea3..3347f7984f 100644
--- a/src/gui/kernel/qplatformsurface_qpa.cpp
+++ b/src/gui/kernel/qplatformsurface_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformsurface_qpa.h b/src/gui/kernel/qplatformsurface_qpa.h
index 76b564de25..7ceb39f049 100644
--- a/src/gui/kernel/qplatformsurface_qpa.h
+++ b/src/gui/kernel/qplatformsurface_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformtheme_qpa.cpp b/src/gui/kernel/qplatformtheme_qpa.cpp
index c887d78edb..22d4452f4e 100644
--- a/src/gui/kernel/qplatformtheme_qpa.cpp
+++ b/src/gui/kernel/qplatformtheme_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -41,8 +41,36 @@
#include "qplatformtheme_qpa.h"
+#include <QtCore/QVariant>
+
QT_BEGIN_NAMESPACE
+/*!
+ \class QPlatformTheme
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
+ \brief The QPlatformTheme class allows customizing the UI based on themes.
+
+*/
+
+/*!
+ \enum QPlatformTheme::ThemeHint
+
+ This enum describes the available theme hints.
+
+ \value TextCursorWidth (int) Determines the width of the text cursor.
+
+ \value DropShadow (bool) Determines whether the drop shadow effect for
+ tooltips or whatsthis is enabled.
+
+ \value MaximumScrollBarDragDistance (int) Determines the value returned by
+ QStyle::pixelMetric(PM_MaximumDragDistance)
+
+ \sa themeHint(), QStyle::pixelMetric()
+*/
+
QPlatformMenu *QPlatformTheme::createPlatformMenu(QMenu *menu) const
{
Q_UNUSED(menu);
@@ -67,4 +95,17 @@ QPlatformDialogHelper *QPlatformTheme::createPlatformDialogHelper(QDialog *dialo
return 0;
}
+QVariant QPlatformTheme::themeHint(ThemeHint hint) const
+{
+ switch (hint) {
+ case TextCursorWidth:
+ return QVariant(1);
+ case DropShadow:
+ return QVariant(false);
+ case MaximumScrollBarDragDistance:
+ return QVariant(-1);
+ }
+ return QVariant();
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformtheme_qpa.h b/src/gui/kernel/qplatformtheme_qpa.h
index 2090ce37e1..c3e5b677a2 100644
--- a/src/gui/kernel/qplatformtheme_qpa.h
+++ b/src/gui/kernel/qplatformtheme_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -56,15 +56,24 @@ class QPlatformMenu;
class QPlatformMenuBar;
class QPlatformDialogHelper;
class QDialog;
+class QVariant;
class Q_GUI_EXPORT QPlatformTheme
{
public:
+ enum ThemeHint {
+ TextCursorWidth,
+ DropShadow,
+ MaximumScrollBarDragDistance
+ };
+
virtual QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const;
virtual QPlatformMenuBar *createPlatformMenuBar(QMenuBar *menuBar = 0) const;
virtual bool usePlatformNativeDialog(const QDialog *dialog = 0) const;
virtual QPlatformDialogHelper *createPlatformDialogHelper(QDialog *dialog = 0) const;
+
+ virtual QVariant themeHint(ThemeHint hint) const;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformthemefactory_qpa.cpp b/src/gui/kernel/qplatformthemefactory_qpa.cpp
index 87f96762c2..c278f41411 100644
--- a/src/gui/kernel/qplatformthemefactory_qpa.cpp
+++ b/src/gui/kernel/qplatformthemefactory_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformthemefactory_qpa_p.h b/src/gui/kernel/qplatformthemefactory_qpa_p.h
index b65e6e197a..71987aa723 100644
--- a/src/gui/kernel/qplatformthemefactory_qpa_p.h
+++ b/src/gui/kernel/qplatformthemefactory_qpa_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformthemeplugin_qpa.cpp b/src/gui/kernel/qplatformthemeplugin_qpa.cpp
index e17e36fc3d..c51d4e9fc5 100644
--- a/src/gui/kernel/qplatformthemeplugin_qpa.cpp
+++ b/src/gui/kernel/qplatformthemeplugin_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformthemeplugin_qpa.h b/src/gui/kernel/qplatformthemeplugin_qpa.h
index 0df9a8842d..89348deae0 100644
--- a/src/gui/kernel/qplatformthemeplugin_qpa.h
+++ b/src/gui/kernel/qplatformthemeplugin_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp
index 90fdec69f0..d69cb0e64e 100644
--- a/src/gui/kernel/qplatformwindow_qpa.cpp
+++ b/src/gui/kernel/qplatformwindow_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h
index c6b5bb80ea..7605a5a4aa 100644
--- a/src/gui/kernel/qplatformwindow_qpa.h
+++ b/src/gui/kernel/qplatformwindow_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index 8a35ce6b8f..a1ed3014d0 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -40,23 +40,13 @@
****************************************************************************/
#include "qscreen.h"
+#include "qscreen_p.h"
#include "qplatformscreen_qpa.h"
#include <QtCore/private/qobject_p.h>
QT_BEGIN_NAMESPACE
-class QScreenPrivate : public QObjectPrivate
-{
-public:
- QScreenPrivate(QPlatformScreen *screen)
- : platformScreen(screen)
- {
- }
-
- QPlatformScreen *platformScreen;
-};
-
/*!
\class QScreen
\brief The QScreen class is used to query screen properties.
@@ -119,7 +109,7 @@ int QScreen::depth() const
QSize QScreen::size() const
{
Q_D(const QScreen);
- return d->platformScreen->geometry().size();
+ return d->geometry.size();
}
/*!
@@ -184,7 +174,7 @@ qreal QScreen::physicalDotsPerInch() const
qreal QScreen::logicalDotsPerInchX() const
{
Q_D(const QScreen);
- return d->platformScreen->logicalDpi().first;
+ return d->logicalDpi.first;
}
/*!
@@ -198,7 +188,7 @@ qreal QScreen::logicalDotsPerInchX() const
qreal QScreen::logicalDotsPerInchY() const
{
Q_D(const QScreen);
- return d->platformScreen->logicalDpi().second;
+ return d->logicalDpi.second;
}
/*!
@@ -216,7 +206,7 @@ qreal QScreen::logicalDotsPerInchY() const
qreal QScreen::logicalDotsPerInch() const
{
Q_D(const QScreen);
- QDpi dpi = d->platformScreen->logicalDpi();
+ QDpi dpi = d->logicalDpi;
return (dpi.first + dpi.second) * qreal(0.5);
}
@@ -246,7 +236,7 @@ QSizeF QScreen::physicalSize() const
QSize QScreen::availableSize() const
{
Q_D(const QScreen);
- return d->platformScreen->availableGeometry().size();
+ return d->availableGeometry.size();
}
/*!
@@ -259,7 +249,7 @@ QSize QScreen::availableSize() const
QRect QScreen::geometry() const
{
Q_D(const QScreen);
- return d->platformScreen->geometry();
+ return d->geometry;
}
/*!
@@ -272,7 +262,7 @@ QRect QScreen::geometry() const
QRect QScreen::availableGeometry() const
{
Q_D(const QScreen);
- return d->platformScreen->availableGeometry();
+ return d->availableGeometry;
}
/*!
@@ -315,10 +305,9 @@ QSize QScreen::virtualSize() const
*/
QRect QScreen::virtualGeometry() const
{
- Q_D(const QScreen);
QRect result;
- foreach (QPlatformScreen *platformScreen, d->platformScreen->virtualSiblings())
- result |= platformScreen->geometry();
+ foreach (QScreen *screen, virtualSiblings())
+ result |= screen->geometry();
return result;
}
@@ -347,10 +336,9 @@ QSize QScreen::availableVirtualSize() const
*/
QRect QScreen::availableVirtualGeometry() const
{
- Q_D(const QScreen);
QRect result;
- foreach (QPlatformScreen *platformScreen, d->platformScreen->virtualSiblings())
- result |= platformScreen->availableGeometry();
+ foreach (QScreen *screen, virtualSiblings())
+ result |= screen->availableGeometry();
return result;
}
@@ -383,7 +371,7 @@ Qt::ScreenOrientation QScreen::primaryOrientation() const
Qt::ScreenOrientation QScreen::currentOrientation() const
{
Q_D(const QScreen);
- return d->platformScreen->currentOrientation();
+ return d->currentOrientation;
}
// i must be power of two
diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h
index 6fc97c1799..7291e2ad7b 100644
--- a/src/gui/kernel/qscreen.h
+++ b/src/gui/kernel/qscreen.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -140,6 +140,7 @@ private:
Q_DISABLE_COPY(QScreen)
friend class QGuiApplicationPrivate;
+ friend class QPlatformIntegration;
friend class QPlatformScreen;
};
diff --git a/src/plugins/bearer/icd/main.cpp b/src/gui/kernel/qscreen_p.h
index 0b52d25e60..50742c9f6b 100644
--- a/src/plugins/bearer/icd/main.cpp
+++ b/src/gui/kernel/qscreen_p.h
@@ -1,10 +1,10 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the plugins of the Qt Toolkit.
+** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@@ -39,50 +39,42 @@
**
****************************************************************************/
-#include "qicdengine.h"
+#ifndef QSCREEN_P_H
+#define QSCREEN_P_H
-#include <QtNetwork/private/qbearerplugin_p.h>
+#include <QtGui/qscreen.h>
+#include <QtGui/qplatformscreen_qpa.h>
-#include <QtCore/qdebug.h>
+#include <QtCore/private/qobject_p.h>
-#ifndef QT_NO_BEARERMANAGEMENT
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QIcdEnginePlugin : public QBearerEnginePlugin
-{
-public:
- QIcdEnginePlugin();
- ~QIcdEnginePlugin();
-
- QStringList keys() const;
- QBearerEngine *create(const QString &key) const;
-};
-
-QIcdEnginePlugin::QIcdEnginePlugin()
-{
-}
+QT_MODULE(Gui)
-QIcdEnginePlugin::~QIcdEnginePlugin()
+class QScreenPrivate : public QObjectPrivate
{
-}
-
-QStringList QIcdEnginePlugin::keys() const
-{
- return QStringList() << QLatin1String("icd");
-}
+public:
+ QScreenPrivate(QPlatformScreen *screen)
+ : platformScreen(screen)
+ {
+ currentOrientation = screen->currentOrientation();
+ geometry = screen->geometry();
+ availableGeometry = screen->availableGeometry();
+ logicalDpi = screen->logicalDpi();
+ }
-QBearerEngine *QIcdEnginePlugin::create(const QString &key) const
-{
- if (key == QLatin1String("icd"))
- return new QIcdEngine;
- else
- return 0;
-}
+ Qt::ScreenOrientation currentOrientation;
+ QRect geometry;
+ QRect availableGeometry;
+ QDpi logicalDpi;
-Q_EXPORT_STATIC_PLUGIN(QIcdEnginePlugin)
-Q_EXPORT_PLUGIN2(qicdbearer, QIcdEnginePlugin)
+ QPlatformScreen *platformScreen;
+};
QT_END_NAMESPACE
-#endif
+QT_END_HEADER
+
+#endif // QSCREEN_P_H
diff --git a/src/gui/kernel/qsessionmanager.h b/src/gui/kernel/qsessionmanager.h
index 31a26c1582..89c5cf47b6 100644
--- a/src/gui/kernel/qsessionmanager.h
+++ b/src/gui/kernel/qsessionmanager.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qsessionmanager_qpa.cpp b/src/gui/kernel/qsessionmanager_qpa.cpp
index 7ade0df3a8..9b6ec26ff4 100644
--- a/src/gui/kernel/qsessionmanager_qpa.cpp
+++ b/src/gui/kernel/qsessionmanager_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index 64b0aa1741..2bacac9598 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h
index 28c37f9a2e..e447507b87 100644
--- a/src/gui/kernel/qshortcutmap_p.h
+++ b/src/gui/kernel/qshortcutmap_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index 7585d23558..eb0f055270 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -76,9 +76,19 @@ int QStyleHints::keyboardInputInterval() const
return hint(QPlatformIntegration::KeyboardInputInterval).toInt();
}
+int QStyleHints::keyboardAutoRepeatRate() const
+{
+ return hint(QPlatformIntegration::KeyboardAutoRepeatRate).toInt();
+}
+
int QStyleHints::cursorFlashTime() const
{
return hint(QPlatformIntegration::CursorFlashTime).toInt();
}
+bool QStyleHints::showIsFullScreen() const
+{
+ return hint(QPlatformIntegration::ShowIsFullScreen).toBool();
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h
index bcc9b589e2..6fa72110fb 100644
--- a/src/gui/kernel/qstylehints.h
+++ b/src/gui/kernel/qstylehints.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -60,7 +60,9 @@ public:
int startDragDistance() const;
int startDragTime() const;
int keyboardInputInterval() const;
+ int keyboardAutoRepeatRate() const;
int cursorFlashTime() const;
+ bool showIsFullScreen() const;
private:
friend class QGuiApplication;
QStyleHints();
diff --git a/src/gui/kernel/qsurface.cpp b/src/gui/kernel/qsurface.cpp
index 871b765bfd..bfdb772cfb 100644
--- a/src/gui/kernel/qsurface.cpp
+++ b/src/gui/kernel/qsurface.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qsurface.h b/src/gui/kernel/qsurface.h
index a6c8745a7a..fba1690af4 100644
--- a/src/gui/kernel/qsurface.h
+++ b/src/gui/kernel/qsurface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp
index b200cdb113..39b2d491a3 100644
--- a/src/gui/kernel/qsurfaceformat.cpp
+++ b/src/gui/kernel/qsurfaceformat.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qsurfaceformat.h b/src/gui/kernel/qsurfaceformat.h
index cdbd50740b..3d3bfeb30b 100644
--- a/src/gui/kernel/qsurfaceformat.h
+++ b/src/gui/kernel/qsurfaceformat.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qt_gui_pch.h b/src/gui/kernel/qt_gui_pch.h
index 3cb527d0b1..98a516f54e 100644
--- a/src/gui/kernel/qt_gui_pch.h
+++ b/src/gui/kernel/qt_gui_pch.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qtouchdevice.cpp b/src/gui/kernel/qtouchdevice.cpp
index abf1acc310..b8d4d01655 100644
--- a/src/gui/kernel/qtouchdevice.cpp
+++ b/src/gui/kernel/qtouchdevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qtouchdevice.h b/src/gui/kernel/qtouchdevice.h
index 496bb7a522..6efa7814c9 100644
--- a/src/gui/kernel/qtouchdevice.h
+++ b/src/gui/kernel/qtouchdevice.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qtouchdevice_p.h b/src/gui/kernel/qtouchdevice_p.h
index f782d1585d..c37e4a8bf5 100644
--- a/src/gui/kernel/qtouchdevice_p.h
+++ b/src/gui/kernel/qtouchdevice_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 55329f56bd..97c6b0cbc9 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -54,6 +54,8 @@
#include <QtCore/QDebug>
+#include <QStyleHints>
+
QT_BEGIN_NAMESPACE
/*!
@@ -741,30 +743,42 @@ QObject *QWindow::focusObject() const
return const_cast<QWindow *>(this);
}
+void QWindow::show()
+{
+ if (qApp->styleHints()->showIsFullScreen())
+ showFullScreen();
+ else
+ showNormal();
+}
+
+void QWindow::hide()
+{
+ setVisible(false);
+}
void QWindow::showMinimized()
{
setWindowState(Qt::WindowMinimized);
- show();
+ setVisible(true);
}
void QWindow::showMaximized()
{
setWindowState(Qt::WindowMaximized);
- show();
+ setVisible(true);
}
void QWindow::showFullScreen()
{
setWindowState(Qt::WindowFullScreen);
- show();
+ setVisible(true);
requestActivateWindow();
}
void QWindow::showNormal()
{
setWindowState(Qt::WindowNoState);
- show();
+ setVisible(true);
}
bool QWindow::close()
@@ -774,72 +788,83 @@ bool QWindow::close()
return true;
}
-void QWindow::exposeEvent(QExposeEvent *)
+void QWindow::exposeEvent(QExposeEvent *ev)
{
+ ev->ignore();
}
-void QWindow::moveEvent(QMoveEvent *)
+void QWindow::moveEvent(QMoveEvent *ev)
{
+ ev->ignore();
}
-void QWindow::resizeEvent(QResizeEvent *)
+void QWindow::resizeEvent(QResizeEvent *ev)
{
+ ev->ignore();
}
-void QWindow::showEvent(QShowEvent *)
+void QWindow::showEvent(QShowEvent *ev)
{
+ ev->ignore();
}
-void QWindow::hideEvent(QHideEvent *)
+void QWindow::hideEvent(QHideEvent *ev)
{
+ ev->ignore();
}
-bool QWindow::event(QEvent *event)
+bool QWindow::event(QEvent *ev)
{
- switch (event->type()) {
+ switch (ev->type()) {
case QEvent::MouseMove:
- mouseMoveEvent(static_cast<QMouseEvent*>(event));
+ mouseMoveEvent(static_cast<QMouseEvent*>(ev));
break;
case QEvent::MouseButtonPress:
- mousePressEvent(static_cast<QMouseEvent*>(event));
+ mousePressEvent(static_cast<QMouseEvent*>(ev));
break;
case QEvent::MouseButtonRelease:
- mouseReleaseEvent(static_cast<QMouseEvent*>(event));
+ mouseReleaseEvent(static_cast<QMouseEvent*>(ev));
break;
case QEvent::MouseButtonDblClick:
- mouseDoubleClickEvent(static_cast<QMouseEvent*>(event));
+ mouseDoubleClickEvent(static_cast<QMouseEvent*>(ev));
+ break;
+
+ case QEvent::TouchBegin:
+ case QEvent::TouchUpdate:
+ case QEvent::TouchEnd:
+ touchEvent(static_cast<QTouchEvent *>(ev));
break;
case QEvent::Move:
- moveEvent(static_cast<QMoveEvent*>(event));
+ moveEvent(static_cast<QMoveEvent*>(ev));
break;
case QEvent::Resize:
- resizeEvent(static_cast<QResizeEvent*>(event));
+ resizeEvent(static_cast<QResizeEvent*>(ev));
break;
case QEvent::KeyPress:
- keyPressEvent(static_cast<QKeyEvent *>(event));
+ keyPressEvent(static_cast<QKeyEvent *>(ev));
break;
case QEvent::KeyRelease:
- keyReleaseEvent(static_cast<QKeyEvent *>(event));
+ keyReleaseEvent(static_cast<QKeyEvent *>(ev));
break;
case QEvent::FocusIn:
- focusInEvent(static_cast<QFocusEvent *>(event));
+ focusInEvent(static_cast<QFocusEvent *>(ev));
break;
case QEvent::FocusOut:
- focusOutEvent(static_cast<QFocusEvent *>(event));
+ focusOutEvent(static_cast<QFocusEvent *>(ev));
break;
#ifndef QT_NO_WHEELEVENT
case QEvent::Wheel:
- wheelEvent(static_cast<QWheelEvent*>(event));
+ wheelEvent(static_cast<QWheelEvent*>(ev));
break;
#endif
@@ -852,62 +877,74 @@ bool QWindow::event(QEvent *event)
break; }
case QEvent::Expose:
- exposeEvent(static_cast<QExposeEvent *>(event));
+ exposeEvent(static_cast<QExposeEvent *>(ev));
break;
case QEvent::Show:
- showEvent(static_cast<QShowEvent *>(event));
+ showEvent(static_cast<QShowEvent *>(ev));
break;
case QEvent::Hide:
- hideEvent(static_cast<QHideEvent *>(event));
+ hideEvent(static_cast<QHideEvent *>(ev));
break;
default:
- return QObject::event(event);
+ return QObject::event(ev);
}
return true;
}
-void QWindow::keyPressEvent(QKeyEvent *)
+void QWindow::keyPressEvent(QKeyEvent *ev)
{
+ ev->ignore();
}
-void QWindow::keyReleaseEvent(QKeyEvent *)
+void QWindow::keyReleaseEvent(QKeyEvent *ev)
{
+ ev->ignore();
}
-void QWindow::focusInEvent(QFocusEvent *)
+void QWindow::focusInEvent(QFocusEvent *ev)
{
+ ev->ignore();
}
-void QWindow::focusOutEvent(QFocusEvent *)
+void QWindow::focusOutEvent(QFocusEvent *ev)
{
+ ev->ignore();
}
-void QWindow::mousePressEvent(QMouseEvent *)
+void QWindow::mousePressEvent(QMouseEvent *ev)
{
+ ev->ignore();
}
-void QWindow::mouseReleaseEvent(QMouseEvent *)
+void QWindow::mouseReleaseEvent(QMouseEvent *ev)
{
+ ev->ignore();
}
-void QWindow::mouseDoubleClickEvent(QMouseEvent *)
+void QWindow::mouseDoubleClickEvent(QMouseEvent *ev)
{
+ ev->ignore();
}
-void QWindow::mouseMoveEvent(QMouseEvent *)
+void QWindow::mouseMoveEvent(QMouseEvent *ev)
{
+ ev->ignore();
}
#ifndef QT_NO_WHEELEVENT
-void QWindow::wheelEvent(QWheelEvent *)
+void QWindow::wheelEvent(QWheelEvent *ev)
{
+ ev->ignore();
}
#endif //QT_NO_WHEELEVENT
-
+void QWindow::touchEvent(QTouchEvent *ev)
+{
+ ev->ignore();
+}
/*!
\fn QPoint QWindow::mapToGlobal(const QPoint &pos) const
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 11ff6b101d..4d161658c6 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -72,6 +72,7 @@ class QMouseEvent;
#ifndef QT_NO_WHEELEVENT
class QWheelEvent;
#endif
+class QTouchEvent;
class QPlatformSurface;
class QPlatformWindow;
@@ -208,8 +209,8 @@ public:
public Q_SLOTS:
void setVisible(bool visible);
- inline void show() { setVisible(true); }
- inline void hide() { setVisible(false); }
+ void show();
+ void hide();
void showMinimized();
void showMaximized();
@@ -285,6 +286,7 @@ protected:
#ifndef QT_NO_WHEELEVENT
virtual void wheelEvent(QWheelEvent *);
#endif
+ virtual void touchEvent(QTouchEvent *);
QWindow(QWindowPrivate &dd, QWindow *parent);
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index ee91b61cf1..d3b6868aa5 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h
index b77ec0b2f3..3366606036 100644
--- a/src/gui/kernel/qwindowdefs.h
+++ b/src/gui/kernel/qwindowdefs.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qwindowdefs_win.h b/src/gui/kernel/qwindowdefs_win.h
index 2bf9c8e672..2db1a4649f 100644
--- a/src/gui/kernel/qwindowdefs_win.h
+++ b/src/gui/kernel/qwindowdefs_win.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
index 016446780b..4a7ebd1c0c 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -219,38 +219,26 @@ void QWindowSystemInterface::registerTouchDevice(QTouchDevice *device)
QTouchDevicePrivate::registerDevice(device);
}
-void QWindowSystemInterface::handleTouchEvent(QWindow *w, QEvent::Type type, QTouchDevice *device,
- const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods)
+void QWindowSystemInterface::handleTouchEvent(QWindow *w, QTouchDevice *device,
+ const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleTouchEvent(w, time, type, device, points, mods);
+ handleTouchEvent(w, time, device, points, mods);
}
-void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QEvent::Type type,
- QTouchDevice *device,
- const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods)
+QList<QTouchEvent::TouchPoint> QWindowSystemInterfacePrivate::convertTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points, QEvent::Type *type)
{
- if (!points.size()) // Touch events must have at least one point
- return;
-
- if (!QTouchDevicePrivate::isRegistered(device)) // Disallow passing bogus, non-registered devices.
- return;
-
QList<QTouchEvent::TouchPoint> touchPoints;
Qt::TouchPointStates states;
QTouchEvent::TouchPoint p;
- QList<struct TouchPoint>::const_iterator point = points.constBegin();
- QList<struct TouchPoint>::const_iterator end = points.constEnd();
+ QList<QWindowSystemInterface::TouchPoint>::const_iterator point = points.constBegin();
+ QList<QWindowSystemInterface::TouchPoint>::const_iterator end = points.constEnd();
while (point != end) {
p.setId(point->id);
p.setPressure(point->pressure);
states |= point->state;
- Qt::TouchPointStates state = point->state;
- if (point->isPrimary) {
- state |= Qt::TouchPointPrimary;
- }
- p.setState(state);
+ p.setState(point->state);
const QPointF screenPos = point->area.center();
p.setScreenPos(screenPos);
@@ -268,36 +256,60 @@ void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QEv
++point;
}
+ // Determine the event type based on the combined point states.
+ if (type) {
+ *type = QEvent::TouchUpdate;
+ if (states == Qt::TouchPointPressed)
+ *type = QEvent::TouchBegin;
+ else if (states == Qt::TouchPointReleased)
+ *type = QEvent::TouchEnd;
+ }
+
+ return touchPoints;
+}
+
+void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QTouchDevice *device,
+ const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
+{
+ if (!points.size()) // Touch events must have at least one point
+ return;
+
+ if (!QTouchDevicePrivate::isRegistered(device)) // Disallow passing bogus, non-registered devices.
+ return;
+
+ QEvent::Type type;
+ QList<QTouchEvent::TouchPoint> touchPoints = QWindowSystemInterfacePrivate::convertTouchPoints(points, &type);
+
QWindowSystemInterfacePrivate::TouchEvent *e =
new QWindowSystemInterfacePrivate::TouchEvent(tlw, timestamp, type, device, touchPoints, mods);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleScreenOrientationChange(QScreen *screen)
+void QWindowSystemInterface::handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation orientation)
{
QWindowSystemInterfacePrivate::ScreenOrientationEvent *e =
- new QWindowSystemInterfacePrivate::ScreenOrientationEvent(screen);
+ new QWindowSystemInterfacePrivate::ScreenOrientationEvent(screen, orientation);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleScreenGeometryChange(QScreen *screen)
+void QWindowSystemInterface::handleScreenGeometryChange(QScreen *screen, const QRect &geometry)
{
QWindowSystemInterfacePrivate::ScreenGeometryEvent *e =
- new QWindowSystemInterfacePrivate::ScreenGeometryEvent(screen);
+ new QWindowSystemInterfacePrivate::ScreenGeometryEvent(screen, geometry);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleScreenAvailableGeometryChange(QScreen *screen)
+void QWindowSystemInterface::handleScreenAvailableGeometryChange(QScreen *screen, const QRect &availableGeometry)
{
QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e =
- new QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent(screen);
+ new QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent(screen, availableGeometry);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QScreen *screen)
+void QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal dpiX, qreal dpiY)
{
QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e =
- new QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent(screen);
+ new QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent(screen, dpiX, dpiY);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h
index 423281955c..4a17fb9035 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -86,9 +86,8 @@ public:
static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
struct TouchPoint {
- TouchPoint() : id(0), isPrimary(false), pressure(0), state(Qt::TouchPointStationary), flags(0) { }
+ TouchPoint() : id(0), pressure(0), state(Qt::TouchPointStationary), flags(0) { }
int id; // for application use
- bool isPrimary; // for application use
QPointF normalPosition; // touch device coordinates, (0 to 1, 0 to 1)
QRectF area; // the touched area, centered at position in screen coordinates
qreal pressure; // 0 to 1
@@ -99,9 +98,9 @@ public:
};
static void registerTouchDevice(QTouchDevice *device);
- static void handleTouchEvent(QWindow *w, QEvent::Type type, QTouchDevice *device,
+ static void handleTouchEvent(QWindow *w, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
- static void handleTouchEvent(QWindow *w, ulong timestamp, QEvent::Type type, QTouchDevice *device,
+ static void handleTouchEvent(QWindow *w, ulong timestamp, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
static void handleGeometryChange(QWindow *w, const QRect &newRect);
@@ -123,10 +122,10 @@ public:
static Qt::DropAction handleDrop(QWindow *w, QMimeData *dropData, const QPoint &p);
// Changes to the screen
- static void handleScreenOrientationChange(QScreen *screen);
- static void handleScreenGeometryChange(QScreen *screen);
- static void handleScreenAvailableGeometryChange(QScreen *screen);
- static void handleScreenLogicalDotsPerInchChange(QScreen *screen);
+ static void handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation newOrientation);
+ static void handleScreenGeometryChange(QScreen *screen, const QRect &newGeometry);
+ static void handleScreenAvailableGeometryChange(QScreen *screen, const QRect &newAvailableGeometry);
+ static void handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal newDpiX, qreal newDpiY);
// For event dispatcher implementations
static bool sendWindowSystemEvents(QAbstractEventDispatcher *eventDispatcher, QEventLoop::ProcessEventsFlags flags);
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
index 5580104c3b..b5614eb38e 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -72,8 +72,9 @@ public:
class WindowSystemEvent {
public:
explicit WindowSystemEvent(EventType t)
- : type(t) { }
+ : type(t), synthetic(false) { }
EventType type;
+ bool synthetic;
};
class CloseEvent : public WindowSystemEvent {
@@ -197,30 +198,35 @@ public:
class ScreenOrientationEvent : public WindowSystemEvent {
public:
- ScreenOrientationEvent(QScreen *s)
- : WindowSystemEvent(ScreenOrientation), screen(s) { }
+ ScreenOrientationEvent(QScreen *s, Qt::ScreenOrientation o)
+ : WindowSystemEvent(ScreenOrientation), screen(s), orientation(o) { }
QWeakPointer<QScreen> screen;
+ Qt::ScreenOrientation orientation;
};
class ScreenGeometryEvent : public WindowSystemEvent {
public:
- ScreenGeometryEvent(QScreen *s)
- : WindowSystemEvent(ScreenGeometry), screen(s) { }
+ ScreenGeometryEvent(QScreen *s, const QRect &g)
+ : WindowSystemEvent(ScreenGeometry), screen(s), geometry(g) { }
QWeakPointer<QScreen> screen;
+ QRect geometry;
};
class ScreenAvailableGeometryEvent : public WindowSystemEvent {
public:
- ScreenAvailableGeometryEvent(QScreen *s)
- : WindowSystemEvent(ScreenAvailableGeometry), screen(s) { }
+ ScreenAvailableGeometryEvent(QScreen *s, const QRect &g)
+ : WindowSystemEvent(ScreenAvailableGeometry), screen(s), availableGeometry(g) { }
QWeakPointer<QScreen> screen;
+ QRect availableGeometry;
};
class ScreenLogicalDotsPerInchEvent : public WindowSystemEvent {
public:
- ScreenLogicalDotsPerInchEvent(QScreen *s)
- : WindowSystemEvent(ScreenLogicalDotsPerInch), screen(s) { }
+ ScreenLogicalDotsPerInchEvent(QScreen *s, qreal dx, qreal dy)
+ : WindowSystemEvent(ScreenLogicalDotsPerInch), screen(s), dpiX(dx), dpiY(dy) { }
QWeakPointer<QScreen> screen;
+ qreal dpiX;
+ qreal dpiY;
};
class MapEvent : public WindowSystemEvent {
@@ -256,6 +262,8 @@ public:
static void queueWindowSystemEvent(WindowSystemEvent *ev);
static QTime eventTime;
+
+ static QList<QTouchEvent::TouchPoint> convertTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points, QEvent::Type *type);
};
QT_END_HEADER
diff --git a/src/gui/math3d/qgenericmatrix.cpp b/src/gui/math3d/qgenericmatrix.cpp
index c1e1d92935..88682702de 100644
--- a/src/gui/math3d/qgenericmatrix.cpp
+++ b/src/gui/math3d/qgenericmatrix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h
index a90d32a2b6..c992415426 100644
--- a/src/gui/math3d/qgenericmatrix.h
+++ b/src/gui/math3d/qgenericmatrix.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp
index 1797564a98..b6b60e7072 100644
--- a/src/gui/math3d/qmatrix4x4.cpp
+++ b/src/gui/math3d/qmatrix4x4.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h
index 2c98dd03e3..98f967f63c 100644
--- a/src/gui/math3d/qmatrix4x4.h
+++ b/src/gui/math3d/qmatrix4x4.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp
index ef1b545e10..53e01323d9 100644
--- a/src/gui/math3d/qquaternion.cpp
+++ b/src/gui/math3d/qquaternion.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h
index 802de8b3b7..78b2d91d13 100644
--- a/src/gui/math3d/qquaternion.h
+++ b/src/gui/math3d/qquaternion.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp
index cd94007aad..a1c7ac048f 100644
--- a/src/gui/math3d/qvector2d.cpp
+++ b/src/gui/math3d/qvector2d.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qvector2d.h b/src/gui/math3d/qvector2d.h
index f771ce34d0..df435bcf49 100644
--- a/src/gui/math3d/qvector2d.h
+++ b/src/gui/math3d/qvector2d.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp
index 4e8a62fea3..096d14223c 100644
--- a/src/gui/math3d/qvector3d.cpp
+++ b/src/gui/math3d/qvector3d.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qvector3d.h b/src/gui/math3d/qvector3d.h
index 17785a6c7c..55c0e36ca2 100644
--- a/src/gui/math3d/qvector3d.h
+++ b/src/gui/math3d/qvector3d.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp
index 41c7b296be..ce3d410b39 100644
--- a/src/gui/math3d/qvector4d.cpp
+++ b/src/gui/math3d/qvector4d.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h
index 64b8079b76..ceff21163f 100644
--- a/src/gui/math3d/qvector4d.h
+++ b/src/gui/math3d/qvector4d.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp
index 3233fcfa5b..246d4dfa24 100644
--- a/src/gui/opengl/qopengl.cpp
+++ b/src/gui/opengl/qopengl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h
index cc64804efd..a3ec59cef1 100644
--- a/src/gui/opengl/qopengl.h
+++ b/src/gui/opengl/qopengl.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengl2pexvertexarray.cpp b/src/gui/opengl/qopengl2pexvertexarray.cpp
index ec26fdbf5b..1db2223667 100644
--- a/src/gui/opengl/qopengl2pexvertexarray.cpp
+++ b/src/gui/opengl/qopengl2pexvertexarray.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengl2pexvertexarray_p.h b/src/gui/opengl/qopengl2pexvertexarray_p.h
index 5ad4f7a237..779fa5a545 100644
--- a/src/gui/opengl/qopengl2pexvertexarray_p.h
+++ b/src/gui/opengl/qopengl2pexvertexarray_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengl_p.h b/src/gui/opengl/qopengl_p.h
index b09f9447db..5323604ce5 100644
--- a/src/gui/opengl/qopengl_p.h
+++ b/src/gui/opengl/qopengl_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglbuffer.cpp b/src/gui/opengl/qopenglbuffer.cpp
index bdd38018fa..6bf4fedc8e 100644
--- a/src/gui/opengl/qopenglbuffer.cpp
+++ b/src/gui/opengl/qopenglbuffer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglbuffer.h b/src/gui/opengl/qopenglbuffer.h
index 52a2c4d640..83ad5cda51 100644
--- a/src/gui/opengl/qopenglbuffer.h
+++ b/src/gui/opengl/qopenglbuffer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglcustomshaderstage.cpp b/src/gui/opengl/qopenglcustomshaderstage.cpp
index 6cedf66df1..25a07b2a4c 100644
--- a/src/gui/opengl/qopenglcustomshaderstage.cpp
+++ b/src/gui/opengl/qopenglcustomshaderstage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglcustomshaderstage_p.h b/src/gui/opengl/qopenglcustomshaderstage_p.h
index de459c0050..35c59a9e9b 100644
--- a/src/gui/opengl/qopenglcustomshaderstage_p.h
+++ b/src/gui/opengl/qopenglcustomshaderstage_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/gui/opengl/qopenglengineshadermanager.cpp
index aaca6ad89c..9520f07fcc 100644
--- a/src/gui/opengl/qopenglengineshadermanager.cpp
+++ b/src/gui/opengl/qopenglengineshadermanager.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -247,8 +247,7 @@ QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(QOpenGLContext* context)
if (!inCache)
simpleShaderCache.store(simpleShaderProg, context);
} else {
- qCritical() << "Errors linking simple shader:"
- << simpleShaderProg->log();
+ qCritical("Errors linking simple shader: %s", qPrintable(simpleShaderProg->log()));
}
// Compile the blit shader:
@@ -289,8 +288,7 @@ QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(QOpenGLContext* context)
if (!inCache)
blitShaderCache.store(blitShaderProg, context);
} else {
- qCritical() << "Errors linking blit shader:"
- << blitShaderProg->log();
+ qCritical("Errors linking blit shader: %s", qPrintable(blitShaderProg->log()));
}
#ifdef QT_GL_SHARED_SHADER_DEBUG
diff --git a/src/gui/opengl/qopenglengineshadermanager_p.h b/src/gui/opengl/qopenglengineshadermanager_p.h
index 1dcc4fe7a7..39cd2e4d70 100644
--- a/src/gui/opengl/qopenglengineshadermanager_p.h
+++ b/src/gui/opengl/qopenglengineshadermanager_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglengineshadersource_p.h b/src/gui/opengl/qopenglengineshadersource_p.h
index cb85212308..65e3fc54a5 100644
--- a/src/gui/opengl/qopenglengineshadersource_p.h
+++ b/src/gui/opengl/qopenglengineshadersource_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglextensions_p.h b/src/gui/opengl/qopenglextensions_p.h
index 65d92e3a65..b66af217a6 100644
--- a/src/gui/opengl/qopenglextensions_p.h
+++ b/src/gui/opengl/qopenglextensions_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index bd2f1fd5dc..261a6df27d 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglframebufferobject.h b/src/gui/opengl/qopenglframebufferobject.h
index 8a57784f4f..acce7d7391 100644
--- a/src/gui/opengl/qopenglframebufferobject.h
+++ b/src/gui/opengl/qopenglframebufferobject.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglframebufferobject_p.h b/src/gui/opengl/qopenglframebufferobject_p.h
index 93a8bbf32f..aeaa2a0e7d 100644
--- a/src/gui/opengl/qopenglframebufferobject_p.h
+++ b/src/gui/opengl/qopenglframebufferobject_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index 24cf858a7c..a34dfc193c 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h
index 7d9e34740e..2f4b5b18cb 100644
--- a/src/gui/opengl/qopenglfunctions.h
+++ b/src/gui/opengl/qopenglfunctions.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglgradientcache.cpp b/src/gui/opengl/qopenglgradientcache.cpp
index f8d61cd620..dde5eaf93e 100644
--- a/src/gui/opengl/qopenglgradientcache.cpp
+++ b/src/gui/opengl/qopenglgradientcache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglgradientcache_p.h b/src/gui/opengl/qopenglgradientcache_p.h
index 53abf221d2..055798fcd8 100644
--- a/src/gui/opengl/qopenglgradientcache_p.h
+++ b/src/gui/opengl/qopenglgradientcache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp
index 4e5c2703dc..35ef609529 100644
--- a/src/gui/opengl/qopenglpaintdevice.cpp
+++ b/src/gui/opengl/qopenglpaintdevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h
index 9edc347b32..0a7bb3c9f3 100644
--- a/src/gui/opengl/qopenglpaintdevice.h
+++ b/src/gui/opengl/qopenglpaintdevice.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
index c1bde757a2..834beda977 100644
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ b/src/gui/opengl/qopenglpaintengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -673,8 +673,8 @@ void QOpenGL2PaintEngineExPrivate::cleanupVectorPath(QPaintEngineEx *engine, voi
d->unusedIBOSToClean << c->ibo;
#else
Q_UNUSED(engine);
- qFree(c->vertices);
- qFree(c->indices);
+ free(c->vertices);
+ free(c->indices);
#endif
delete c;
}
@@ -719,7 +719,7 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
cache->vbo = 0;
Q_ASSERT(cache->ibo == 0);
#else
- qFree(cache->vertices);
+ free(cache->vertices);
Q_ASSERT(cache->indices == 0);
#endif
updateCache = true;
@@ -747,7 +747,7 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
glBufferData(GL_ARRAY_BUFFER, floatSizeInBytes, vertexCoordinateArray.data(), GL_STATIC_DRAW);
cache->ibo = 0;
#else
- cache->vertices = (float *) qMalloc(floatSizeInBytes);
+ cache->vertices = (float *) malloc(floatSizeInBytes);
memcpy(cache->vertices, vertexCoordinateArray.data(), floatSizeInBytes);
cache->indices = 0;
#endif
@@ -799,8 +799,8 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
glDeleteBuffers(1, &cache->vbo);
glDeleteBuffers(1, &cache->ibo);
#else
- qFree(cache->vertices);
- qFree(cache->indices);
+ free(cache->vertices);
+ free(cache->indices);
#endif
updateCache = true;
}
@@ -835,12 +835,12 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
vertices[i] = float(inverseScale * polys.vertices.at(i));
funcs.glBufferData(GL_ARRAY_BUFFER, sizeof(float) * vertices.size(), vertices.data(), GL_STATIC_DRAW);
#else
- cache->vertices = (float *) qMalloc(sizeof(float) * polys.vertices.size());
+ cache->vertices = (float *) malloc(sizeof(float) * polys.vertices.size());
if (polys.indices.type() == QVertexIndexVector::UnsignedInt) {
- cache->indices = (quint32 *) qMalloc(sizeof(quint32) * polys.indices.size());
+ cache->indices = (quint32 *) malloc(sizeof(quint32) * polys.indices.size());
memcpy(cache->indices, polys.indices.data(), sizeof(quint32) * polys.indices.size());
} else {
- cache->indices = (quint16 *) qMalloc(sizeof(quint16) * polys.indices.size());
+ cache->indices = (quint16 *) malloc(sizeof(quint16) * polys.indices.size());
memcpy(cache->indices, polys.indices.data(), sizeof(quint16) * polys.indices.size());
}
for (int i = 0; i < polys.vertices.size(); ++i)
diff --git a/src/gui/opengl/qopenglpaintengine_p.h b/src/gui/opengl/qopenglpaintengine_p.h
index 1ce04eb5a7..9f125eb616 100644
--- a/src/gui/opengl/qopenglpaintengine_p.h
+++ b/src/gui/opengl/qopenglpaintengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglshadercache_meego_p.h b/src/gui/opengl/qopenglshadercache_meego_p.h
index 86a8a861da..02a1c84336 100644
--- a/src/gui/opengl/qopenglshadercache_meego_p.h
+++ b/src/gui/opengl/qopenglshadercache_meego_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglshadercache_p.h b/src/gui/opengl/qopenglshadercache_p.h
index 05a058050c..64435eb1c2 100644
--- a/src/gui/opengl/qopenglshadercache_p.h
+++ b/src/gui/opengl/qopenglshadercache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index 70f9b042c7..fab764ed6e 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -265,7 +265,6 @@ bool QOpenGLShaderPrivate::compile(QOpenGLShader *q)
glfuncs->glGetShaderSource(shader, sourceCodeLength, &temp, sourceCodeBuffer);
}
- QString log;
if (logBuffer)
log = QString::fromLatin1(logBuffer);
else
diff --git a/src/gui/opengl/qopenglshaderprogram.h b/src/gui/opengl/qopenglshaderprogram.h
index 4c123749a2..f6244cd12c 100644
--- a/src/gui/opengl/qopenglshaderprogram.h
+++ b/src/gui/opengl/qopenglshaderprogram.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengltexturecache.cpp b/src/gui/opengl/qopengltexturecache.cpp
index 067b7a9e20..a93ae91354 100644
--- a/src/gui/opengl/qopengltexturecache.cpp
+++ b/src/gui/opengl/qopengltexturecache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -107,6 +107,8 @@ QOpenGLTextureCache::~QOpenGLTextureCache()
GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QPixmap &pixmap)
{
+ if (pixmap.isNull())
+ return 0;
QMutexLocker locker(&m_mutex);
qint64 key = pixmap.cacheKey();
@@ -128,6 +130,8 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QPixmap &
GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QImage &image)
{
+ if (image.isNull())
+ return 0;
QMutexLocker locker(&m_mutex);
qint64 key = image.cacheKey();
diff --git a/src/gui/opengl/qopengltexturecache_p.h b/src/gui/opengl/qopengltexturecache_p.h
index bdee9f4e83..c6e46dd6cb 100644
--- a/src/gui/opengl/qopengltexturecache_p.h
+++ b/src/gui/opengl/qopengltexturecache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -73,7 +73,7 @@ private:
QOpenGLSharedResourceGuard *m_resource;
};
-class QOpenGLTextureCache : public QOpenGLSharedResource
+class Q_GUI_EXPORT QOpenGLTextureCache : public QOpenGLSharedResource
{
public:
static QOpenGLTextureCache *cacheForContext(QOpenGLContext *context);
diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp
index 55acdb39b9..9f5ce46854 100644
--- a/src/gui/opengl/qopengltextureglyphcache.cpp
+++ b/src/gui/opengl/qopengltextureglyphcache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengltextureglyphcache_p.h b/src/gui/opengl/qopengltextureglyphcache_p.h
index 97f9ac3c64..5da8d1ce4b 100644
--- a/src/gui/opengl/qopengltextureglyphcache_p.h
+++ b/src/gui/opengl/qopengltextureglyphcache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengltriangulatingstroker.cpp b/src/gui/opengl/qopengltriangulatingstroker.cpp
index 4d1a8f86b2..65ee8753c4 100644
--- a/src/gui/opengl/qopengltriangulatingstroker.cpp
+++ b/src/gui/opengl/qopengltriangulatingstroker.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengltriangulatingstroker_p.h b/src/gui/opengl/qopengltriangulatingstroker_p.h
index abb10957c0..965fce6157 100644
--- a/src/gui/opengl/qopengltriangulatingstroker_p.h
+++ b/src/gui/opengl/qopengltriangulatingstroker_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qrbtree_p.h b/src/gui/opengl/qrbtree_p.h
index ac464a3fbe..dbcf037193 100644
--- a/src/gui/opengl/qrbtree_p.h
+++ b/src/gui/opengl/qrbtree_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qtriangulator.cpp b/src/gui/opengl/qtriangulator.cpp
index 67c2a6494e..c4b8aba9a7 100644
--- a/src/gui/opengl/qtriangulator.cpp
+++ b/src/gui/opengl/qtriangulator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -41,7 +41,6 @@
#include "qtriangulator_p.h"
-#include <QtWidgets/qdialog.h>
#include <QtGui/qevent.h>
#include <QtGui/qpainter.h>
#include <QtGui/qpainterpath.h>
@@ -721,78 +720,6 @@ inline void QInt64Set::clear()
}
//============================================================================//
-// QRingBuffer //
-//============================================================================//
-
-// T must be POD.
-template <class T>
-class QRingBuffer
-{
-public:
- inline QRingBuffer() : m_array(0), m_head(0), m_size(0), m_capacity(0) { }
- inline ~QRingBuffer() {if (m_array) delete[] m_array;}
- bool reallocate(int capacity);
- inline const T &head() const {Q_ASSERT(m_size > 0); return m_array[m_head];}
- inline const T &dequeue();
- inline void enqueue(const T &x);
- inline bool isEmpty() const {return m_size == 0;}
-private:
- T *m_array;
- int m_head;
- int m_size;
- int m_capacity;
-};
-
-template <class T>
-bool QRingBuffer<T>::reallocate(int capacity)
-{
- T *oldArray = m_array;
- m_array = new T[capacity];
- if (m_array) {
- if (oldArray) {
- if (m_head + m_size > m_capacity) {
- memcpy(m_array, oldArray + m_head, (m_capacity - m_head) * sizeof(T));
- memcpy(m_array + (m_capacity - m_head), oldArray, (m_head + m_size - m_capacity) * sizeof(T));
- } else {
- memcpy(m_array, oldArray + m_head, m_size * sizeof(T));
- }
- delete[] oldArray;
- }
- m_capacity = capacity;
- m_head = 0;
- return true;
- } else {
- m_array = oldArray;
- return false;
- }
-}
-
-template <class T>
-inline const T &QRingBuffer<T>::dequeue()
-{
- Q_ASSERT(m_size > 0);
- Q_ASSERT(m_array);
- Q_ASSERT(m_capacity >= m_size);
- int index = m_head;
- if (++m_head >= m_capacity)
- m_head -= m_capacity;
- --m_size;
- return m_array[index];
-}
-
-template <class T>
-inline void QRingBuffer<T>::enqueue(const T &x)
-{
- if (m_size == m_capacity)
- reallocate(qMax(2 * m_capacity, 64));
- int index = m_head + m_size;
- if (index >= m_capacity)
- index -= m_capacity;
- m_array[index] = x;
- ++m_size;
-}
-
-//============================================================================//
// QTriangulator //
//============================================================================//
template<typename T>
diff --git a/src/gui/opengl/qtriangulator_p.h b/src/gui/opengl/qtriangulator_p.h
index 8f95d58e23..96dedd5eca 100644
--- a/src/gui/opengl/qtriangulator_p.h
+++ b/src/gui/opengl/qtriangulator_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index fa29589508..08f809ed88 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qbackingstore.h b/src/gui/painting/qbackingstore.h
index d5ec3b31d3..0172a78d85 100644
--- a/src/gui/painting/qbackingstore.h
+++ b/src/gui/painting/qbackingstore.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp
index 9d204f9a39..75a75ead7d 100644
--- a/src/gui/painting/qbezier.cpp
+++ b/src/gui/painting/qbezier.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -190,9 +190,12 @@ static inline bool findInflections(qreal a, qreal b, qreal c,
void QBezier::addToPolygon(QPolygonF *polygon, qreal bezier_flattening_threshold) const
{
- QBezier beziers[32];
+ QBezier beziers[10];
+ int levels[10];
beziers[0] = *this;
+ levels[0] = 9;
QBezier *b = beziers;
+ int *lvl = levels;
while (b >= beziers) {
// check if we can pop the top bezier curve from the stack
@@ -208,14 +211,55 @@ void QBezier::addToPolygon(QPolygonF *polygon, qreal bezier_flattening_threshold
qAbs(b->x1 - b->x3) + qAbs(b->y1 - b->y3);
l = 1.;
}
- if (d < bezier_flattening_threshold*l || b == beziers + 31) {
+ if (d < bezier_flattening_threshold*l || *lvl == 0) {
// good enough, we pop it off and add the endpoint
polygon->append(QPointF(b->x4, b->y4));
--b;
+ --lvl;
+ } else {
+ // split, second half of the polygon goes lower into the stack
+ b->split(b+1, b);
+ lvl[1] = --lvl[0];
+ ++b;
+ ++lvl;
+ }
+ }
+}
+
+void QBezier::addToPolygon(QDataBuffer<QPointF> &polygon, qreal bezier_flattening_threshold) const
+{
+ QBezier beziers[10];
+ int levels[10];
+ beziers[0] = *this;
+ levels[0] = 9;
+ QBezier *b = beziers;
+ int *lvl = levels;
+
+ while (b >= beziers) {
+ // check if we can pop the top bezier curve from the stack
+ qreal y4y1 = b->y4 - b->y1;
+ qreal x4x1 = b->x4 - b->x1;
+ qreal l = qAbs(x4x1) + qAbs(y4y1);
+ qreal d;
+ if (l > 1.) {
+ d = qAbs( (x4x1)*(b->y1 - b->y2) - (y4y1)*(b->x1 - b->x2) )
+ + qAbs( (x4x1)*(b->y1 - b->y3) - (y4y1)*(b->x1 - b->x3) );
+ } else {
+ d = qAbs(b->x1 - b->x2) + qAbs(b->y1 - b->y2) +
+ qAbs(b->x1 - b->x3) + qAbs(b->y1 - b->y3);
+ l = 1.;
+ }
+ if (d < bezier_flattening_threshold*l || *lvl == 0) {
+ // good enough, we pop it off and add the endpoint
+ polygon.add(QPointF(b->x4, b->y4));
+ --b;
+ --lvl;
} else {
// split, second half of the polygon goes lower into the stack
b->split(b+1, b);
+ lvl[1] = --lvl[0];
++b;
+ ++lvl;
}
}
}
diff --git a/src/gui/painting/qbezier_p.h b/src/gui/painting/qbezier_p.h
index f1f7eb155a..368ae7e483 100644
--- a/src/gui/painting/qbezier_p.h
+++ b/src/gui/painting/qbezier_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -60,6 +60,7 @@
#include "QtCore/qlist.h"
#include "QtCore/qpair.h"
#include "QtGui/qtransform.h"
+#include <private/qdatabuffer_p.h>
QT_BEGIN_NAMESPACE
@@ -81,6 +82,7 @@ public:
QPolygonF toPolygon(qreal bezier_flattening_threshold = 0.5) const;
void addToPolygon(QPolygonF *p, qreal bezier_flattening_threshold = 0.5) const;
+ void addToPolygon(QDataBuffer<QPointF> &polygon, qreal bezier_flattening_threshold) const;
QRectF bounds() const;
qreal length(qreal error = 0.01) const;
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp
index fd3a8fce52..40047d8c94 100644
--- a/src/gui/painting/qblendfunctions.cpp
+++ b/src/gui/painting/qblendfunctions.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qblendfunctions_p.h b/src/gui/painting/qblendfunctions_p.h
index 76e71b9d2f..412be40d67 100644
--- a/src/gui/painting/qblendfunctions_p.h
+++ b/src/gui/painting/qblendfunctions_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qblittable.cpp b/src/gui/painting/qblittable.cpp
index 11058582ef..020eba0235 100644
--- a/src/gui/painting/qblittable.cpp
+++ b/src/gui/painting/qblittable.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -100,6 +100,12 @@ void QBlittable::unlock()
}
}
+bool QBlittable::isLocked() const
+{
+ Q_D(const QBlittable);
+ return d->locked;
+}
+
QT_END_NAMESPACE
#endif //QT_NO_BLITTABLE
diff --git a/src/gui/painting/qblittable_p.h b/src/gui/painting/qblittable_p.h
index a843733a56..c704c86452 100644
--- a/src/gui/painting/qblittable_p.h
+++ b/src/gui/painting/qblittable_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -80,6 +80,8 @@ public:
QImage *lock();
void unlock();
+ bool isLocked() const;
+
protected:
virtual QImage *doLock() = 0;
virtual void doUnlock() = 0;
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index b4aa27db2f..66f0395582 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h
index daad47cb19..060d11fd79 100644
--- a/src/gui/painting/qbrush.h
+++ b/src/gui/painting/qbrush.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index df2aa1ffe8..5f15ccbc63 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h
index 460a43183f..ac525cb068 100644
--- a/src/gui/painting/qcolor.h
+++ b/src/gui/painting/qcolor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qcolor_p.cpp b/src/gui/painting/qcolor_p.cpp
index 454fe82cfe..14b984978c 100644
--- a/src/gui/painting/qcolor_p.cpp
+++ b/src/gui/painting/qcolor_p.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qcolor_p.h b/src/gui/painting/qcolor_p.h
index 8aec184ee2..f1a4d313e3 100644
--- a/src/gui/painting/qcolor_p.h
+++ b/src/gui/painting/qcolor_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp
index eb00ec87d8..c59399c905 100644
--- a/src/gui/painting/qcosmeticstroker.cpp
+++ b/src/gui/painting/qcosmeticstroker.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h
index 53cdf2c0ac..a7742769bd 100644
--- a/src/gui/painting/qcosmeticstroker_p.h
+++ b/src/gui/painting/qcosmeticstroker_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qcssutil.cpp b/src/gui/painting/qcssutil.cpp
index f670258e46..4758a1362c 100644
--- a/src/gui/painting/qcssutil.cpp
+++ b/src/gui/painting/qcssutil.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qcssutil_p.h b/src/gui/painting/qcssutil_p.h
index fe5b7057b9..e555788343 100644
--- a/src/gui/painting/qcssutil_p.h
+++ b/src/gui/painting/qcssutil_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h
index 8247e4233b..6c0f5d57c6 100644
--- a/src/gui/painting/qdatabuffer_p.h
+++ b/src/gui/painting/qdatabuffer_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index cf899b986d..26fe6df3d4 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_arm_simd.cpp b/src/gui/painting/qdrawhelper_arm_simd.cpp
index 48b67f4020..e1784e049f 100644
--- a/src/gui/painting/qdrawhelper_arm_simd.cpp
+++ b/src/gui/painting/qdrawhelper_arm_simd.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_arm_simd_p.h b/src/gui/painting/qdrawhelper_arm_simd_p.h
index a9def32b6c..e920456d45 100644
--- a/src/gui/painting/qdrawhelper_arm_simd_p.h
+++ b/src/gui/painting/qdrawhelper_arm_simd_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_iwmmxt.cpp b/src/gui/painting/qdrawhelper_iwmmxt.cpp
index 95266eeceb..59b9f28dcd 100644
--- a/src/gui/painting/qdrawhelper_iwmmxt.cpp
+++ b/src/gui/painting/qdrawhelper_iwmmxt.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_mmx.cpp b/src/gui/painting/qdrawhelper_mmx.cpp
index 45cfcd32a0..261cf06a42 100644
--- a/src/gui/painting/qdrawhelper_mmx.cpp
+++ b/src/gui/painting/qdrawhelper_mmx.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_mmx3dnow.cpp b/src/gui/painting/qdrawhelper_mmx3dnow.cpp
index 204f061e1a..7bec5ec336 100644
--- a/src/gui/painting/qdrawhelper_mmx3dnow.cpp
+++ b/src/gui/painting/qdrawhelper_mmx3dnow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_mmx_p.h b/src/gui/painting/qdrawhelper_mmx_p.h
index e2205a89a5..d6f7056669 100644
--- a/src/gui/painting/qdrawhelper_mmx_p.h
+++ b/src/gui/painting/qdrawhelper_mmx_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp
index a7e510e0ac..09eba9103b 100644
--- a/src/gui/painting/qdrawhelper_neon.cpp
+++ b/src/gui/painting/qdrawhelper_neon.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_neon_asm.S b/src/gui/painting/qdrawhelper_neon_asm.S
index 0c0c6a4b1e..d1e6e585c4 100644
--- a/src/gui/painting/qdrawhelper_neon_asm.S
+++ b/src/gui/painting/qdrawhelper_neon_asm.S
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_neon_p.h b/src/gui/painting/qdrawhelper_neon_p.h
index 97ef8ce4e6..6ce1d5e59e 100644
--- a/src/gui/painting/qdrawhelper_neon_p.h
+++ b/src/gui/painting/qdrawhelper_neon_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 3d83ba8587..52f50240a4 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_sse.cpp b/src/gui/painting/qdrawhelper_sse.cpp
index a03ceee02a..4e17c32c17 100644
--- a/src/gui/painting/qdrawhelper_sse.cpp
+++ b/src/gui/painting/qdrawhelper_sse.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp
index 3bbdae00bd..f974b586d0 100644
--- a/src/gui/painting/qdrawhelper_sse2.cpp
+++ b/src/gui/painting/qdrawhelper_sse2.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_sse3dnow.cpp b/src/gui/painting/qdrawhelper_sse3dnow.cpp
index 513ed7d713..42061feac3 100644
--- a/src/gui/painting/qdrawhelper_sse3dnow.cpp
+++ b/src/gui/painting/qdrawhelper_sse3dnow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_sse_p.h b/src/gui/painting/qdrawhelper_sse_p.h
index 3f2419578d..99ef917e71 100644
--- a/src/gui/painting/qdrawhelper_sse_p.h
+++ b/src/gui/painting/qdrawhelper_sse_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp
index ef6e33bc1e..1281d4d526 100644
--- a/src/gui/painting/qdrawhelper_ssse3.cpp
+++ b/src/gui/painting/qdrawhelper_ssse3.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_x86_p.h b/src/gui/painting/qdrawhelper_x86_p.h
index ac671ccc51..20d0f7a36b 100644
--- a/src/gui/painting/qdrawhelper_x86_p.h
+++ b/src/gui/painting/qdrawhelper_x86_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h
index dad8f6cb5d..28b9ceee8a 100644
--- a/src/gui/painting/qdrawingprimitive_sse2_p.h
+++ b/src/gui/painting/qdrawingprimitive_sse2_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp
index 903ab1f605..3e40d25ec8 100644
--- a/src/gui/painting/qemulationpaintengine.cpp
+++ b/src/gui/painting/qemulationpaintengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qemulationpaintengine_p.h b/src/gui/painting/qemulationpaintengine_p.h
index fdc3688876..b49ce2bdaf 100644
--- a/src/gui/painting/qemulationpaintengine_p.h
+++ b/src/gui/painting/qemulationpaintengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qfixed_p.h b/src/gui/painting/qfixed_p.h
index df5a685053..dba52f75b4 100644
--- a/src/gui/painting/qfixed_p.h
+++ b/src/gui/painting/qfixed_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index 5334f97782..50ec22e73a 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1090,37 +1090,6 @@
return 0;
}
-
- static int
- gray_line_to( const QT_FT_Vector* to,
- PWorker worker )
- {
- gray_render_line( worker, UPSCALE( to->x ), UPSCALE( to->y ) );
- return 0;
- }
-
-
- static int
- gray_conic_to( const QT_FT_Vector* control,
- const QT_FT_Vector* to,
- PWorker worker )
- {
- gray_render_conic( worker, control, to );
- return 0;
- }
-
-
- static int
- gray_cubic_to( const QT_FT_Vector* control1,
- const QT_FT_Vector* control2,
- const QT_FT_Vector* to,
- PWorker worker )
- {
- gray_render_cubic( worker, control1, control2, to );
- return 0;
- }
-
-
static void
gray_render_span( int count,
const QT_FT_Span* spans,
@@ -1464,9 +1433,7 @@
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
- error = gray_line_to( &vec, user );
- if ( error )
- goto Exit;
+ gray_render_line(user, UPSCALE(vec.x), UPSCALE(vec.y));
continue;
}
@@ -1491,10 +1458,7 @@
if ( tag == QT_FT_CURVE_TAG_ON )
{
- error = gray_conic_to( &v_control, &vec,
- user );
- if ( error )
- goto Exit;
+ gray_render_conic(user, &v_control, &vec);
continue;
}
@@ -1504,17 +1468,12 @@
v_middle.x = ( v_control.x + vec.x ) / 2;
v_middle.y = ( v_control.y + vec.y ) / 2;
- error = gray_conic_to( &v_control, &v_middle,
- user );
- if ( error )
- goto Exit;
-
+ gray_render_conic(user, &v_control, &v_middle);
v_control = vec;
goto Do_Conic;
}
- error = gray_conic_to( &v_control, &v_start,
- user );
+ gray_render_conic(user, &v_control, &v_start);
goto Close;
}
@@ -1544,25 +1503,20 @@
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
- error = gray_cubic_to( &vec1, &vec2, &vec, user );
- if ( error )
- goto Exit;
+ gray_render_cubic(user, &vec1, &vec2, &vec);
continue;
}
- error = gray_cubic_to( &vec1, &vec2, &v_start, user );
+ gray_render_cubic(user, &vec1, &vec2, &v_start);
goto Close;
}
}
}
/* close the contour with a line segment */
- error = gray_line_to( &v_start, user );
+ gray_render_line(user, UPSCALE(v_start.x), UPSCALE(v_start.y));
Close:
- if ( error )
- goto Exit;
-
first = last + 1;
}
diff --git a/src/gui/painting/qgrayraster_p.h b/src/gui/painting/qgrayraster_p.h
index d5932982db..11470ab279 100644
--- a/src/gui/painting/qgrayraster_p.h
+++ b/src/gui/painting/qgrayraster_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qimagescale.cpp b/src/gui/painting/qimagescale.cpp
index 46e09ddc49..83cd9ad970 100644
--- a/src/gui/painting/qimagescale.cpp
+++ b/src/gui/painting/qimagescale.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qimagescale_p.h b/src/gui/painting/qimagescale_p.h
index 4efe75df60..654602cefe 100644
--- a/src/gui/painting/qimagescale_p.h
+++ b/src/gui/painting/qimagescale_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qmath_p.h b/src/gui/painting/qmath_p.h
index ea46aa7902..21bbeeeaed 100644
--- a/src/gui/painting/qmath_p.h
+++ b/src/gui/painting/qmath_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp
index 41278920cb..cf99e31b90 100644
--- a/src/gui/painting/qmatrix.cpp
+++ b/src/gui/painting/qmatrix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h
index 830a0a734f..e963b90a44 100644
--- a/src/gui/painting/qmatrix.h
+++ b/src/gui/painting/qmatrix.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp
index 857621df6e..478d6470b2 100644
--- a/src/gui/painting/qmemrotate.cpp
+++ b/src/gui/painting/qmemrotate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qmemrotate_p.h b/src/gui/painting/qmemrotate_p.h
index a8c2c6bfbd..d9793b2404 100644
--- a/src/gui/painting/qmemrotate_p.h
+++ b/src/gui/painting/qmemrotate_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp
index 8b607b28b8..da77722491 100644
--- a/src/gui/painting/qoutlinemapper.cpp
+++ b/src/gui/painting/qoutlinemapper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,6 +42,7 @@
#include "qoutlinemapper_p.h"
#include <private/qpainterpath_p.h>
#include "qmath.h"
+#include <private/qbezier_p.h>
#include <stdlib.h>
@@ -74,6 +75,19 @@ static const QRectF boundingRect(const QPointF *points, int pointCount)
return QRectF(QPointF(minx, miny), QPointF(maxx, maxy));
}
+void QOutlineMapper::curveTo(const QPointF &cp1, const QPointF &cp2, const QPointF &ep) {
+#ifdef QT_DEBUG_CONVERT
+ printf("QOutlineMapper::curveTo() (%f, %f)\n", ep.x(), ep.y());
+#endif
+
+ QBezier bezier = QBezier::fromPoints(m_elements.last(), cp1, cp2, ep);
+ bezier.addToPolygon(m_elements, m_curve_threshold);
+ m_element_types.reserve(m_elements.size());
+ for (int i = m_elements.size() - m_element_types.size(); i; --i)
+ m_element_types << QPainterPath::LineToElement;
+ Q_ASSERT(m_elements.size() == m_element_types.size());
+}
+
QT_FT_Outline *QOutlineMapper::convertPath(const QPainterPath &path)
{
@@ -169,51 +183,47 @@ void QOutlineMapper::endOutline()
{
closeSubpath();
- int element_count = m_elements.size();
-
- if (element_count == 0) {
+ if (m_elements.isEmpty()) {
memset(&m_outline, 0, sizeof(m_outline));
return;
}
- QPointF *elements;
+ QPointF *elements = m_elements.data();
// Transform the outline
if (m_txop == QTransform::TxNone) {
- elements = m_elements.data();
- } else {
- if (m_txop == QTransform::TxTranslate) {
- for (int i=0; i<m_elements.size(); ++i) {
- const QPointF &e = m_elements.at(i);
- m_elements_dev << QPointF(e.x() + m_dx, e.y() + m_dy);
- }
- } else if (m_txop == QTransform::TxScale) {
- for (int i=0; i<m_elements.size(); ++i) {
- const QPointF &e = m_elements.at(i);
- m_elements_dev << QPointF(m_m11 * e.x() + m_dx, m_m22 * e.y() + m_dy);
- }
- } else if (m_txop < QTransform::TxProject) {
- for (int i=0; i<m_elements.size(); ++i) {
- const QPointF &e = m_elements.at(i);
- m_elements_dev << QPointF(m_m11 * e.x() + m_m21 * e.y() + m_dx,
- m_m22 * e.y() + m_m12 * e.x() + m_dy);
- }
- } else {
- const QVectorPath vp((qreal *)m_elements.data(), m_elements.size(), m_element_types.size() ? m_element_types.data() : 0);
- 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())
- m_valid = false;
- else
- convertPath(path);
- m_txop = old_txop;
- return;
+ // Nothing to do.
+ } else if (m_txop == QTransform::TxTranslate) {
+ for (int i = 0; i < m_elements.size(); ++i) {
+ QPointF &e = elements[i];
+ e = QPointF(e.x() + m_dx, e.y() + m_dy);
+ }
+ } else if (m_txop == QTransform::TxScale) {
+ for (int i = 0; i < m_elements.size(); ++i) {
+ QPointF &e = elements[i];
+ e = QPointF(m_m11 * e.x() + m_dx, m_m22 * e.y() + m_dy);
}
- elements = m_elements_dev.data();
+ } else if (m_txop < QTransform::TxProject) {
+ for (int i = 0; i < m_elements.size(); ++i) {
+ QPointF &e = elements[i];
+ e = QPointF(m_m11 * e.x() + m_m21 * e.y() + m_dx,
+ m_m22 * e.y() + m_m12 * e.x() + m_dy);
+ }
+ } else {
+ const QVectorPath vp((qreal *)elements, m_elements.size(),
+ m_element_types.size() ? m_element_types.data() : 0);
+ 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())
+ m_valid = false;
+ else
+ convertPath(path);
+ m_txop = old_txop;
+ return;
}
if (m_round_coords) {
@@ -223,7 +233,7 @@ void QOutlineMapper::endOutline()
qFloor(elements[i].y() + aliasedCoordinateDelta));
}
- controlPointRect = boundingRect(elements, element_count);
+ controlPointRect = boundingRect(elements, m_elements.size());
#ifdef QT_DEBUG_CONVERT
printf(" - control point rect (%.2f, %.2f) %.2f x %.2f, clip=(%d,%d, %dx%d)\n",
@@ -242,9 +252,9 @@ void QOutlineMapper::endOutline()
|| controlPointRect.height() > QT_RASTER_COORD_LIMIT));
if (do_clip) {
- clipElements(elements, elementTypes(), element_count);
+ clipElements(elements, elementTypes(), m_elements.size());
} else {
- convertElements(elements, elementTypes(), element_count);
+ convertElements(elements, elementTypes(), m_elements.size());
}
}
diff --git a/src/gui/painting/qoutlinemapper_p.h b/src/gui/painting/qoutlinemapper_p.h
index 388858ca44..ceb70f1a7b 100644
--- a/src/gui/painting/qoutlinemapper_p.h
+++ b/src/gui/painting/qoutlinemapper_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -73,6 +73,8 @@ const int QT_RASTER_COORD_LIMIT = 32767;
//#define QT_DEBUG_CONVERT
+Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale);
+
/********************************************************************************
* class QOutlineMapper
*
@@ -90,11 +92,9 @@ public:
QOutlineMapper() :
m_element_types(0),
m_elements(0),
- m_elements_dev(0),
m_points(0),
m_tags(0),
m_contours(0),
- m_polygon_dev(0),
m_in_clip_elements(false),
m_round_coords(false)
{
@@ -117,6 +117,10 @@ public:
m_dx = m.dx();
m_dy = m.dy();
m_txop = m.type();
+
+ qreal scale;
+ qt_scaleForTransform(m, &scale);
+ m_curve_threshold = scale == 0 ? qreal(0.25) : (qreal(0.25) / scale);
}
void beginOutline(Qt::FillRule fillRule)
@@ -126,7 +130,6 @@ public:
#endif
m_valid = true;
m_elements.reset();
- m_elements_dev.reset();
m_element_types.reset();
m_points.reset();
m_tags.reset();
@@ -161,15 +164,7 @@ public:
m_element_types << QPainterPath::LineToElement;
}
- inline void curveTo(const QPointF &cp1, const QPointF &cp2, const QPointF &ep) {
-#ifdef QT_DEBUG_CONVERT
- printf("QOutlineMapper::curveTo() (%f, %f)\n", ep.x(), ep.y());
-#endif
- m_elements << cp1 << cp2 << ep;
- m_element_types << QPainterPath::CurveToElement
- << QPainterPath::CurveToDataElement
- << QPainterPath::CurveToDataElement;
- }
+ void curveTo(const QPointF &cp1, const QPointF &cp2, const QPointF &ep);
inline void closeSubpath() {
int element_count = m_elements.size();
@@ -209,14 +204,11 @@ public:
public:
QDataBuffer<QPainterPath::ElementType> m_element_types;
QDataBuffer<QPointF> m_elements;
- QDataBuffer<QPointF> m_elements_dev;
QDataBuffer<QT_FT_Vector> m_points;
QDataBuffer<char> m_tags;
QDataBuffer<int> m_contours;
QRect m_clip_rect;
- QDataBuffer<QPointF> m_polygon_dev;
-
QRectF controlPointRect; // only valid after endOutline()
QT_FT_Outline m_outline;
@@ -235,6 +227,8 @@ public:
qreal m_dx;
qreal m_dy;
+ qreal m_curve_threshold;
+
bool m_valid;
bool m_in_clip_elements;
diff --git a/src/gui/painting/qpagedpaintdevice.cpp b/src/gui/painting/qpagedpaintdevice.cpp
index b7b882e93a..038852a842 100644
--- a/src/gui/painting/qpagedpaintdevice.cpp
+++ b/src/gui/painting/qpagedpaintdevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpagedpaintdevice.h b/src/gui/painting/qpagedpaintdevice.h
index 9f06fc923a..f113534956 100644
--- a/src/gui/painting/qpagedpaintdevice.h
+++ b/src/gui/painting/qpagedpaintdevice.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpagedpaintdevice_p.h b/src/gui/painting/qpagedpaintdevice_p.h
index 55f78d54c5..28a2c80b94 100644
--- a/src/gui/painting/qpagedpaintdevice_p.h
+++ b/src/gui/painting/qpagedpaintdevice_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp
index f9e8432a8c..a4edba9299 100644
--- a/src/gui/painting/qpaintbuffer.cpp
+++ b/src/gui/painting/qpaintbuffer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintbuffer_p.h b/src/gui/painting/qpaintbuffer_p.h
index 7cb743e585..536d5c8a61 100644
--- a/src/gui/painting/qpaintbuffer_p.h
+++ b/src/gui/painting/qpaintbuffer_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp
index 857f147231..b094019c84 100644
--- a/src/gui/painting/qpaintdevice.cpp
+++ b/src/gui/painting/qpaintdevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h
index 476f883645..fdceaa1886 100644
--- a/src/gui/painting/qpaintdevice.h
+++ b/src/gui/painting/qpaintdevice.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc
index 8d7e86f424..747047d53a 100644
--- a/src/gui/painting/qpaintdevice.qdoc
+++ b/src/gui/painting/qpaintdevice.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintdevice_qpa.cpp b/src/gui/painting/qpaintdevice_qpa.cpp
index 65eeaaa7e8..eb7408dbff 100644
--- a/src/gui/painting/qpaintdevice_qpa.cpp
+++ b/src/gui/painting/qpaintdevice_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp
index da97116c6f..8364218b6e 100644
--- a/src/gui/painting/qpaintengine.cpp
+++ b/src/gui/painting/qpaintengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h
index 5d5424dfae..ee08ef1fbd 100644
--- a/src/gui/painting/qpaintengine.h
+++ b/src/gui/painting/qpaintengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp
index 1ed6dea161..37c158a3d9 100644
--- a/src/gui/painting/qpaintengine_blitter.cpp
+++ b/src/gui/painting/qpaintengine_blitter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -65,75 +65,69 @@ QT_BEGIN_NAMESPACE
#define STATE_CLIP_COMPLEX 0x00020000
-static inline void updateStateBits(uint *state, uint mask, bool on)
-{
- *state = on ? (*state | mask) : (*state & ~mask);
-}
-
-static inline bool checkStateAgainstMask(uint state, uint mask)
-{
- return !state || (state & mask && !(state & ~mask));
-}
-
class CapabilitiesToStateMask
{
public:
CapabilitiesToStateMask(QBlittable::Capabilities capabilities)
- : m_capabilities(capabilities),
- fillRectMask(0),
- drawRectMask(0),
- drawPixmapMask(0),
- capabillitiesState(0)
+ : m_capabilities(capabilities)
+ , fillRectMask(0)
+ , drawRectMask(0)
+ , drawPixmapMask(0)
+ , capabillitiesState(0)
{
- if (capabilities & QBlittable::SolidRectCapability) {
+ if (capabilities & QBlittable::SolidRectCapability)
setFillRectMask();
- }
- if (capabilities & QBlittable::SourcePixmapCapability) {
+ if (capabilities & QBlittable::SourcePixmapCapability)
setSourcePixmapMask();
- }
- if (capabilities & QBlittable::SourceOverPixmapCapability) {
+ if (capabilities & QBlittable::SourceOverPixmapCapability)
setSourceOverPixmapMask();
- }
- if (capabilities & QBlittable::SourceOverScaledPixmapCapability) {
+ if (capabilities & QBlittable::SourceOverScaledPixmapCapability)
setSourceOverScaledPixmapMask();
- }
}
inline bool canBlitterFillRect() const
{
- return checkStateAgainstMask(capabillitiesState,fillRectMask);
+ return checkStateAgainstMask(capabillitiesState, fillRectMask);
}
inline bool canBlitterDrawRectMask() const
{
- return checkStateAgainstMask(capabillitiesState,drawRectMask);
+ return checkStateAgainstMask(capabillitiesState, drawRectMask);
}
bool canBlitterDrawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) const
{
if (pm.handle()->classId() != QPlatformPixmap::BlitterClass)
return false;
- if (checkStateAgainstMask(capabillitiesState,drawPixmapMask)) {
+ if (checkStateAgainstMask(capabillitiesState, drawPixmapMask)) {
if (m_capabilities & (QBlittable::SourceOverPixmapCapability
| QBlittable::SourceOverScaledPixmapCapability)) {
- if (r.size() != sr.size()) {
+ if (r.size() != sr.size())
return m_capabilities & QBlittable::SourceOverScaledPixmapCapability;
- } else {
+ else
return m_capabilities & QBlittable::SourceOverPixmapCapability;
- }
}
- if ((m_capabilities & QBlittable::SourcePixmapCapability) && r.size() == sr.size() && !pm.hasAlphaChannel()) {
+ if ((m_capabilities & QBlittable::SourcePixmapCapability) && r.size() == sr.size() && !pm.hasAlphaChannel())
return m_capabilities & QBlittable::SourcePixmapCapability;
- }
}
return false;
}
inline void updateState(uint mask, bool on) {
- updateStateBits(&capabillitiesState,mask,on);
+ updateStateBits(&capabillitiesState, mask, on);
}
-public:
+private:
+
+ static inline void updateStateBits(uint *state, uint mask, bool on)
+ {
+ *state = on ? (*state | mask) : (*state & ~mask);
+ }
+
+ static inline bool checkStateAgainstMask(uint state, uint mask)
+ {
+ return !state || (state & mask && !(state & ~mask));
+ }
void setFillRectMask() {
updateStateBits(&fillRectMask, STATE_XFORM_SCALE, false);
@@ -186,148 +180,258 @@ public:
uint capabillitiesState;
};
-class QBlitterPaintEnginePrivate : public QPaintEngineExPrivate
+class QBlitterPaintEnginePrivate : public QRasterPaintEnginePrivate
{
Q_DECLARE_PUBLIC(QBlitterPaintEngine);
public:
QBlitterPaintEnginePrivate(QBlittablePlatformPixmap *p)
- : QPaintEngineExPrivate(),
- pmData(p),
- isBlitterLocked(false),
- hasXForm(false)
+ : QRasterPaintEnginePrivate()
+ , pmData(p)
+ , caps(pmData->blittable()->capabilities())
+ , hasXForm(false)
- {
- raster.reset(new QRasterPaintEngine(p->buffer()));
- capabillities.reset(new CapabilitiesToStateMask(pmData->blittable()->capabilities()));
- }
+ {}
- inline void lock() {
- if (!isBlitterLocked) {
- raster->d_func()->rasterBuffer->prepare(pmData->blittable()->lock());
- isBlitterLocked = true;
- }
- }
+ void lock();
+ void unlock();
+ void fillRect(const QRectF &rect, const QColor &color);
+ void clipAndDrawPixmap(const QRectF &clip, const QRectF &target, const QPixmap &pm, const QRectF &sr);
- inline void unlock() {
- if (isBlitterLocked) {
- pmData->blittable()->unlock();
- isBlitterLocked = false;
- }
- }
- void fillRect(const QRectF &rect, const QColor &color) {
- Q_Q(QBlitterPaintEngine);
- pmData->unmarkRasterOverlay(rect);
- QRectF targetRect = rect;
- if (hasXForm) {
- targetRect = q->state()->matrix.mapRect(rect);
- }
- const QClipData *clipData = q->clip();
- if (clipData) {
- if (clipData->hasRectClip) {
- unlock();
- pmData->blittable()->fillRect(targetRect & clipData->clipRect, color);
- } else if (clipData->hasRegionClip) {
- QVector<QRect> rects = clipData->clipRegion.rects();
- for ( int i = 0; i < rects.size(); i++ ) {
- QRect intersectRect = rects.at(i).intersected(targetRect.toRect());
- if (!intersectRect.isEmpty()) {
- unlock();
- pmData->blittable()->fillRect(intersectRect,color);
- }
+ void updateCompleteState(QPainterState *s);
+ void updatePenState(QPainterState *s);
+ void updateBrushState(QPainterState *s);
+ void updateOpacityState(QPainterState *s);
+ void updateCompositionModeState(QPainterState *s);
+ void updateRenderHintsState(QPainterState *s);
+ void updateTransformState(QPainterState *s);
+ void updateClipState(QPainterState *s);
+
+ QBlittablePlatformPixmap *pmData;
+ CapabilitiesToStateMask caps;
+ uint hasXForm;
+};
+
+
+inline void QBlitterPaintEnginePrivate::lock()
+{
+ if (!pmData->blittable()->isLocked())
+ rasterBuffer->prepare(pmData->buffer());
+}
+
+inline void QBlitterPaintEnginePrivate::unlock()
+{
+ pmData->blittable()->unlock();
+}
+
+// State tracking to make decisions
+void QBlitterPaintEnginePrivate::updateCompleteState(QPainterState *s)
+{
+ updatePenState(s);
+ updateBrushState(s);
+ updateOpacityState(s);
+ updateCompositionModeState(s);
+ updateRenderHintsState(s);
+ updateTransformState(s);
+ updateClipState(s);
+}
+
+void QBlitterPaintEnginePrivate::updatePenState(QPainterState *s)
+{
+ caps.updateState(STATE_PEN_ENABLED, qpen_style(s->pen) != Qt::NoPen);
+}
+
+void QBlitterPaintEnginePrivate::updateBrushState(QPainterState *s)
+{
+ Qt::BrushStyle style = qbrush_style(s->brush);
+
+ caps.updateState(STATE_BRUSH_PATTERN, style > Qt::SolidPattern);
+ caps.updateState(STATE_BRUSH_ALPHA,
+ qbrush_color(s->brush).alpha() < 255);
+}
+
+void QBlitterPaintEnginePrivate::updateOpacityState(QPainterState *s)
+{
+ bool translucent = s->opacity < 1;
+ caps.updateState(STATE_ALPHA, translucent);
+}
+
+void QBlitterPaintEnginePrivate::updateCompositionModeState(QPainterState *s)
+{
+ bool nonTrivial = s->composition_mode != QPainter::CompositionMode_SourceOver
+ && s->composition_mode != QPainter::CompositionMode_Source;
+
+ caps.updateState(STATE_BLENDING_COMPLEX, nonTrivial);
+}
+
+void QBlitterPaintEnginePrivate::updateRenderHintsState(QPainterState *s)
+{
+ bool aa = s->renderHints & QPainter::Antialiasing;
+ caps.updateState(STATE_ANTIALIASING, aa);
+}
+
+void QBlitterPaintEnginePrivate::updateTransformState(QPainterState *s)
+{
+ QTransform::TransformationType type = s->matrix.type();
+
+ caps.updateState(STATE_XFORM_COMPLEX, type > QTransform::TxScale);
+ caps.updateState(STATE_XFORM_SCALE, type > QTransform::TxTranslate);
+
+ hasXForm = type >= QTransform::TxTranslate;
+}
+
+void QBlitterPaintEnginePrivate::updateClipState(QPainterState *)
+{
+ const QClipData *clipData = clip();
+ bool complexClip = clipData && !(clipData->hasRectClip || clipData->hasRegionClip);
+ caps.updateState(STATE_CLIP_COMPLEX, complexClip);
+}
+
+void QBlitterPaintEnginePrivate::fillRect(const QRectF &rect, const QColor &color)
+{
+ Q_Q(QBlitterPaintEngine);
+ pmData->unmarkRasterOverlay(rect);
+ QRectF targetRect = rect;
+ if (hasXForm)
+ targetRect = q->state()->matrix.mapRect(rect);
+ const QClipData *clipData = clip();
+ if (clipData) {
+ if (clipData->hasRectClip) {
+ unlock();
+ pmData->blittable()->fillRect(targetRect & clipData->clipRect, color);
+ } else if (clipData->hasRegionClip) {
+ QVector<QRect> rects = clipData->clipRegion.rects();
+ for (int i = 0; i < rects.size(); ++i) {
+ QRect intersectRect = rects.at(i).intersected(targetRect.toRect());
+ if (!intersectRect.isEmpty()) {
+ unlock();
+ pmData->blittable()->fillRect(intersectRect, color);
}
}
+ }
+ } else {
+ if (targetRect.x() >= 0 && targetRect.y() >= 0
+ && targetRect.width() <= q->paintDevice()->width()
+ && targetRect.height() <= q->paintDevice()->height()) {
+ unlock();
+ pmData->blittable()->fillRect(targetRect, color);
} else {
- if (targetRect.x() >= 0 && targetRect.y() >= 0
- && targetRect.width() <= raster->paintDevice()->width()
- && targetRect.height() <= raster->paintDevice()->height()) {
- unlock();
- pmData->blittable()->fillRect(targetRect,color);
- } else {
- QRectF deviceRect(0,0,raster->paintDevice()->width(), raster->paintDevice()->height());
- unlock();
- pmData->blittable()->fillRect(deviceRect&targetRect,color);
- }
+ QRectF deviceRect(0, 0, q->paintDevice()->width(), q->paintDevice()->height());
+ unlock();
+ pmData->blittable()->fillRect(deviceRect & targetRect, color);
}
}
+}
- void clipAndDrawPixmap(const QRectF &clip, const QRectF &target, const QPixmap &pm, const QRectF &sr) {
- QRectF intersectedRect = clip.intersected(target);
- if (intersectedRect.isEmpty())
- return;
- QRectF source = sr;
- if(intersectedRect.size() != target.size()) {
- qreal deltaTop = target.top() - intersectedRect.top();
- qreal deltaLeft = target.left() - intersectedRect.left();
- qreal deltaBottom = target.bottom() - intersectedRect.bottom();
- qreal deltaRight = target.right() - intersectedRect.right();
- source.adjust(-deltaLeft,-deltaTop,-deltaRight,-deltaBottom);
- }
- pmData->unmarkRasterOverlay(intersectedRect);
- pmData->blittable()->drawPixmap(intersectedRect, pm, source);
+void QBlitterPaintEnginePrivate::clipAndDrawPixmap(const QRectF &clip,
+ const QRectF &target,
+ const QPixmap &pm,
+ const QRectF &sr)
+{
+ QRectF intersectedRect = clip.intersected(target);
+ if (intersectedRect.isEmpty())
+ return;
+ QRectF source = sr;
+ if (intersectedRect.size() != target.size()) {
+ qreal deltaTop = target.top() - intersectedRect.top();
+ qreal deltaLeft = target.left() - intersectedRect.left();
+ qreal deltaBottom = target.bottom() - intersectedRect.bottom();
+ qreal deltaRight = target.right() - intersectedRect.right();
+ source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom);
}
+ pmData->unmarkRasterOverlay(intersectedRect);
+ pmData->blittable()->drawPixmap(intersectedRect, pm, source);
+}
- void updateClip() {
- Q_Q(QBlitterPaintEngine);
- const QClipData *clip = q->clip();
- bool complex = clip && !(clip->hasRectClip || clip->hasRegionClip);
- capabillities->updateState(STATE_CLIP_COMPLEX, complex);
- }
+QBlitterPaintEngine::QBlitterPaintEngine(QBlittablePlatformPixmap *p)
+ : QRasterPaintEngine(*(new QBlitterPaintEnginePrivate(p)), p->buffer())
+{}
- void systemStateChanged() {
- raster->d_func()->systemStateChanged();
- }
+// State tracking
+void QBlitterPaintEngine::penChanged()
+{
+ Q_D(QBlitterPaintEngine);
- QScopedPointer<QRasterPaintEngine> raster;
+ QRasterPaintEngine::penChanged();
+ d->updatePenState(state());
+}
- QBlittablePlatformPixmap *pmData;
- bool isBlitterLocked;
+void QBlitterPaintEngine::brushChanged()
+{
+ Q_D(QBlitterPaintEngine);
- QScopedPointer<CapabilitiesToStateMask> capabillities;
+ QRasterPaintEngine::brushChanged();
+ d->updateBrushState(state());
+}
- uint hasXForm;
-};
+void QBlitterPaintEngine::opacityChanged()
+{
+ Q_D(QBlitterPaintEngine);
-QBlitterPaintEngine::QBlitterPaintEngine(QBlittablePlatformPixmap *p)
- : QPaintEngineEx(*(new QBlitterPaintEnginePrivate(p)))
+ QRasterPaintEngine::opacityChanged();
+ d->updateOpacityState(state());
+}
+
+void QBlitterPaintEngine::compositionModeChanged()
{
+ Q_D(QBlitterPaintEngine);
+
+ QRasterPaintEngine::compositionModeChanged();
+ d->updateCompositionModeState(state());
}
-QBlitterPaintEngine::~QBlitterPaintEngine()
+void QBlitterPaintEngine::renderHintsChanged()
{
+ Q_D(QBlitterPaintEngine);
+
+ QRasterPaintEngine::renderHintsChanged();
+ d->updateRenderHintsState(state());
}
-QPainterState *QBlitterPaintEngine::createState(QPainterState *orig) const
+void QBlitterPaintEngine::transformChanged()
{
- Q_D(const QBlitterPaintEngine);
- return d->raster->createState(orig);
+ Q_D(QBlitterPaintEngine);
+
+ QRasterPaintEngine::transformChanged();
+ d->updateTransformState(state());
}
-bool QBlitterPaintEngine::begin(QPaintDevice *pdev)
+void QBlitterPaintEngine::clipEnabledChanged()
{
Q_D(QBlitterPaintEngine);
+ QRasterPaintEngine::clipEnabledChanged();
+ d->updateClipState(state());
+}
- setActive(true);
- bool ok = d->raster->begin(pdev);
+bool QBlitterPaintEngine::begin(QPaintDevice *pdev)
+{
+ bool ok = QRasterPaintEngine::begin(pdev);
#ifdef QT_BLITTER_RASTEROVERLAY
+ Q_D(QBlitterPaintEngine);
d->pmData->unmergeOverlay();
#endif
return ok;
}
-
bool QBlitterPaintEngine::end()
{
- Q_D(QBlitterPaintEngine);
-
- setActive(false);
#ifdef QT_BLITTER_RASTEROVERLAY
+ Q_D(QBlitterPaintEngine);
d->pmData->mergeOverlay();
#endif
- return d->raster->end();
+
+ return QRasterPaintEngine::end();
}
+void QBlitterPaintEngine::setState(QPainterState *s)
+{
+ Q_D(QBlitterPaintEngine);
+
+ QRasterPaintEngine::setState(s);
+ d->updateCompleteState(s);
+}
+// Accelerated paths
void QBlitterPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
{
Q_D(QBlitterPaintEngine);
@@ -337,37 +441,35 @@ void QBlitterPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
} else {
d->lock();
d->pmData->markRasterOverlay(path);
- d->raster->fill(path, brush);
+ QRasterPaintEngine::fill(path, brush);
}
}
void QBlitterPaintEngine::fillRect(const QRectF &rect, const QColor &color)
{
Q_D(QBlitterPaintEngine);
- if (d->capabillities->canBlitterFillRect() && color.alpha() == 0xff) {
+ if (d->caps.canBlitterFillRect() && color.alpha() == 0xff) {
d->fillRect(rect, color);
} else {
d->lock();
d->pmData->markRasterOverlay(rect);
- d->raster->fillRect(rect, color);
+ QRasterPaintEngine::fillRect(rect, color);
}
}
void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
{
- if(rect.size().isEmpty())
+ if (rect.size().isEmpty())
return;
Q_D(QBlitterPaintEngine);
if (qbrush_style(brush) == Qt::SolidPattern
&& qbrush_color(brush).alpha() == 0xff
- && d->capabillities->canBlitterFillRect())
- {
+ && d->caps.canBlitterFillRect()) {
d->fillRect(rect, qbrush_color(brush));
- }else if (brush.style() == Qt::TexturePattern
- && d->capabillities->canBlitterDrawPixmap(rect,brush.texture(),rect))
- {
+ } else if (brush.style() == Qt::TexturePattern
+ && d->caps.canBlitterDrawPixmap(rect, brush.texture(), rect)) {
bool rectIsFilled = false;
QRectF transformedRect = state()->matrix.mapRect(rect);
qreal x = transformedRect.x();
@@ -388,37 +490,37 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
blitWidth = transformedRect.right() -x;
if (y + blitHeight > transformedRect.bottom())
blitHeight = transformedRect.bottom() - y;
- const QClipData *clipData = clip();
+ const QClipData *clipData = d->clip();
if (clipData->hasRectClip) {
- QRect targetRect = QRect(x,y,blitWidth,blitHeight).intersected(clipData->clipRect);
+ QRect targetRect = QRect(x, y, blitWidth, blitHeight).intersected(clipData->clipRect);
if (targetRect.isValid()) {
int tmpSrcX = srcX + (targetRect.x() - x);
int tmpSrcY = srcY + (targetRect.y() - y);
- QRect srcRect(tmpSrcX,tmpSrcY,targetRect.width(),targetRect.height());
- d->pmData->blittable()->drawPixmap(targetRect,pm,srcRect);
+ QRect srcRect(tmpSrcX, tmpSrcY, targetRect.width(), targetRect.height());
+ d->pmData->blittable()->drawPixmap(targetRect, pm, srcRect);
}
} else if (clipData->hasRegionClip) {
QVector<QRect> clipRects = clipData->clipRegion.rects();
- QRect unclippedTargetRect(x,y,blitWidth,blitHeight);
+ QRect unclippedTargetRect(x, y, blitWidth, blitHeight);
QRegion intersectedRects = clipData->clipRegion.intersected(unclippedTargetRect);
- for ( int i = 0; i < intersectedRects.rects().size(); i++ ) {
+ for (int i = 0; i < intersectedRects.rects().size(); ++i) {
QRect targetRect = intersectedRects.rects().at(i);
if (!targetRect.isValid() || targetRect.isEmpty())
continue;
int tmpSrcX = srcX + (targetRect.x() - x);
int tmpSrcY = srcY + (targetRect.y() - y);
- QRect srcRect(tmpSrcX,tmpSrcY,targetRect.width(),targetRect.height());
- d->pmData->blittable()->drawPixmap(targetRect,pm,srcRect);
+ QRect srcRect(tmpSrcX, tmpSrcY, targetRect.width(), targetRect.height());
+ d->pmData->blittable()->drawPixmap(targetRect, pm, srcRect);
}
}
x+=blitWidth;
- if (x>=transformedRect.right()) {
+ if (x >= transformedRect.right()) {
x = transformedRect.x();
srcX = startX;
srcY = 0;
- y+=blitHeight;
- if (y>=transformedRect.bottom())
+ y += blitHeight;
+ if (y >= transformedRect.bottom())
rectIsFilled = true;
} else
srcX = 0;
@@ -426,235 +528,174 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
} else {
d->lock();
d->pmData->markRasterOverlay(rect);
- d->raster->fillRect(rect, brush);
+ QRasterPaintEngine::fillRect(rect, brush);
}
}
-void QBlitterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
-{
- Q_D(QBlitterPaintEngine);
- d->lock();
- d->pmData->markRasterOverlay(path);
- d->raster->stroke(path, pen);
-}
-
-void QBlitterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
-{
- Q_D(QBlitterPaintEngine);
- d->lock();
- d->raster->clip(path, op);
- d->updateClip();
-}
-void QBlitterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op){
- Q_D(QBlitterPaintEngine);
- d->lock();
- d->raster->clip(rect,op);
- d->updateClip();
-}
-void QBlitterPaintEngine::clip(const QRegion &region, Qt::ClipOperation op)
+void QBlitterPaintEngine::drawRects(const QRect *rects, int rectCount)
{
Q_D(QBlitterPaintEngine);
- d->lock();
- d->raster->clip(region,op);
- d->updateClip();
+ if (d->caps.canBlitterDrawRectMask()) {
+ for (int i=0; i<rectCount; ++i)
+ d->fillRect(rects[i], qbrush_color(state()->brush));
+ } else {
+ d->pmData->markRasterOverlay(rects, rectCount);
+ QRasterPaintEngine::drawRects(rects, rectCount);
+ }
}
-void QBlitterPaintEngine::clipEnabledChanged()
+void QBlitterPaintEngine::drawRects(const QRectF *rects, int rectCount)
{
Q_D(QBlitterPaintEngine);
- d->lock();
- d->raster->clipEnabledChanged();
+ if (d->caps.canBlitterDrawRectMask()) {
+ for (int i = 0; i < rectCount; ++i)
+ d->fillRect(rects[i], qbrush_color(state()->brush));
+ } else {
+ d->pmData->markRasterOverlay(rects, rectCount);
+ QRasterPaintEngine::drawRects(rects, rectCount);
+ }
}
-void QBlitterPaintEngine::penChanged()
+void QBlitterPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pm)
{
- Q_D(QBlitterPaintEngine);
- d->lock();
- d->raster->penChanged();
- d->capabillities->updateState(STATE_PEN_ENABLED,qpen_style(state()->pen) != Qt::NoPen);
+ drawPixmap(QRectF(pos, pm.size()), pm, pm.rect());
}
-void QBlitterPaintEngine::brushChanged()
+void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
{
Q_D(QBlitterPaintEngine);
- d->raster->brushChanged();
-
- bool solid = qbrush_style(state()->brush) == Qt::SolidPattern;
-
- d->capabillities->updateState(STATE_BRUSH_PATTERN, !solid);
- d->capabillities->updateState(STATE_BRUSH_ALPHA,
- qbrush_color(state()->brush).alpha() < 255);
-}
+ if (d->caps.canBlitterDrawPixmap(r, pm, sr)) {
-void QBlitterPaintEngine::brushOriginChanged()
-{
- Q_D(QBlitterPaintEngine);
- d->raster->brushOriginChanged();
+ d->unlock();
+ QRectF targetRect = r;
+ if (d->hasXForm)
+ targetRect = state()->matrix.mapRect(r);
+ const QClipData *clipData = d->clip();
+ if (clipData) {
+ if (clipData->hasRectClip) {
+ d->clipAndDrawPixmap(clipData->clipRect, targetRect, pm, sr);
+ } else if (clipData->hasRegionClip) {
+ QVector<QRect>rects = clipData->clipRegion.rects();
+ for (int i = 0; i<rects.size(); ++i)
+ d->clipAndDrawPixmap(rects.at(i), targetRect, pm, sr);
+ }
+ } else {
+ QRectF deviceRect(0, 0, paintDevice()->width(), paintDevice()->height());
+ d->clipAndDrawPixmap(deviceRect, targetRect, pm, sr);
+ }
+ }else {
+ d->lock();
+ d->pmData->markRasterOverlay(r);
+ QRasterPaintEngine::drawPixmap(r, pm, sr);
+ }
}
-void QBlitterPaintEngine::opacityChanged()
+// Overriden methods to lock the graphics memory
+void QBlitterPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
{
Q_D(QBlitterPaintEngine);
- d->raster->opacityChanged();
-
- bool translucent = state()->opacity < 1;
- d->capabillities->updateState(STATE_ALPHA,translucent);
+ d->lock();
+ d->pmData->markRasterOverlay(points, pointCount);
+ QRasterPaintEngine::drawPolygon(points, pointCount, mode);
}
-void QBlitterPaintEngine::compositionModeChanged()
+void QBlitterPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode)
{
Q_D(QBlitterPaintEngine);
- d->raster->compositionModeChanged();
-
- bool nonTrivial = state()->composition_mode != QPainter::CompositionMode_SourceOver
- && state()->composition_mode != QPainter::CompositionMode_Source;
-
- d->capabillities->updateState(STATE_BLENDING_COMPLEX,nonTrivial);
+ d->lock();
+ d->pmData->markRasterOverlay(points, pointCount);
+ QRasterPaintEngine::drawPolygon(points, pointCount, mode);
}
-void QBlitterPaintEngine::renderHintsChanged()
+void QBlitterPaintEngine::fillPath(const QPainterPath &path, QSpanData *fillData)
{
Q_D(QBlitterPaintEngine);
- d->raster->renderHintsChanged();
-
- bool aa = state()->renderHints & QPainter::Antialiasing;
- d->capabillities->updateState(STATE_ANTIALIASING, aa);
-
+ d->lock();
+ d->pmData->markRasterOverlay(path);
+ QRasterPaintEngine::fillPath(path, fillData);
}
-void QBlitterPaintEngine::transformChanged()
+void QBlitterPaintEngine::fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
{
Q_D(QBlitterPaintEngine);
- d->raster->transformChanged();
-
- QTransform::TransformationType type = state()->matrix.type();
-
- d->capabillities->updateState(STATE_XFORM_COMPLEX, type > QTransform::TxScale);
- d->capabillities->updateState(STATE_XFORM_SCALE, type > QTransform::TxTranslate);
-
- d->hasXForm = type >= QTransform::TxTranslate;
-
+ d->lock();
+ d->pmData->markRasterOverlay(points, pointCount);
+ QRasterPaintEngine::fillPolygon(points, pointCount, mode);
}
-void QBlitterPaintEngine::drawRects(const QRect *rects, int rectCount)
+void QBlitterPaintEngine::drawEllipse(const QRectF &r)
{
Q_D(QBlitterPaintEngine);
- if (d->capabillities->canBlitterDrawRectMask()) {
- for (int i=0; i<rectCount; ++i) {
- d->fillRect(rects[i], qbrush_color(state()->brush));
- }
- } else {
- d->pmData->markRasterOverlay(rects,rectCount);
- QPaintEngineEx::drawRects(rects, rectCount);
- }
+ d->lock();
+ d->pmData->markRasterOverlay(r);
+ QRasterPaintEngine::drawEllipse(r);
}
-void QBlitterPaintEngine::drawRects(const QRectF *rects, int rectCount)
+void QBlitterPaintEngine::drawImage(const QPointF &pos, const QImage &image)
{
- Q_D(QBlitterPaintEngine);
- if (d->capabillities->canBlitterDrawRectMask()) {
- for (int i=0; i<rectCount; ++i) {
- d->fillRect(rects[i], qbrush_color(state()->brush));
- }
- } else {
- d->pmData->markRasterOverlay(rects,rectCount);
- QPaintEngineEx::drawRects(rects, rectCount);
- }
+ drawImage(QRectF(pos, image.size()), image, image.rect());
}
-void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
+void QBlitterPaintEngine::drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
+ Qt::ImageConversionFlags flags)
{
Q_D(QBlitterPaintEngine);
- if (d->capabillities->canBlitterDrawPixmap(r,pm,sr)) {
-
- d->unlock();
- QRectF targetRect = r;
- if (d->hasXForm) {
- targetRect = state()->matrix.mapRect(r);
- }
- const QClipData *clipData = clip();
- if (clipData) {
- if (clipData->hasRectClip) {
- d->clipAndDrawPixmap(clipData->clipRect,targetRect,pm,sr);
- }else if (clipData->hasRegionClip) {
- QVector<QRect>rects = clipData->clipRegion.rects();
- for (int i = 0; i<rects.size(); i++) {
- d->clipAndDrawPixmap(rects.at(i),targetRect,pm,sr);
- }
- }
- } else {
- QRectF deviceRect(0,0,d->raster->paintDevice()->width(), d->raster->paintDevice()->height());
- d->clipAndDrawPixmap(deviceRect,targetRect,pm,sr);
- }
- }else {
- d->lock();
- d->pmData->markRasterOverlay(r);
- d->raster->drawPixmap(r, pm, sr);
- }
+ d->lock();
+ d->pmData->markRasterOverlay(r);
+ QRasterPaintEngine::drawImage(r, pm, sr, flags);
}
-void QBlitterPaintEngine::drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
- Qt::ImageConversionFlags flags)
+void QBlitterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr)
{
Q_D(QBlitterPaintEngine);
d->lock();
d->pmData->markRasterOverlay(r);
- d->raster->drawImage(r, pm, sr, flags);
+ QRasterPaintEngine::drawTiledPixmap(r, pm, sr);
}
-
void QBlitterPaintEngine::drawTextItem(const QPointF &pos, const QTextItem &ti)
{
Q_D(QBlitterPaintEngine);
d->lock();
- d->raster->drawTextItem(pos, ti);
- d->pmData->markRasterOverlay(pos,ti);
+ d->pmData->markRasterOverlay(pos, ti);
+ QRasterPaintEngine::drawTextItem(pos, ti);
}
-void QBlitterPaintEngine::drawStaticTextItem(QStaticTextItem *sti)
+void QBlitterPaintEngine::drawPoints(const QPointF *points, int pointCount)
{
Q_D(QBlitterPaintEngine);
d->lock();
- d->raster->drawStaticTextItem(sti);
-
-//#### d->pmData->markRasterOverlay(sti);
- qWarning("not implemented: markRasterOverlay for QStaticTextItem");
-
+ d->pmData->markRasterOverlay(points, pointCount);
+ QRasterPaintEngine::drawPoints(points, pointCount);
}
-
-void QBlitterPaintEngine::drawEllipse(const QRectF &r)
+void QBlitterPaintEngine::drawPoints(const QPoint *points, int pointCount)
{
Q_D(QBlitterPaintEngine);
d->lock();
- d->pmData->markRasterOverlay(r);
- d->raster->drawEllipse(r);
+ d->pmData->markRasterOverlay(points, pointCount);
+ QRasterPaintEngine::drawPoints(points, pointCount);
}
-void QBlitterPaintEngine::setState(QPainterState *s)
+void QBlitterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
{
Q_D(QBlitterPaintEngine);
d->lock();
- QPaintEngineEx::setState(s);
- d->raster->setState(s);
-
- clipEnabledChanged();
- penChanged();
- brushChanged();
- brushOriginChanged();
- opacityChanged();
- compositionModeChanged();
- renderHintsChanged();
- transformChanged();
-
- d->updateClip();
+ d->pmData->markRasterOverlay(path);
+ QRasterPaintEngine::stroke(path, pen);
}
-inline QRasterPaintEngine *QBlitterPaintEngine::raster() const
+void QBlitterPaintEngine::drawStaticTextItem(QStaticTextItem *sti)
{
- Q_D(const QBlitterPaintEngine);
- return d->raster.data();
+ Q_D(QBlitterPaintEngine);
+ d->lock();
+ QRasterPaintEngine::drawStaticTextItem(sti);
+
+#ifdef QT_BLITTER_RASTEROVERLAY
+//#### d->pmData->markRasterOverlay(sti);
+ qWarning("not implemented: markRasterOverlay for QStaticTextItem");
+#endif
}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h
index 1acc647fbe..dba0bad9ef 100644
--- a/src/gui/painting/qpaintengine_blitter_p.h
+++ b/src/gui/painting/qpaintengine_blitter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,7 +42,6 @@
#ifndef QPAINTENGINE_BLITTER_P_H
#define QPAINTENGINE_BLITTER_P_H
-#include "private/qpaintengineex_p.h"
#include "private/qpaintengine_raster_p.h"
#ifndef QT_NO_BLITTABLE
@@ -52,59 +51,51 @@ class QBlitterPaintEnginePrivate;
class QBlittablePlatformPixmap;
class QBlittable;
-class Q_GUI_EXPORT QBlitterPaintEngine : public QPaintEngineEx
+class Q_GUI_EXPORT QBlitterPaintEngine : public QRasterPaintEngine
{
Q_DECLARE_PRIVATE(QBlitterPaintEngine);
public:
QBlitterPaintEngine(QBlittablePlatformPixmap *p);
- ~QBlitterPaintEngine();
-
- virtual QPainterState *createState(QPainterState *orig) const;
virtual QPaintEngine::Type type() const { return Blitter; }
virtual bool begin(QPaintDevice *pdev);
virtual bool end();
+ // Call down into QBlittable
virtual void fill(const QVectorPath &path, const QBrush &brush);
- virtual void stroke(const QVectorPath &path, const QPen &pen);
-
- virtual void clip(const QVectorPath &path, Qt::ClipOperation op);
- virtual void clip(const QRect &rect, Qt::ClipOperation op);
- virtual void clip(const QRegion &region, Qt::ClipOperation op);
+ virtual void fillRect(const QRectF &rect, const QBrush &brush);
+ virtual void fillRect(const QRectF &rect, const QColor &color);
+ virtual void drawRects(const QRect *rects, int rectCount);
+ virtual void drawRects(const QRectF *rects, int rectCount);
+ void drawPixmap(const QPointF &p, const QPixmap &pm);
+ void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
+ // State tracking
+ void setState(QPainterState *s);
virtual void clipEnabledChanged();
virtual void penChanged();
virtual void brushChanged();
- virtual void brushOriginChanged();
virtual void opacityChanged();
virtual void compositionModeChanged();
virtual void renderHintsChanged();
virtual void transformChanged();
- virtual void fillRect(const QRectF &rect, const QBrush &brush);
- virtual void fillRect(const QRectF &rect, const QColor &color);
-
- virtual void drawRects(const QRect *rects, int rectCount);
- virtual void drawRects(const QRectF *rects, int rectCount);
-
- virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
-
- virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags);
-
- virtual void drawTextItem(const QPointF &pos, const QTextItem &ti);
- virtual void drawStaticTextItem(QStaticTextItem *);
-
- virtual void drawEllipse(const QRectF &r);
-
- virtual void setState(QPainterState *s);
-
- inline QPainterState *state() { return raster()->state(); }
- inline const QPainterState *state() const { const QPainterState *state = raster()->state(); return state;}
- inline const QClipData *clip(){return raster()->d_func()->clip();}
-
-private:
- QRasterPaintEngine *raster() const;
+ // Override to lock the QBlittable before using raster
+ void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
+ void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode);
+ void fillPath(const QPainterPath &path, QSpanData *fillData);
+ void fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
+ void drawEllipse(const QRectF &rect);
+ void drawImage(const QPointF &p, const QImage &img);
+ void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
+ Qt::ImageConversionFlags flags = Qt::AutoColor);
+ void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr);
+ void drawTextItem(const QPointF &p, const QTextItem &textItem);
+ void drawPoints(const QPointF *points, int pointCount);
+ void drawPoints(const QPoint *points, int pointCount);
+ void stroke(const QVectorPath &path, const QPen &pen);
+ void drawStaticTextItem(QStaticTextItem *);
};
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengine_p.h b/src/gui/painting/qpaintengine_p.h
index 5d540bd11b..57075fed90 100644
--- a/src/gui/painting/qpaintengine_p.h
+++ b/src/gui/painting/qpaintengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index d5449a7eb5..5100393c69 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -733,7 +733,7 @@ void QRasterPaintEngine::updatePen(const QPen &pen)
s->stroker = 0;
}
- ensureState(); // needed because of tx_noshear...
+ ensureRasterState(); // needed because of tx_noshear...
s->flags.fast_pen = pen_style > Qt::NoPen
&& s->penData.blend
&& ((pen.isCosmetic() && penWidth <= 1)
@@ -801,7 +801,7 @@ void QRasterPaintEngine::updateOutlineMapper()
d->outlineMapper->setMatrix(state()->matrix);
}
-void QRasterPaintEngine::updateState()
+void QRasterPaintEngine::updateRasterState()
{
QRasterPaintEngineState *s = state();
@@ -1434,7 +1434,7 @@ void QRasterPaintEngine::drawRects(const QRect *rects, int rectCount)
qDebug(" - QRasterPaintEngine::drawRect(), rectCount=%d", rectCount);
#endif
Q_D(QRasterPaintEngine);
- ensureState();
+ ensureRasterState();
QRasterPaintEngineState *s = state();
// Fill
@@ -1489,7 +1489,7 @@ void QRasterPaintEngine::drawRects(const QRectF *rects, int rectCount)
#endif
#ifdef QT_FAST_SPANS
Q_D(QRasterPaintEngine);
- ensureState();
+ ensureRasterState();
QRasterPaintEngineState *s = state();
@@ -1645,7 +1645,7 @@ void QRasterPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
fillRect_normalized(toNormalizedFillRect(QRectF(tl, br)), &s->brushData, d);
return;
}
- ensureState();
+ ensureRasterState();
if (s->flags.tx_noshear) {
d->initializeRasterizer(&s->brushData);
// ### Is normalizing really necessary here?
@@ -1702,7 +1702,7 @@ void QRasterPaintEngine::fillRect(const QRectF &r, QSpanData *data)
return;
}
}
- ensureState();
+ ensureRasterState();
if (s->flags.tx_noshear) {
d->initializeRasterizer(data);
QRectF nr = r.normalized();
@@ -2330,7 +2330,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
}
#ifdef QT_FAST_SPANS
- ensureState();
+ ensureRasterState();
if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) {
d->initializeRasterizer(&d->image_filler_xform);
d->rasterizer->setAntialiased(s->flags.antialiased);
@@ -2425,7 +2425,7 @@ void QRasterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap,
d->image_filler_xform.setupMatrix(copy, s->flags.bilinear);
#ifdef QT_FAST_SPANS
- ensureState();
+ ensureRasterState();
if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) {
d->initializeRasterizer(&d->image_filler_xform);
d->rasterizer->setAntialiased(s->flags.antialiased);
@@ -2878,18 +2878,68 @@ QRasterPaintEnginePrivate::getPenFunc(const QRectF &rect,
return isUnclipped(rect, penWidth) ? data->unclipped_blend : data->blend;
}
+static QPair<int, int> visibleGlyphRange(const QRectF &clip, QFontEngine *fontEngine,
+ glyph_t *glyphs, QFixedPoint *positions, int numGlyphs)
+{
+ QFixed clipLeft = QFixed::fromReal(clip.left());
+ QFixed clipRight = QFixed::fromReal(clip.right());
+ QFixed clipTop = QFixed::fromReal(clip.top());
+ QFixed clipBottom = QFixed::fromReal(clip.bottom());
+
+ int first = 0;
+ while (first < numGlyphs) {
+ glyph_metrics_t metrics = fontEngine->boundingBox(glyphs[first]);
+ QFixed left = metrics.x + positions[first].x;
+ QFixed top = metrics.y + positions[first].y;
+ QFixed right = left + metrics.width;
+ QFixed bottom = top + metrics.height;
+ if (left < clipRight && right > clipLeft && top < clipBottom && bottom > clipTop)
+ break;
+ ++first;
+ }
+ int last = numGlyphs - 1;
+ while (last > first) {
+ glyph_metrics_t metrics = fontEngine->boundingBox(glyphs[last]);
+ QFixed left = metrics.x + positions[last].x;
+ QFixed top = metrics.y + positions[last].y;
+ QFixed right = left + metrics.width;
+ QFixed bottom = top + metrics.height;
+ if (left < clipRight && right > clipLeft && top < clipBottom && bottom > clipTop)
+ break;
+ --last;
+ }
+ return QPair<int, int>(first, last + 1);
+}
+
/*!
\reimp
*/
void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
{
+ if (textItem->numGlyphs == 0)
+ return;
+
ensurePen();
- ensureState();
+ ensureRasterState();
QFontEngine *fontEngine = textItem->fontEngine();
if (shouldDrawCachedGlyphs(fontEngine->fontDef.pixelSize, state()->matrix)) {
drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions,
fontEngine);
+ } else if (state()->matrix.type() < QTransform::TxProject) {
+ bool invertible;
+ QTransform invMat = state()->matrix.inverted(&invertible);
+ if (!invertible)
+ return;
+
+ QPair<int, int> range = visibleGlyphRange(invMat.mapRect(clipBoundingRect()),
+ textItem->fontEngine(), textItem->glyphs,
+ textItem->glyphPositions, textItem->numGlyphs);
+ QStaticTextItem copy = *textItem;
+ copy.glyphs += range.first;
+ copy.glyphPositions += range.first;
+ copy.numGlyphs = range.second - range.first;
+ QPaintEngineEx::drawStaticTextItem(&copy);
} else {
QPaintEngineEx::drawStaticTextItem(textItem);
}
@@ -2901,7 +2951,6 @@ void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
{
const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
- QRasterPaintEngineState *s = state();
#ifdef QT_DEBUG_DRAW
Q_D(QRasterPaintEngine);
@@ -2910,25 +2959,51 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
d->glyphCacheType);
#endif
+ if (ti.glyphs.numGlyphs == 0)
+ return;
ensurePen();
- ensureState();
+ ensureRasterState();
+ QRasterPaintEngineState *s = state();
+ QTransform matrix = s->matrix;
if (!supportsTransformations(ti.fontEngine)) {
QVarLengthArray<QFixedPoint> positions;
QVarLengthArray<glyph_t> glyphs;
- QTransform matrix = s->matrix;
matrix.translate(p.x(), p.y());
-
ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
drawCachedGlyphs(glyphs.size(), glyphs.constData(), positions.constData(), ti.fontEngine);
- return;
- }
+ } else if (matrix.type() < QTransform::TxProject) {
+ bool invertible;
+ QTransform invMat = matrix.inverted(&invertible);
+ if (!invertible)
+ return;
+ QVarLengthArray<QFixedPoint> positions;
+ QVarLengthArray<glyph_t> glyphs;
- QPaintEngineEx::drawTextItem(p, ti);
+ ti.fontEngine->getGlyphPositions(ti.glyphs, QTransform::fromTranslate(p.x(), p.y()),
+ ti.flags, glyphs, positions);
+ QPair<int, int> range = visibleGlyphRange(invMat.mapRect(clipBoundingRect()),
+ ti.fontEngine, glyphs.data(), positions.data(),
+ glyphs.size());
+
+ if (range.first >= range.second)
+ return;
+
+ QStaticTextItem staticTextItem;
+ staticTextItem.color = s->pen.color();
+ staticTextItem.font = s->font;
+ staticTextItem.setFontEngine(ti.fontEngine);
+ staticTextItem.numGlyphs = range.second - range.first;
+ staticTextItem.glyphs = glyphs.data() + range.first;
+ staticTextItem.glyphPositions = positions.data() + range.first;
+ QPaintEngineEx::drawStaticTextItem(&staticTextItem);
+ } else {
+ QPaintEngineEx::drawTextItem(p, ti);
+ }
}
/*!
@@ -4426,8 +4501,6 @@ void QSpanData::setupMatrix(const QTransform &matrix, int bilin)
adjustSpanMethods();
}
-extern const QVector<QRgb> *qt_image_colortable(const QImage &image);
-
void QSpanData::initTexture(const QImage *image, int alpha, QTextureData::Type _type, const QRect &sourceRect)
{
const QImageData *d = const_cast<QImage *>(image)->data_ptr();
diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h
index d9cc428337..aa454c0509 100644
--- a/src/gui/painting/qpaintengine_raster_p.h
+++ b/src/gui/painting/qpaintengine_raster_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -178,7 +178,7 @@ public:
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
void drawImage(const QPointF &p, const QImage &img);
void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
- Qt::ImageConversionFlags falgs = Qt::AutoColor);
+ Qt::ImageConversionFlags flags = Qt::AutoColor);
void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr);
void drawTextItem(const QPointF &p, const QTextItem &textItem);
@@ -268,10 +268,10 @@ private:
void updateOutlineMapper();
inline void ensureOutlineMapper();
- void updateState();
- inline void ensureState() {
+ void updateRasterState();
+ inline void ensureRasterState() {
if (state()->dirty)
- updateState();
+ updateRasterState();
}
};
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 5c39a5fca2..e5e14c9135 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1072,7 +1072,7 @@ void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem)
changedHints = true;
}
- fill(qtVectorPathForPath(path), s->pen.color());
+ fill(qtVectorPathForPath(path), s->pen.brush());
if (changedHints) {
s->renderHints = oldHints;
diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h
index 9674f04ba1..33a6081570 100644
--- a/src/gui/painting/qpaintengineex_p.h
+++ b/src/gui/painting/qpaintengineex_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 416fe5adbf..77c3fc183f 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -2201,7 +2201,7 @@ void QPainter::setBrushOrigin(const QPointF &p)
source defines the translucency of the pixel.
When the paint device is a QImage, the image format must be set to
- \l {QImage::Format}{Format_ARGB32Premultiplied} or
+ \l {QImage::Format}{Format_ARGB32_Premultiplied} or
\l {QImage::Format}{Format_ARGB32} for the composition modes to have
any effect. For performance the premultiplied version is the preferred
format.
diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h
index fd40111368..ba9a9fbb97 100644
--- a/src/gui/painting/qpainter.h
+++ b/src/gui/painting/qpainter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h
index 79d4b4bbe0..0fb3069ee0 100644
--- a/src/gui/painting/qpainter_p.h
+++ b/src/gui/painting/qpainter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 5b70f4b22a..9c69644033 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h
index a558abca3d..46af341df3 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h
index 738c2d382d..1cf00bbae3 100644
--- a/src/gui/painting/qpainterpath_p.h
+++ b/src/gui/painting/qpainterpath_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index f739198be0..03f48d8fda 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h
index fe4a97ad4c..daf97884c0 100644
--- a/src/gui/painting/qpathclipper_p.h
+++ b/src/gui/painting/qpathclipper_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 8f21663ffc..62f4b9b3f6 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h
index 6df5052c06..32b59e92e8 100644
--- a/src/gui/painting/qpdf_p.h
+++ b/src/gui/painting/qpdf_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp
index a0f8df2061..23be05c49c 100644
--- a/src/gui/painting/qpdfwriter.cpp
+++ b/src/gui/painting/qpdfwriter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h
index 005d8e640b..dfe49b403a 100644
--- a/src/gui/painting/qpdfwriter.h
+++ b/src/gui/painting/qpdfwriter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp
index 5358239014..3654c6f007 100644
--- a/src/gui/painting/qpen.cpp
+++ b/src/gui/painting/qpen.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpen.h b/src/gui/painting/qpen.h
index a751c2fdd3..708f131ece 100644
--- a/src/gui/painting/qpen.h
+++ b/src/gui/painting/qpen.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpen_p.h b/src/gui/painting/qpen_p.h
index d91566664d..4610026e2f 100644
--- a/src/gui/painting/qpen_p.h
+++ b/src/gui/painting/qpen_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qplatformbackingstore_qpa.cpp b/src/gui/painting/qplatformbackingstore_qpa.cpp
index 2c0053af86..9d855735f4 100644
--- a/src/gui/painting/qplatformbackingstore_qpa.cpp
+++ b/src/gui/painting/qplatformbackingstore_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qplatformbackingstore_qpa.h b/src/gui/painting/qplatformbackingstore_qpa.h
index d5a2536ea6..a47106771e 100644
--- a/src/gui/painting/qplatformbackingstore_qpa.h
+++ b/src/gui/painting/qplatformbackingstore_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp
index fc22aed392..b745e1a6ee 100644
--- a/src/gui/painting/qpolygon.cpp
+++ b/src/gui/painting/qpolygon.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpolygon.h b/src/gui/painting/qpolygon.h
index cf3bf472f6..348cf9eef7 100644
--- a/src/gui/painting/qpolygon.h
+++ b/src/gui/painting/qpolygon.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpolygonclipper_p.h b/src/gui/painting/qpolygonclipper_p.h
index df0bfccc3f..6512a3a0ed 100644
--- a/src/gui/painting/qpolygonclipper_p.h
+++ b/src/gui/painting/qpolygonclipper_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qrasterdefs_p.h b/src/gui/painting/qrasterdefs_p.h
index 8d9d4e9277..a113ab0abf 100644
--- a/src/gui/painting/qrasterdefs_p.h
+++ b/src/gui/painting/qrasterdefs_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp
index 1d3f581b88..5a46d1ba48 100644
--- a/src/gui/painting/qrasterizer.cpp
+++ b/src/gui/painting/qrasterizer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qrasterizer_p.h b/src/gui/painting/qrasterizer_p.h
index 913e2d3229..ed7d4eb957 100644
--- a/src/gui/painting/qrasterizer_p.h
+++ b/src/gui/painting/qrasterizer_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index 66b12e5034..68338602e2 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h
index a5ea88b8bd..834a015ceb 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qrgb.h b/src/gui/painting/qrgb.h
index 1f9c922bf2..b982707344 100644
--- a/src/gui/painting/qrgb.h
+++ b/src/gui/painting/qrgb.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp
index bbb951eb9b..f7e50c82c0 100644
--- a/src/gui/painting/qstroker.cpp
+++ b/src/gui/painting/qstroker.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h
index 58d4f5da40..b6cae1d2a0 100644
--- a/src/gui/painting/qstroker_p.h
+++ b/src/gui/painting/qstroker_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 1e0ed0f798..0743804319 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index d9d57f41ab..d29a31f4f3 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index e42eec6f96..f9948bf8d1 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h
index 3289bf4d26..08a4861100 100644
--- a/src/gui/painting/qtransform.h
+++ b/src/gui/painting/qtransform.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qvectorpath_p.h b/src/gui/painting/qvectorpath_p.h
index 6a061a405b..8a54e65aed 100644
--- a/src/gui/painting/qvectorpath_p.h
+++ b/src/gui/painting/qvectorpath_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qabstractfontengine_p.h b/src/gui/text/qabstractfontengine_p.h
index b744d6664c..7d0eaa7b42 100644
--- a/src/gui/text/qabstractfontengine_p.h
+++ b/src/gui/text/qabstractfontengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp
index c392b54520..5dd29e6548 100644
--- a/src/gui/text/qabstracttextdocumentlayout.cpp
+++ b/src/gui/text/qabstracttextdocumentlayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qabstracttextdocumentlayout.h b/src/gui/text/qabstracttextdocumentlayout.h
index 8e792e9b80..1362640b4f 100644
--- a/src/gui/text/qabstracttextdocumentlayout.h
+++ b/src/gui/text/qabstracttextdocumentlayout.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qabstracttextdocumentlayout_p.h b/src/gui/text/qabstracttextdocumentlayout_p.h
index 692b535991..6f8f113bff 100644
--- a/src/gui/text/qabstracttextdocumentlayout_p.h
+++ b/src/gui/text/qabstracttextdocumentlayout_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index 6a28ff2d74..06a88f02ee 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h
index 171085b800..fa60a3fd2e 100644
--- a/src/gui/text/qcssparser_p.h
+++ b/src/gui/text/qcssparser_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qcssscanner.cpp b/src/gui/text/qcssscanner.cpp
index 375f211d9f..07928a62af 100644
--- a/src/gui/text/qcssscanner.cpp
+++ b/src/gui/text/qcssscanner.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 804d3f9e66..1ac398967d 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -138,36 +138,32 @@ extern bool qt_is_gui_used;
Q_GUI_EXPORT int qt_defaultDpiX()
{
+ if (qApp->testAttribute(Qt::AA_Use96Dpi))
+ return 96;
+
if (!qt_is_gui_used)
return 75;
- int dpi;
- QScreen *screen = QGuiApplication::primaryScreen();
- if (screen) {
- dpi = qRound(screen->logicalDotsPerInchX());
- } else {
- //PI has not been initialised, or it is being initialised. Give a default dpi
- dpi = 100;
- }
+ if (const QScreen *screen = QGuiApplication::primaryScreen())
+ return qRound(screen->logicalDotsPerInchX());
- return dpi;
+ //PI has not been initialised, or it is being initialised. Give a default dpi
+ return 100;
}
Q_GUI_EXPORT int qt_defaultDpiY()
{
+ if (qApp->testAttribute(Qt::AA_Use96Dpi))
+ return 96;
+
if (!qt_is_gui_used)
return 75;
- int dpi;
- QScreen *screen = QGuiApplication::primaryScreen();
- if (screen) {
- dpi = qRound(screen->logicalDotsPerInchY());
- } else {
- //PI has not been initialised, or it is being initialised. Give a default dpi
- dpi = 100;
- }
+ if (const QScreen *screen = QGuiApplication::primaryScreen())
+ return qRound(screen->logicalDotsPerInchY());
- return dpi;
+ //PI has not been initialised, or it is being initialised. Give a default dpi
+ return 100;
}
Q_GUI_EXPORT int qt_defaultDpi()
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index 326dc9d63e..afeea3ce65 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index 2d4f3de7e7..b57af5f213 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfont_qpa.cpp b/src/gui/text/qfont_qpa.cpp
index 28fd77df56..2f5b6f7660 100644
--- a/src/gui/text/qfont_qpa.cpp
+++ b/src/gui/text/qfont_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index c80ded6e7b..e7cbe2a8a8 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h
index 873d00946c..3bfc07fbfd 100644
--- a/src/gui/text/qfontdatabase.h
+++ b/src/gui/text/qfontdatabase.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp
index 55b9023c7c..a5cb923460 100644
--- a/src/gui/text/qfontdatabase_qpa.cpp
+++ b/src/gui/text/qfontdatabase_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 5c6c8d186a..d569cb58b9 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index b2bff92b76..e41c0a93c7 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h
index edc2457687..c84c11163a 100644
--- a/src/gui/text/qfontengine_ft_p.h
+++ b/src/gui/text/qfontengine_ft_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 4caf91e735..02523ada82 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp
index c25ed43fdc..3408d3a2a8 100644
--- a/src/gui/text/qfontengine_qpa.cpp
+++ b/src/gui/text/qfontengine_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengine_qpa_p.h b/src/gui/text/qfontengine_qpa_p.h
index a88c1bc3cc..d09692bc57 100644
--- a/src/gui/text/qfontengine_qpa_p.h
+++ b/src/gui/text/qfontengine_qpa_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp
index 8bdaa46524..bedc54f92a 100644
--- a/src/gui/text/qfontengine_qpf.cpp
+++ b/src/gui/text/qfontengine_qpf.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengine_qpf_p.h b/src/gui/text/qfontengine_qpf_p.h
index 9473e6b6b7..8a79f65814 100644
--- a/src/gui/text/qfontengine_qpf_p.h
+++ b/src/gui/text/qfontengine_qpf_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontenginedirectwrite.cpp b/src/gui/text/qfontenginedirectwrite.cpp
index 952e06d151..438d30a913 100644
--- a/src/gui/text/qfontenginedirectwrite.cpp
+++ b/src/gui/text/qfontenginedirectwrite.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontenginedirectwrite_p.h b/src/gui/text/qfontenginedirectwrite_p.h
index edf1e6a182..26198e64ee 100644
--- a/src/gui/text/qfontenginedirectwrite_p.h
+++ b/src/gui/text/qfontenginedirectwrite_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengineglyphcache_p.h b/src/gui/text/qfontengineglyphcache_p.h
index 6b633d615c..855c4a0aa0 100644
--- a/src/gui/text/qfontengineglyphcache_p.h
+++ b/src/gui/text/qfontengineglyphcache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontinfo.h b/src/gui/text/qfontinfo.h
index 37a724ec7c..88e1d9f65d 100644
--- a/src/gui/text/qfontinfo.h
+++ b/src/gui/text/qfontinfo.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 1d80e316fd..11e41ad685 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h
index 21e211a4a7..f5184aacba 100644
--- a/src/gui/text/qfontmetrics.h
+++ b/src/gui/text/qfontmetrics.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp
index de945e129b..91d8264f76 100644
--- a/src/gui/text/qfontsubset.cpp
+++ b/src/gui/text/qfontsubset.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontsubset_p.h b/src/gui/text/qfontsubset_p.h
index a99236f4cc..3dabec5f0b 100644
--- a/src/gui/text/qfontsubset_p.h
+++ b/src/gui/text/qfontsubset_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfragmentmap.cpp b/src/gui/text/qfragmentmap.cpp
index 134293194b..ac923bb639 100644
--- a/src/gui/text/qfragmentmap.cpp
+++ b/src/gui/text/qfragmentmap.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfragmentmap_p.h b/src/gui/text/qfragmentmap_p.h
index d05438ab5b..e6da236552 100644
--- a/src/gui/text/qfragmentmap_p.h
+++ b/src/gui/text/qfragmentmap_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp
index 2e7097f88c..3f9989090a 100644
--- a/src/gui/text/qglyphrun.cpp
+++ b/src/gui/text/qglyphrun.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qglyphrun.h b/src/gui/text/qglyphrun.h
index 826156fe11..0c47c6f4bc 100644
--- a/src/gui/text/qglyphrun.h
+++ b/src/gui/text/qglyphrun.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qglyphrun_p.h b/src/gui/text/qglyphrun_p.h
index 863b9d883e..c3b6cf40be 100644
--- a/src/gui/text/qglyphrun_p.h
+++ b/src/gui/text/qglyphrun_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qharfbuzz_copy_p.h b/src/gui/text/qharfbuzz_copy_p.h
index 10356e4aea..aa48667e2e 100644
--- a/src/gui/text/qharfbuzz_copy_p.h
+++ b/src/gui/text/qharfbuzz_copy_p.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2007 Red Hat, Inc.
*
* This code is a modified version of some part of HarfBuzz,
diff --git a/src/gui/text/qlinecontrol.cpp b/src/gui/text/qlinecontrol.cpp
index 62f4515fcc..fc8bcafed4 100644
--- a/src/gui/text/qlinecontrol.cpp
+++ b/src/gui/text/qlinecontrol.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qlinecontrol_p.h b/src/gui/text/qlinecontrol_p.h
index 4970a8c05e..fb14df27bb 100644
--- a/src/gui/text/qlinecontrol_p.h
+++ b/src/gui/text/qlinecontrol_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -277,7 +277,7 @@ public:
Qt::LayoutDirection layoutDirection() const {
if (m_layoutDirection == Qt::LayoutDirectionAuto) {
if (m_text.isEmpty())
- return QGuiApplication::keyboardInputDirection();
+ return qApp->inputPanel()->inputDirection();
return m_text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight;
}
return m_layoutDirection;
diff --git a/src/gui/text/qpfutil.cpp b/src/gui/text/qpfutil.cpp
index 8e69a4b67f..f60b358dbe 100644
--- a/src/gui/text/qpfutil.cpp
+++ b/src/gui/text/qpfutil.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp
index 8d5a9201d9..fbd9cb09cf 100644
--- a/src/gui/text/qplatformfontdatabase_qpa.cpp
+++ b/src/gui/text/qplatformfontdatabase_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -233,6 +233,13 @@ bool QSupportedWritingSystems::supported(QFontDatabase::WritingSystem writingSys
*/
/*!
+ \internal
+ */
+QPlatformFontDatabase::~QPlatformFontDatabase()
+{
+}
+
+/*!
This function is called once at startup by Qt's internal font database.
Reimplement this function in a subclass for a convenient place to initialize
the internal font database.
diff --git a/src/gui/text/qplatformfontdatabase_qpa.h b/src/gui/text/qplatformfontdatabase_qpa.h
index 901d8c2e6e..9ee2bfd76a 100644
--- a/src/gui/text/qplatformfontdatabase_qpa.h
+++ b/src/gui/text/qplatformfontdatabase_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -87,6 +87,7 @@ class QFontRequestPrivate;
class Q_GUI_EXPORT QPlatformFontDatabase
{
public:
+ virtual ~QPlatformFontDatabase();
virtual void populateFontDatabase();
virtual QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle);
virtual QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const;
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 8fccd9b0ca..65d9797374 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h
index b66bc04eab..87f4a75bc7 100644
--- a/src/gui/text/qrawfont.h
+++ b/src/gui/text/qrawfont.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qrawfont_ft.cpp b/src/gui/text/qrawfont_ft.cpp
index c941b98694..f0251b28f6 100644
--- a/src/gui/text/qrawfont_ft.cpp
+++ b/src/gui/text/qrawfont_ft.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qrawfont_p.h b/src/gui/text/qrawfont_p.h
index 992cb2f720..b1a71d96ab 100644
--- a/src/gui/text/qrawfont_p.h
+++ b/src/gui/text/qrawfont_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qrawfont_qpa.cpp b/src/gui/text/qrawfont_qpa.cpp
index 47815baf06..444efd0a0b 100644
--- a/src/gui/text/qrawfont_qpa.cpp
+++ b/src/gui/text/qrawfont_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index a52cf25a98..c356aa7e99 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qstatictext.h b/src/gui/text/qstatictext.h
index 61a590c798..ad55c6a05d 100644
--- a/src/gui/text/qstatictext.h
+++ b/src/gui/text/qstatictext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h
index 5f9410c31d..2607bcfe8a 100644
--- a/src/gui/text/qstatictext_p.h
+++ b/src/gui/text/qstatictext_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp
index 5f1a53b556..d9bdeeddfe 100644
--- a/src/gui/text/qsyntaxhighlighter.cpp
+++ b/src/gui/text/qsyntaxhighlighter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qsyntaxhighlighter.h b/src/gui/text/qsyntaxhighlighter.h
index 1c421d1c26..bd64de34bb 100644
--- a/src/gui/text/qsyntaxhighlighter.h
+++ b/src/gui/text/qsyntaxhighlighter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index f74d67cf6d..b21dae5298 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextcontrol_p.h b/src/gui/text/qtextcontrol_p.h
index f80c4c81b6..e00ffd4042 100644
--- a/src/gui/text/qtextcontrol_p.h
+++ b/src/gui/text/qtextcontrol_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextcontrol_p_p.h b/src/gui/text/qtextcontrol_p_p.h
index 9c7ab56395..12dfbafb69 100644
--- a/src/gui/text/qtextcontrol_p_p.h
+++ b/src/gui/text/qtextcontrol_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 2bebf4c861..766d9792cd 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -269,25 +269,7 @@ void QTextCursorPrivate::adjustCursor(QTextCursor::MoveOperation m)
QTextTableCell c_position = table->cellAt(position);
QTextTableCell c_anchor = table->cellAt(adjusted_anchor);
if (c_position != c_anchor) {
- bool before;
- int col_position = c_position.column();
- int col_anchor = c_anchor.column();
- if (col_position == col_anchor) {
- before = c_position.row() < c_anchor.row();
- } else {
- before = col_position < col_anchor;
- }
-
- // adjust to cell boundaries
- if (m <= QTextCursor::WordLeft) {
- position = c_position.firstPosition();
- if (!before)
- --position;
- } else {
- position = c_position.lastPosition();
- if (before)
- ++position;
- }
+ position = c_position.firstPosition();
if (position < adjusted_anchor)
adjusted_anchor = c_anchor.lastPosition();
else
@@ -391,6 +373,17 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
int newPosition = position;
+ if (mode == QTextCursor::KeepAnchor && complexSelectionTable() != 0) {
+ if ((op >= QTextCursor::EndOfLine && op <= QTextCursor::NextWord)
+ || (op >= QTextCursor::Right && op <= QTextCursor::WordRight)) {
+ QTextTable *t = qobject_cast<QTextTable *>(priv->frameAt(position));
+ Q_ASSERT(t); // as we have already made sure we have a complex selection
+ QTextTableCell cell_pos = t->cellAt(position);
+ if (cell_pos.column() + cell_pos.columnSpan() != t->columns())
+ op = QTextCursor::NextCell;
+ }
+ }
+
if (x == -1 && !priv->isInEditBlock() && (op == QTextCursor::Up || op == QTextCursor::Down))
setX();
@@ -495,6 +488,8 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
break;
}
newPosition = blockIt.position() + line.textStart() + line.textLength();
+ if (newPosition >= priv->length())
+ newPosition = priv->length() - 1;
if (line.lineNumber() < layout->lineCount() - 1) {
const QString text = blockIt.text();
// ###### this relies on spaces being the cause for linebreaks.
diff --git a/src/gui/text/qtextcursor.h b/src/gui/text/qtextcursor.h
index bc4cdb5fb6..32ded45137 100644
--- a/src/gui/text/qtextcursor.h
+++ b/src/gui/text/qtextcursor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextcursor_p.h b/src/gui/text/qtextcursor_p.h
index c612169acf..d64498a7ac 100644
--- a/src/gui/text/qtextcursor_p.h
+++ b/src/gui/text/qtextcursor_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 8d9a8c405a..3038504591 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1925,8 +1925,12 @@ QVariant QTextDocument::loadResource(int type, const QUrl &name)
#endif
// handle data: URLs
- if (r.isNull() && name.scheme().compare(QLatin1String("data"), Qt::CaseInsensitive) == 0)
- r = qDecodeDataUrl(name).second;
+ if (r.isNull() && name.scheme().compare(QLatin1String("data"), Qt::CaseInsensitive) == 0) {
+ QString mimetype;
+ QByteArray payload;
+ if (qDecodeDataUrl(name, mimetype, payload))
+ r = payload;
+ }
// if resource was not loaded try to load it here
if (!doc && r.isNull() && name.isRelative()) {
diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h
index 9d9af2b5bb..b7c77c2c54 100644
--- a/src/gui/text/qtextdocument.h
+++ b/src/gui/text/qtextdocument.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index 901375d8c8..9e410b40af 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h
index fbf91bfc0e..07a5230ec5 100644
--- a/src/gui/text/qtextdocument_p.h
+++ b/src/gui/text/qtextdocument_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp
index 0c8860e98e..a42a4ce39a 100644
--- a/src/gui/text/qtextdocumentfragment.cpp
+++ b/src/gui/text/qtextdocumentfragment.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -372,18 +372,8 @@ QString QTextDocumentFragment::toPlainText() const
return d->doc->toPlainText();
}
-// #### Qt 5: merge with other overload
-/*!
- \overload
-*/
-
#ifndef QT_NO_TEXTHTMLPARSER
-QString QTextDocumentFragment::toHtml() const
-{
- return toHtml(QByteArray());
-}
-
/*!
\since 4.2
diff --git a/src/gui/text/qtextdocumentfragment.h b/src/gui/text/qtextdocumentfragment.h
index 151a1a1ba5..cc7dd293f2 100644
--- a/src/gui/text/qtextdocumentfragment.h
+++ b/src/gui/text/qtextdocumentfragment.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -69,8 +69,7 @@ public:
QString toPlainText() const;
#ifndef QT_NO_TEXTHTMLPARSER
- QString toHtml() const;
- QString toHtml(const QByteArray &encoding) const;
+ QString toHtml(const QByteArray &encoding = QByteArray()) const;
#endif // QT_NO_TEXTHTMLPARSER
static QTextDocumentFragment fromPlainText(const QString &plainText);
diff --git a/src/gui/text/qtextdocumentfragment_p.h b/src/gui/text/qtextdocumentfragment_p.h
index 227123ed80..44276d3629 100644
--- a/src/gui/text/qtextdocumentfragment_p.h
+++ b/src/gui/text/qtextdocumentfragment_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index 5138aa3e70..80975f928b 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextdocumentlayout_p.h b/src/gui/text/qtextdocumentlayout_p.h
index bef4c844f6..e5f8cc19a8 100644
--- a/src/gui/text/qtextdocumentlayout_p.h
+++ b/src/gui/text/qtextdocumentlayout_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextdocumentwriter.cpp b/src/gui/text/qtextdocumentwriter.cpp
index 11bf3fcb08..a371471b76 100644
--- a/src/gui/text/qtextdocumentwriter.cpp
+++ b/src/gui/text/qtextdocumentwriter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextdocumentwriter.h b/src/gui/text/qtextdocumentwriter.h
index 0b3f11042b..7dc903c412 100644
--- a/src/gui/text/qtextdocumentwriter.h
+++ b/src/gui/text/qtextdocumentwriter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index d223b2ec37..0dd8d0bef3 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -54,6 +54,7 @@
#include <private/qunicodetables_p.h>
#include "qtextdocument_p.h"
#include <qguiapplication.h>
+#include <qinputpanel.h>
#include <stdlib.h>
@@ -1408,7 +1409,7 @@ bool QTextEngine::isRightToLeft() const
itemize();
// this places the cursor in the right position depending on the keyboard layout
if (layoutData->string.isEmpty())
- return QGuiApplication::keyboardInputDirection() == Qt::RightToLeft;
+ return qApp ? qApp->inputPanel()->inputDirection() == Qt::RightToLeft : false;
return layoutData->string.isRightToLeft();
}
@@ -2692,7 +2693,7 @@ int QTextEngine::positionInLigature(const QScriptItem *si, int end,
closestItem--;
int pos = si->position + clusterStart + closestItem;
// Jump to the next charStop
- while (!attrs[pos].charStop && pos < end)
+ while (pos < end && !attrs[pos].charStop)
pos++;
return pos;
}
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index d821fa50cb..368ad3763d 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 833414f79f..9ce45fdaf3 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -394,6 +394,9 @@ void QTextFormatPrivate::recalcFont() const
case QTextFormat::FontStrikeOut:
f.setStrikeOut(props.at(i).value.toBool());
break;
+ case QTextFormat::FontAbsoluteLetterSpacing:
+ f.setLetterSpacing(QFont::AbsoluteSpacing, props.at(i).value.toReal());
+ break;
case QTextFormat::FontLetterSpacing:
f.setLetterSpacing(QFont::PercentageSpacing, props.at(i).value.toReal());
break;
@@ -408,6 +411,9 @@ void QTextFormatPrivate::recalcFont() const
if (f.fixedPitch() != value)
f.setFixedPitch(value);
break; }
+ case QTextFormat::FontStretch:
+ f.setStretch(props.at(i).value.toInt());
+ break;
case QTextFormat::FontStyleHint:
f.setStyleHint(static_cast<QFont::StyleHint>(props.at(i).value.toInt()), f.styleStrategy());
break;
@@ -564,10 +570,12 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
\value FontOverline
\value FontStrikeOut
\value FontCapitalization Specifies the capitalization type that is to be applied to the text.
+ \value FontAbsoluteLetterSpacing If true FontLetterSpacing is absolute
\value FontLetterSpacing Changes the default spacing between individual letters in the font. The value is
specified in percentage, with 100 as the default value.
\value FontWordSpacing Changes the default spacing between individual words. A positive value increases the word spacing
by the corresponding pixels; a negative value decreases the spacing.
+ \value FontStretch Corresponds to the QFont::Stretch property
\value FontStyleHint Corresponds to the QFont::StyleHint property
\value FontStyleStrategy Corresponds to the QFont::StyleStrategy property
\value FontKerning Specifies whether the font has kerning turned on.
@@ -1853,8 +1861,12 @@ void QTextCharFormat::setFont(const QFont &font)
setFontFixedPitch(font.fixedPitch());
setFontCapitalization(font.capitalization());
setFontWordSpacing(font.wordSpacing());
- if (font.letterSpacingType() == QFont::PercentageSpacing)
+ if (font.letterSpacingType() == QFont::AbsoluteSpacing) {
+ setFontAbsoluteLetterSpacing(font.letterSpacing());
+ } else {
setFontLetterSpacing(font.letterSpacing());
+ }
+ setFontStretch(font.stretch());
setFontStyleHint(font.styleHint());
setFontStyleStrategy(font.styleStrategy());
setFontKerning(font.kerning());
@@ -3045,14 +3057,37 @@ QTextImageFormat::QTextImageFormat(const QTextFormat &fmt)
*/
/*!
+ \fn void QTextCharFormat::setFontAbsoluteLetterSpacing(bool absolute)
+ \since 5.0
+
+ Sets the letter spacing type of this format to absolute.
+ \sa fontAbsoluteLetterSpacing()
+ \sa setFontLetterSpacing()
+ \sa fontLetterSpacing()
+*/
+
+/*!
+ \fn bool QTextCharFormat::fontAbsoluteLetterSpacing() const
+ \since 5.0
+
+ Returns if the current letter spacing is absolute (or percentage).
+ \sa setFontAbsoluteLetterSpacing()
+ \sa setFontLetterSpacing()
+ \sa fontLetterSpacing()
+*/
+
+/*!
\fn void QTextCharFormat::setFontLetterSpacing(qreal spacing)
\since 4.4
- Sets the letter spacing of this format to the given \a spacing, in percent.
- A value of 100 indicates default spacing; a value of 200 doubles the amount
+ Sets the letter spacing of this format to the given \a spacing.
+ Depending on fontAbsoluteLetterSpacing the value is given in absolutes or in percent.
+ For percent a value of 100 indicates default spacing; a value of 200 doubles the amount
of space a letter takes.
\sa fontLetterSpacing()
+ \sa setFontAbsoluteLetterSpacing()
+ \sa fontAbsoluteLetterSpacing()
*/
/*!
@@ -3079,6 +3114,28 @@ QTextImageFormat::QTextImageFormat(const QTextFormat &fmt)
*/
/*!
+ \fn void QTextCharFormat::setFontStretch(int factor)
+ \since 5.0
+
+ Sets the stretch factor for the font.
+
+ The stretch factor changes the width of all characters in the font by factor percent. For example, setting factor to 150 results in all characters in the font being 1.5 times (ie. 150%) wider. The default stretch factor is 100. The minimum stretch factor is 1, and the maximum stretch factor is 4000.
+
+ The stretch factor is only applied to outline fonts. The stretch factor is ignored for bitmap fonts.
+
+ NOTE: QFont cannot stretch XLFD fonts. When loading XLFD fonts on X11, the stretch factor is matched against a predefined set of values for the SETWIDTH_NAME field of the XLFD.
+ \sa fontStretch()
+*/
+
+/*!
+ \fn int QTextCharFormat::fontStretch() const
+ \since 5.0
+
+ Returns the current font stretching.
+ \sa setFontStretch()
+*/
+
+/*!
\fn qreal QTextTableCellFormat::topPadding() const
\since 4.4
@@ -3321,4 +3378,19 @@ void QTextFormatCollection::setDefaultFont(const QFont &f)
formats[i].d->resolveFont(defaultFnt);
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QTextLength &l)
+{
+ dbg.nospace() << "QTextLength(QTextLength::Type(" << l.type() << "))";
+ return dbg.space();
+}
+
+QDebug operator<<(QDebug dbg, const QTextFormat &f)
+{
+ dbg.nospace() << "QTextFormat(QTextFormat::FormatType(" << f.type() << "))";
+ return dbg.space();
+}
+
+#endif
+
QT_END_NAMESPACE
diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h
index a7bc15eb74..5c9d6fe20e 100644
--- a/src/gui/text/qtextformat.h
+++ b/src/gui/text/qtextformat.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -81,6 +81,10 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextLength &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextLength &);
#endif
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QTextLength &);
+#endif
+
class Q_GUI_EXPORT QTextLength
{
public:
@@ -126,6 +130,10 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextFormat &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextFormat &);
#endif
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QTextFormat &);
+#endif
+
class Q_GUI_EXPORT QTextFormat
{
Q_GADGET
@@ -172,8 +180,10 @@ public:
// character properties
FirstFontProperty = 0x1FE0,
FontCapitalization = FirstFontProperty,
+ FontAbsoluteLetterSpacing = 0x2033, // if true FontLetterSpacing is absolute
FontLetterSpacing = 0x1FE1,
FontWordSpacing = 0x1FE2,
+ FontStretch = 0x2034,
FontStyleHint = 0x1FE3,
FontStyleStrategy = 0x1FE4,
FontKerning = 0x1FE5,
@@ -420,8 +430,14 @@ public:
{ setProperty(FontCapitalization, capitalization); }
inline QFont::Capitalization fontCapitalization() const
{ return static_cast<QFont::Capitalization>(intProperty(FontCapitalization)); }
+ inline void setFontAbsoluteLetterSpacing(qreal absoluteSpacing)
+ { setProperty(FontAbsoluteLetterSpacing, absoluteSpacing);
+ clearProperty(FontLetterSpacing); }
+ inline qreal fontAbsoluteLetterSpacing() const
+ { return doubleProperty(FontAbsoluteLetterSpacing); }
inline void setFontLetterSpacing(qreal spacing)
- { setProperty(FontLetterSpacing, spacing); }
+ { setProperty(FontLetterSpacing, spacing);
+ clearProperty(FontAbsoluteLetterSpacing); }
inline qreal fontLetterSpacing() const
{ return doubleProperty(FontLetterSpacing); }
inline void setFontWordSpacing(qreal spacing)
@@ -453,6 +469,11 @@ public:
inline bool fontFixedPitch() const
{ return boolProperty(FontFixedPitch); }
+ inline void setFontStretch(qreal factor)
+ { setProperty(FontStretch, factor); }
+ inline int fontStretch() const
+ { return intProperty(FontStretch); }
+
inline void setFontStyleHint(QFont::StyleHint hint, QFont::StyleStrategy strategy = QFont::PreferDefault)
{ setProperty(FontStyleHint, hint); setProperty(FontStyleStrategy, strategy); }
inline void setFontStyleStrategy(QFont::StyleStrategy strategy)
diff --git a/src/gui/text/qtextformat_p.h b/src/gui/text/qtextformat_p.h
index d7d082c39b..61e3e1f253 100644
--- a/src/gui/text/qtextformat_p.h
+++ b/src/gui/text/qtextformat_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index ced71f5c60..4ee282c46e 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtexthtmlparser_p.h b/src/gui/text/qtexthtmlparser_p.h
index 9019942304..f1a90ee0a3 100644
--- a/src/gui/text/qtexthtmlparser_p.h
+++ b/src/gui/text/qtexthtmlparser_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextimagehandler.cpp b/src/gui/text/qtextimagehandler.cpp
index 138fb1a168..c7cf2df903 100644
--- a/src/gui/text/qtextimagehandler.cpp
+++ b/src/gui/text/qtextimagehandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -52,9 +52,6 @@
QT_BEGIN_NAMESPACE
-// set by the mime source factory in Qt3Compat
-QTextImageHandler::ExternalImageLoaderFunction QTextImageHandler::externalLoader = 0;
-
static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format)
{
QPixmap pm;
@@ -79,9 +76,6 @@ static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format)
context = browser->source().toString();
#endif
QImage img;
- if (QTextImageHandler::externalLoader)
- img = QTextImageHandler::externalLoader(name, context);
-
if (img.isNull()) { // try direct loading
name = format.name(); // remove qrc:/ prefix again
if (name.isEmpty() || !img.load(name))
@@ -157,9 +151,6 @@ static QImage getImage(QTextDocument *doc, const QTextImageFormat &format)
if (browser)
context = browser->source().toString();
#endif
- if (QTextImageHandler::externalLoader)
- image = QTextImageHandler::externalLoader(name, context);
-
if (image.isNull()) { // try direct loading
name = format.name(); // remove qrc:/ prefix again
if (name.isEmpty() || !image.load(name))
diff --git a/src/gui/text/qtextimagehandler_p.h b/src/gui/text/qtextimagehandler_p.h
index 8a14a46d5f..ce1d481eba 100644
--- a/src/gui/text/qtextimagehandler_p.h
+++ b/src/gui/text/qtextimagehandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -71,9 +71,6 @@ public:
virtual QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format);
virtual void drawObject(QPainter *p, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format);
QImage image(QTextDocument *doc, const QTextImageFormat &imageFormat);
-
- typedef QImage (*ExternalImageLoaderFunction)(const QString &name, const QString &context);
- static ExternalImageLoaderFunction externalLoader; //this is needed by Qt3Support
};
QT_END_NAMESPACE
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index f2622a7b20..1e8cb9e478 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -836,7 +836,7 @@ int QTextLayout::lineCount() const
*/
QTextLine QTextLayout::lineAt(int i) const
{
- return QTextLine(i, d);
+ return i < lineCount() ? QTextLine(i, d) : QTextLine();
}
/*!
@@ -2264,11 +2264,12 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
QFontEngine *mainFontEngine = font.d->engineForScript(si.analysis.script);
if (mainFontEngine->type() == QFontEngine::Multi) {
QFontEngineMulti *multiFontEngine = static_cast<QFontEngineMulti *>(mainFontEngine);
- int start = 0;
- int end;
- int which = glyphLayout.glyphs[0] >> 24;
- for (end = 0; end < glyphLayout.numGlyphs; ++end) {
- const int e = glyphLayout.glyphs[end] >> 24;
+ int end = rtl ? glyphLayout.numGlyphs : 0;
+ int start = rtl ? end : 0;
+ int which = glyphLayout.glyphs[rtl ? start - 1 : end] >> 24;
+ for (; (rtl && start > 0) || (!rtl && end < glyphLayout.numGlyphs);
+ rtl ? --start : ++end) {
+ const int e = glyphLayout.glyphs[rtl ? start - 1 : end] >> 24;
if (e == which)
continue;
@@ -2286,7 +2287,10 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
subLayout.advances_y[i].toReal());
}
- start = end;
+ if (rtl)
+ end = start;
+ else
+ start = end;
which = e;
}
diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h
index f1bfdc75db..e698625d9b 100644
--- a/src/gui/text/qtextlayout.h
+++ b/src/gui/text/qtextlayout.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp
index 92e509d8d9..97ad9dc82b 100644
--- a/src/gui/text/qtextlist.cpp
+++ b/src/gui/text/qtextlist.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextlist.h b/src/gui/text/qtextlist.h
index 83d10834c7..5a470f4582 100644
--- a/src/gui/text/qtextlist.h
+++ b/src/gui/text/qtextlist.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index d641266367..e49b0d3ad8 100644
--- a/src/gui/text/qtextobject.cpp
+++ b/src/gui/text/qtextobject.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h
index c2b46e4d12..f56a38b366 100644
--- a/src/gui/text/qtextobject.h
+++ b/src/gui/text/qtextobject.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextobject_p.h b/src/gui/text/qtextobject_p.h
index 798b9d1340..0ca2f87f0d 100644
--- a/src/gui/text/qtextobject_p.h
+++ b/src/gui/text/qtextobject_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp
index 8776b926c5..0fe2efdd5f 100644
--- a/src/gui/text/qtextodfwriter.cpp
+++ b/src/gui/text/qtextodfwriter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -376,9 +376,6 @@ void QTextOdfWriter::writeInlineCharacter(QXmlStreamWriter &writer, const QTextF
if (image.isNull()) {
QString context;
- if (QTextImageHandler::externalLoader)
- image = QTextImageHandler::externalLoader(name, context);
-
if (image.isNull()) { // try direct loading
name = imageFormat.name(); // remove qrc:/ prefix again
image.load(name);
diff --git a/src/gui/text/qtextodfwriter_p.h b/src/gui/text/qtextodfwriter_p.h
index 377c7fdeea..5108175291 100644
--- a/src/gui/text/qtextodfwriter_p.h
+++ b/src/gui/text/qtextodfwriter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp
index fe58583d04..2fe6284592 100644
--- a/src/gui/text/qtextoption.cpp
+++ b/src/gui/text/qtextoption.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextoption.h b/src/gui/text/qtextoption.h
index 3c04c76933..8b7b006921 100644
--- a/src/gui/text/qtextoption.h
+++ b/src/gui/text/qtextoption.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index 6935ffc6f4..64b28811e5 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtexttable.h b/src/gui/text/qtexttable.h
index b275a5783a..e5ea7609dd 100644
--- a/src/gui/text/qtexttable.h
+++ b/src/gui/text/qtexttable.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtexttable_p.h b/src/gui/text/qtexttable_p.h
index cd16f50a62..237a1a883c 100644
--- a/src/gui/text/qtexttable_p.h
+++ b/src/gui/text/qtexttable_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index 0ffcade591..b82e679d8b 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qzipreader_p.h b/src/gui/text/qzipreader_p.h
index b1df316cab..a569b584cf 100644
--- a/src/gui/text/qzipreader_p.h
+++ b/src/gui/text/qzipreader_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qzipwriter_p.h b/src/gui/text/qzipwriter_p.h
index 1ba93b88d7..0860c004f9 100644
--- a/src/gui/text/qzipwriter_p.h
+++ b/src/gui/text/qzipwriter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp
index 4fbf0a59f3..0bb233c82f 100644
--- a/src/gui/util/qdesktopservices.cpp
+++ b/src/gui/util/qdesktopservices.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qdesktopservices.h b/src/gui/util/qdesktopservices.h
index ba7702f0d7..af9aa7bec7 100644
--- a/src/gui/util/qdesktopservices.h
+++ b/src/gui/util/qdesktopservices.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qdesktopservices_mac.cpp b/src/gui/util/qdesktopservices_mac.cpp
index f4b5263f62..d822455886 100644
--- a/src/gui/util/qdesktopservices_mac.cpp
+++ b/src/gui/util/qdesktopservices_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qdesktopservices_qpa.cpp b/src/gui/util/qdesktopservices_qpa.cpp
index c60cec8422..9e517a0166 100644
--- a/src/gui/util/qdesktopservices_qpa.cpp
+++ b/src/gui/util/qdesktopservices_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qdesktopservices_win.cpp b/src/gui/util/qdesktopservices_win.cpp
index 8b120b4bf1..fe6d65994a 100644
--- a/src/gui/util/qdesktopservices_win.cpp
+++ b/src/gui/util/qdesktopservices_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qdesktopservices_x11.cpp b/src/gui/util/qdesktopservices_x11.cpp
index cf8dce3734..e64833a20c 100644
--- a/src/gui/util/qdesktopservices_x11.cpp
+++ b/src/gui/util/qdesktopservices_x11.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qhexstring_p.h b/src/gui/util/qhexstring_p.h
index 7cebce0650..7579e4ff78 100644
--- a/src/gui/util/qhexstring_p.h
+++ b/src/gui/util/qhexstring_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp
index 37997c0359..5b637e4383 100644
--- a/src/gui/util/qvalidator.cpp
+++ b/src/gui/util/qvalidator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qvalidator.h b/src/gui/util/qvalidator.h
index 5ea7fef4fc..3e15b48c1c 100644
--- a/src/gui/util/qvalidator.h
+++ b/src/gui/util/qvalidator.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -180,7 +180,7 @@ public:
virtual QValidator::State validate(QString& input, int& pos) const;
void setRegExp(const QRegExp& rx);
- const QRegExp& regExp() const { return r; } // ### make inline for 5.0
+ const QRegExp& regExp() const { return r; }
Q_SIGNALS:
void regExpChanged(const QRegExp& regExp);
diff --git a/src/modules/qt_v8.pri b/src/modules/qt_v8.pri
deleted file mode 100644
index 89d6c263e8..0000000000
--- a/src/modules/qt_v8.pri
+++ /dev/null
@@ -1,16 +0,0 @@
-QT.v8.VERSION = 5.0.0
-QT.v8.MAJOR_VERSION = 5
-QT.v8.MINOR_VERSION = 0
-QT.v8.PATCH_VERSION = 0
-
-QT.v8.name = QtV8
-QT.v8.bins = $$QT_MODULE_BIN_BASE
-QT.v8.includes = $$QT_MODULE_INCLUDE_BASE/QtV8
-QT.v8.private_includes = $$QT_MODULE_INCLUDE_BASE/QtV8/$$QT.v8.VERSION
-QT.v8.sources = $$QT_MODULE_BASE/src/v8
-QT.v8.libs = $$QT_MODULE_LIB_BASE
-QT.v8.plugins = $$QT_MODULE_PLUGIN_BASE
-QT.v8.imports = $$QT_MODULE_IMPORT_BASE
-QT.v8.depends =
-QT.v8.DEFINES =
-!contains(QT_CONFIG, static): QT.v8.DEFINES += V8_SHARED USING_V8_SHARED
diff --git a/src/network/access/access.pri b/src/network/access/access.pri
index 3d5558d334..0047084eb1 100644
--- a/src/network/access/access.pri
+++ b/src/network/access/access.pri
@@ -1,8 +1,8 @@
# Qt network access module
HEADERS += \
- access/qftp.h \
- access/qhttp.h \
+ access/qftp_p.h \
+ access/qhttpheader_p.h \
access/qhttpnetworkheader_p.h \
access/qhttpnetworkrequest_p.h \
access/qhttpnetworkreply_p.h \
@@ -39,7 +39,7 @@ HEADERS += \
SOURCES += \
access/qftp.cpp \
- access/qhttp.cpp \
+ access/qhttpheader.cpp \
access/qhttpnetworkheader.cpp \
access/qhttpnetworkrequest.cpp \
access/qhttpnetworkreply.cpp \
diff --git a/src/network/access/qabstractnetworkcache.cpp b/src/network/access/qabstractnetworkcache.cpp
index c15337a0e5..638e93be53 100644
--- a/src/network/access/qabstractnetworkcache.cpp
+++ b/src/network/access/qabstractnetworkcache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qabstractnetworkcache.h b/src/network/access/qabstractnetworkcache.h
index 3fff74cb5b..5d03756957 100644
--- a/src/network/access/qabstractnetworkcache.h
+++ b/src/network/access/qabstractnetworkcache.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qabstractnetworkcache_p.h b/src/network/access/qabstractnetworkcache_p.h
index 9b0628f829..162422f8c0 100644
--- a/src/network/access/qabstractnetworkcache_p.h
+++ b/src/network/access/qabstractnetworkcache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp
index eaed4dff5a..6fafff0f56 100644
--- a/src/network/access/qftp.cpp
+++ b/src/network/access/qftp.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,7 +42,7 @@
//#define QFTPPI_DEBUG
//#define QFTPDTP_DEBUG
-#include "qftp.h"
+#include "private/qftp_p.h"
#include "qabstractsocket.h"
#ifndef QT_NO_FTP
@@ -825,6 +825,8 @@ void QFtpPI::connectToHost(const QString &host, quint16 port)
}
/*
+ \internal
+
Sends the sequence of commands \a cmds to the FTP server. When the commands
are all done the finished() signal is emitted. When an error occurs, the
error() signal is emitted.
@@ -970,6 +972,8 @@ void QFtpPI::readyRead()
}
/*
+ \internal
+
Process a reply from the FTP server.
Returns true if the reply was processed or false if the reply has to be
@@ -1150,6 +1154,8 @@ bool QFtpPI::processReply()
}
/*
+ \internal
+
Starts next pending command. Returns false if there are no pending commands,
otherwise it returns true.
*/
@@ -1306,6 +1312,7 @@ int QFtpPrivate::addCommand(QFtpCommand *cmd)
*
*********************************************************************/
/*!
+ \internal
\class QFtp
\brief The QFtp class provides an implementation of the client side of FTP protocol.
@@ -1409,6 +1416,7 @@ int QFtpPrivate::addCommand(QFtpCommand *cmd)
/*!
+ \internal
Constructs a QFtp object with the given \a parent.
*/
QFtp::QFtp(QObject *parent)
@@ -1435,6 +1443,7 @@ QFtp::QFtp(QObject *parent)
}
/*!
+ \internal
\enum QFtp::State
This enum defines the connection state:
@@ -1451,6 +1460,7 @@ QFtp::QFtp(QObject *parent)
\sa stateChanged() state()
*/
/*!
+ \internal
\enum QFtp::TransferMode
FTP works with two socket connections; one for commands and
@@ -1468,6 +1478,7 @@ QFtp::QFtp(QObject *parent)
data.
*/
/*!
+ \internal
\enum QFtp::TransferType
This enum identifies the data transfer type used with get and
@@ -1479,6 +1490,7 @@ QFtp::QFtp(QObject *parent)
characters will be converted to the local format.
*/
/*!
+ \internal
\enum QFtp::Error
This enum identifies the error that occurred.
@@ -1495,6 +1507,7 @@ QFtp::QFtp(QObject *parent)
*/
/*!
+ \internal
\enum QFtp::Command
This enum is used as the return value for the currentCommand() function.
@@ -1524,6 +1537,7 @@ QFtp::QFtp(QObject *parent)
*/
/*!
+ \internal
\fn void QFtp::stateChanged(int state)
This signal is emitted when the state of the connection changes.
@@ -1538,6 +1552,7 @@ QFtp::QFtp(QObject *parent)
*/
/*!
+ \internal
\fn void QFtp::listInfo(const QUrlInfo &i);
This signal is emitted for each directory entry the list() command
@@ -1547,6 +1562,7 @@ QFtp::QFtp(QObject *parent)
*/
/*!
+ \internal
\fn void QFtp::commandStarted(int id)
This signal is emitted when processing the command identified by
@@ -1556,6 +1572,7 @@ QFtp::QFtp(QObject *parent)
*/
/*!
+ \internal
\fn void QFtp::commandFinished(int id, bool error)
This signal is emitted when processing the command identified by
@@ -1566,6 +1583,7 @@ QFtp::QFtp(QObject *parent)
*/
/*!
+ \internal
\fn void QFtp::done(bool error)
This signal is emitted when the last pending command has finished;
@@ -1577,6 +1595,7 @@ QFtp::QFtp(QObject *parent)
*/
/*!
+ \internal
\fn void QFtp::readyRead()
This signal is emitted in response to a get() command when there
@@ -1597,6 +1616,7 @@ QFtp::QFtp(QObject *parent)
*/
/*!
+ \internal
\fn void QFtp::dataTransferProgress(qint64 done, qint64 total)
This signal is emitted in response to a get() or put() request to
@@ -1617,6 +1637,7 @@ QFtp::QFtp(QObject *parent)
*/
/*!
+ \internal
\fn void QFtp::rawCommandReply(int replyCode, const QString &detail);
This signal is emitted in response to the rawCommand() function.
@@ -1627,6 +1648,7 @@ QFtp::QFtp(QObject *parent)
*/
/*!
+ \internal
Connects to the FTP server \a host using port \a port.
The stateChanged() signal is emitted when the state of the
@@ -1655,6 +1677,7 @@ int QFtp::connectToHost(const QString &host, quint16 port)
}
/*!
+ \internal
Logs in to the FTP server with the username \a user and the
password \a password.
@@ -1681,6 +1704,7 @@ int QFtp::login(const QString &user, const QString &password)
}
/*!
+ \internal
Closes the connection to the FTP server.
The stateChanged() signal is emitted when the state of the
@@ -1704,6 +1728,7 @@ int QFtp::close()
}
/*!
+ \internal
Sets the current FTP transfer mode to \a mode. The default is QFtp::Passive.
\sa QFtp::TransferMode
@@ -1717,6 +1742,7 @@ int QFtp::setTransferMode(TransferMode mode)
}
/*!
+ \internal
Enables use of the FTP proxy on host \a host and port \a
port. Calling this function with \a host empty disables proxying.
@@ -1731,6 +1757,7 @@ int QFtp::setProxy(const QString &host, quint16 port)
}
/*!
+ \internal
Lists the contents of directory \a dir on the FTP server. If \a
dir is empty, it lists the contents of the current directory.
@@ -1760,6 +1787,7 @@ int QFtp::list(const QString &dir)
}
/*!
+ \internal
Changes the working directory of the server to \a dir.
The function does not block and returns immediately. The command
@@ -1779,6 +1807,7 @@ int QFtp::cd(const QString &dir)
}
/*!
+ \internal
Downloads the file \a file from the server.
If \a dev is 0, then the readyRead() signal is emitted when there
@@ -1832,6 +1861,7 @@ int QFtp::get(const QString &file, QIODevice *dev, TransferType type)
}
/*!
+ \internal
\overload
Writes a copy of the given \a data to the file called \a file on
@@ -1869,6 +1899,7 @@ int QFtp::put(const QByteArray &data, const QString &file, TransferType type)
}
/*!
+ \internal
Reads the data from the IO device \a dev, and writes it to the
file called \a file on the server. The data is read in chunks from
the IO device, so this overload allows you to transmit large
@@ -1897,6 +1928,7 @@ int QFtp::put(QIODevice *dev, const QString &file, TransferType type)
}
/*!
+ \internal
Deletes the file called \a file from the server.
The function does not block and returns immediately. The command
@@ -1916,6 +1948,7 @@ int QFtp::remove(const QString &file)
}
/*!
+ \internal
Creates a directory called \a dir on the server.
The function does not block and returns immediately. The command
@@ -1935,6 +1968,7 @@ int QFtp::mkdir(const QString &dir)
}
/*!
+ \internal
Removes the directory called \a dir from the server.
The function does not block and returns immediately. The command
@@ -1954,6 +1988,7 @@ int QFtp::rmdir(const QString &dir)
}
/*!
+ \internal
Renames the file called \a oldname to \a newname on the server.
The function does not block and returns immediately. The command
@@ -1976,6 +2011,7 @@ int QFtp::rename(const QString &oldname, const QString &newname)
}
/*!
+ \internal
Sends the raw FTP command \a command to the FTP server. This is
useful for low-level FTP access. If the operation you wish to
perform has an equivalent QFtp function, we recommend using the
@@ -2000,6 +2036,7 @@ int QFtp::rawCommand(const QString &command)
}
/*!
+ \internal
Returns the number of bytes that can be read from the data socket
at the moment.
@@ -2011,6 +2048,7 @@ qint64 QFtp::bytesAvailable() const
}
/*!
+ \internal
Reads \a maxlen bytes from the data socket into \a data and
returns the number of bytes read. Returns -1 if an error occurred.
@@ -2022,6 +2060,7 @@ qint64 QFtp::read(char *data, qint64 maxlen)
}
/*!
+ \internal
Reads all the bytes available from the data socket and returns
them.
@@ -2033,6 +2072,7 @@ QByteArray QFtp::readAll()
}
/*!
+ \internal
Aborts the current command and deletes all scheduled commands.
If there is an unfinished command (i.e. a command for which the
@@ -2071,6 +2111,7 @@ void QFtp::abort()
}
/*!
+ \internal
Returns the identifier of the FTP command that is being executed
or 0 if there is no command being executed.
@@ -2084,6 +2125,7 @@ int QFtp::currentId() const
}
/*!
+ \internal
Returns the command type of the FTP command being executed or \c
None if there is no command being executed.
@@ -2097,6 +2139,7 @@ QFtp::Command QFtp::currentCommand() const
}
/*!
+ \internal
Returns the QIODevice pointer that is used by the FTP command to read data
from or store data to. If there is no current FTP command being executed or
if the command does not use an IO device, this function returns 0.
@@ -2117,6 +2160,7 @@ QIODevice* QFtp::currentDevice() const
}
/*!
+ \internal
Returns true if there are any commands scheduled that have not yet
been executed; otherwise returns false.
@@ -2131,6 +2175,7 @@ bool QFtp::hasPendingCommands() const
}
/*!
+ \internal
Deletes all pending commands from the list of scheduled commands.
This does not affect the command that is being executed. If you
want to stop this as well, use abort().
@@ -2145,6 +2190,7 @@ void QFtp::clearPendingCommands()
}
/*!
+ \internal
Returns the current state of the object. When the state changes,
the stateChanged() signal is emitted.
@@ -2156,6 +2202,7 @@ QFtp::State QFtp::state() const
}
/*!
+ \internal
Returns the last error that occurred. This is useful to find out
what went wrong when receiving a commandFinished() or a done()
signal with the \c error argument set to \c true.
@@ -2168,6 +2215,7 @@ QFtp::Error QFtp::error() const
}
/*!
+ \internal
Returns a human-readable description of the last error that
occurred. This is useful for presenting a error message to the
user when receiving a commandFinished() or a done() signal with
@@ -2385,6 +2433,7 @@ void QFtpPrivate::_q_piFtpReply(int code, const QString &text)
}
/*!
+ \internal
Destructor.
*/
QFtp::~QFtp()
@@ -2397,6 +2446,6 @@ QT_END_NAMESPACE
#include "qftp.moc"
-#include "moc_qftp.cpp"
+#include "moc_qftp_p.cpp"
#endif // QT_NO_FTP
diff --git a/src/network/access/qftp.h b/src/network/access/qftp_p.h
index 671b9ba7c7..0dc6a2006f 100644
--- a/src/network/access/qftp.h
+++ b/src/network/access/qftp_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -39,6 +39,17 @@
**
****************************************************************************/
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the Network Access API. This header file may change from
+// version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
#ifndef QFTP_H
#define QFTP_H
@@ -56,7 +67,7 @@ QT_MODULE(Network)
class QFtpPrivate;
-class Q_NETWORK_EXPORT QFtp : public QObject
+class Q_AUTOTEST_EXPORT QFtp : public QObject
{
Q_OBJECT
diff --git a/src/network/access/qhttp.cpp b/src/network/access/qhttp.cpp
deleted file mode 100644
index f2b24221fe..0000000000
--- a/src/network/access/qhttp.cpp
+++ /dev/null
@@ -1,3150 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//#define QHTTP_DEBUG
-
-#include <qplatformdefs.h>
-#include "qhttp.h"
-
-#ifndef QT_NO_HTTP
-# include "private/qobject_p.h"
-# include "qtcpsocket.h"
-# include "qsslsocket.h"
-# include "qtextstream.h"
-# include "qmap.h"
-# include "qlist.h"
-# include "qstring.h"
-# include "qstringlist.h"
-# include "qbuffer.h"
-# include "private/qringbuffer_p.h"
-# include "qcoreevent.h"
-# include "qurl.h"
-# include "qnetworkproxy.h"
-# include "qauthenticator.h"
-# include "qauthenticator_p.h"
-# include "qdebug.h"
-# include "qtimer.h"
-#endif
-
-#ifndef QT_NO_HTTP
-
-QT_BEGIN_NAMESPACE
-
-class QHttpNormalRequest;
-class QHttpRequest
-{
-public:
- QHttpRequest() : finished(false)
- { id = idCounter.fetchAndAddRelaxed(1); }
- virtual ~QHttpRequest()
- { }
-
- virtual void start(QHttp *) = 0;
- virtual bool hasRequestHeader();
- virtual QHttpRequestHeader requestHeader();
-
- virtual QIODevice *sourceDevice() = 0;
- virtual QIODevice *destinationDevice() = 0;
-
- int id;
- bool finished;
-
-private:
- static QBasicAtomicInt idCounter;
-};
-
-class QHttpPrivate : public QObjectPrivate
-{
-public:
- Q_DECLARE_PUBLIC(QHttp)
-
- inline QHttpPrivate()
- : socket(0), reconnectAttempts(2),
- deleteSocket(0), state(QHttp::Unconnected),
- error(QHttp::NoError), port(0), mode(QHttp::ConnectionModeHttp),
- toDevice(0), postDevice(0), bytesDone(0), chunkedSize(-1),
- repost(false), pendingPost(false)
- {
- }
-
- inline ~QHttpPrivate()
- {
- while (!pending.isEmpty())
- delete pending.takeFirst();
-
- if (deleteSocket)
- delete socket;
- }
-
- // private slots
- void _q_startNextRequest();
- void _q_slotReadyRead();
- void _q_slotConnected();
- void _q_slotError(QAbstractSocket::SocketError);
- void _q_slotClosed();
- void _q_slotBytesWritten(qint64 numBytes);
-#ifndef QT_NO_OPENSSL
- void _q_slotEncryptedBytesWritten(qint64 numBytes);
-#endif
- void _q_slotDoFinished();
- void _q_slotSendRequest();
- void _q_continuePost();
-
- int addRequest(QHttpNormalRequest *);
- int addRequest(QHttpRequest *);
- void finishedWithSuccess();
- void finishedWithError(const QString &detail, int errorCode);
-
- void init();
- void setState(int);
- void closeConn();
- void setSock(QTcpSocket *sock);
-
- void postMoreData();
-
- QTcpSocket *socket;
- int reconnectAttempts;
- bool deleteSocket;
- QList<QHttpRequest *> pending;
-
- QHttp::State state;
- QHttp::Error error;
- QString errorString;
-
- QString hostName;
- quint16 port;
- QHttp::ConnectionMode mode;
-
- QByteArray buffer;
- QIODevice *toDevice;
- QIODevice *postDevice;
-
- qint64 bytesDone;
- qint64 bytesTotal;
- qint64 chunkedSize;
-
- QHttpRequestHeader header;
-
- bool readHeader;
- QString headerStr;
- QHttpResponseHeader response;
-
- QRingBuffer rba;
-
-#ifndef QT_NO_NETWORKPROXY
- QNetworkProxy proxy;
- QAuthenticator proxyAuthenticator;
-#endif
- QAuthenticator authenticator;
- bool repost;
- bool hasFinishedWithError;
- bool pendingPost;
- QTimer post100ContinueTimer;
-};
-
-QBasicAtomicInt QHttpRequest::idCounter = Q_BASIC_ATOMIC_INITIALIZER(1);
-
-bool QHttpRequest::hasRequestHeader()
-{
- return false;
-}
-
-QHttpRequestHeader QHttpRequest::requestHeader()
-{
- return QHttpRequestHeader();
-}
-
-/****************************************************
- *
- * QHttpNormalRequest
- *
- ****************************************************/
-
-class QHttpNormalRequest : public QHttpRequest
-{
-public:
- QHttpNormalRequest(const QHttpRequestHeader &h, QIODevice *d, QIODevice *t) :
- header(h), to(t)
- {
- is_ba = false;
- data.dev = d;
- }
-
- QHttpNormalRequest(const QHttpRequestHeader &h, QByteArray *d, QIODevice *t) :
- header(h), to(t)
- {
- is_ba = true;
- data.ba = d;
- }
-
- ~QHttpNormalRequest()
- {
- if (is_ba)
- delete data.ba;
- }
-
- void start(QHttp *);
- bool hasRequestHeader();
- QHttpRequestHeader requestHeader();
- inline void setRequestHeader(const QHttpRequestHeader &h) { header = h; }
-
- QIODevice *sourceDevice();
- QIODevice *destinationDevice();
-
-protected:
- QHttpRequestHeader header;
-
-private:
- union {
- QByteArray *ba;
- QIODevice *dev;
- } data;
- bool is_ba;
- QIODevice *to;
-};
-
-void QHttpNormalRequest::start(QHttp *http)
-{
- if (!http->d_func()->socket)
- http->d_func()->setSock(0);
- http->d_func()->header = header;
-
- if (is_ba) {
- http->d_func()->buffer = *data.ba;
- if (http->d_func()->buffer.size() >= 0)
- http->d_func()->header.setContentLength(http->d_func()->buffer.size());
-
- http->d_func()->postDevice = 0;
- } else {
- http->d_func()->buffer = QByteArray();
-
- if (data.dev && (data.dev->isOpen() || data.dev->open(QIODevice::ReadOnly))) {
- http->d_func()->postDevice = data.dev;
- if (http->d_func()->postDevice->size() >= 0)
- http->d_func()->header.setContentLength(http->d_func()->postDevice->size());
- } else {
- http->d_func()->postDevice = 0;
- }
- }
-
- if (to && (to->isOpen() || to->open(QIODevice::WriteOnly)))
- http->d_func()->toDevice = to;
- else
- http->d_func()->toDevice = 0;
-
- http->d_func()->reconnectAttempts = 2;
- http->d_func()->_q_slotSendRequest();
-}
-
-bool QHttpNormalRequest::hasRequestHeader()
-{
- return true;
-}
-
-QHttpRequestHeader QHttpNormalRequest::requestHeader()
-{
- return header;
-}
-
-QIODevice *QHttpNormalRequest::sourceDevice()
-{
- if (is_ba)
- return 0;
- return data.dev;
-}
-
-QIODevice *QHttpNormalRequest::destinationDevice()
-{
- return to;
-}
-
-/****************************************************
- *
- * QHttpPGHRequest
- * (like a QHttpNormalRequest, but for the convenience
- * functions put(), get() and head() -- i.e. set the
- * host header field correctly before sending the
- * request)
- *
- ****************************************************/
-
-class QHttpPGHRequest : public QHttpNormalRequest
-{
-public:
- QHttpPGHRequest(const QHttpRequestHeader &h, QIODevice *d, QIODevice *t) :
- QHttpNormalRequest(h, d, t)
- { }
-
- QHttpPGHRequest(const QHttpRequestHeader &h, QByteArray *d, QIODevice *t) :
- QHttpNormalRequest(h, d, t)
- { }
-
- ~QHttpPGHRequest()
- { }
-
- void start(QHttp *);
-};
-
-void QHttpPGHRequest::start(QHttp *http)
-{
- if (http->d_func()->port && http->d_func()->port != 80)
- header.setValue(QLatin1String("Host"), http->d_func()->hostName + QLatin1Char(':') + QString::number(http->d_func()->port));
- else
- header.setValue(QLatin1String("Host"), http->d_func()->hostName);
- QHttpNormalRequest::start(http);
-}
-
-/****************************************************
- *
- * QHttpSetHostRequest
- *
- ****************************************************/
-
-class QHttpSetHostRequest : public QHttpRequest
-{
-public:
- QHttpSetHostRequest(const QString &h, quint16 p, QHttp::ConnectionMode m)
- : hostName(h), port(p), mode(m)
- { }
-
- void start(QHttp *);
-
- QIODevice *sourceDevice()
- { return 0; }
- QIODevice *destinationDevice()
- { return 0; }
-
-private:
- QString hostName;
- quint16 port;
- QHttp::ConnectionMode mode;
-};
-
-void QHttpSetHostRequest::start(QHttp *http)
-{
- http->d_func()->hostName = hostName;
- http->d_func()->port = port;
- http->d_func()->mode = mode;
-
-#ifdef QT_NO_OPENSSL
- if (mode == QHttp::ConnectionModeHttps) {
- // SSL requested but no SSL support compiled in
- http->d_func()->finishedWithError(QLatin1String(QT_TRANSLATE_NOOP("QHttp", "HTTPS connection requested but SSL support not compiled in")),
- QHttp::UnknownError);
- return;
- }
-#endif
-
- http->d_func()->finishedWithSuccess();
-}
-
-/****************************************************
- *
- * QHttpSetUserRequest
- *
- ****************************************************/
-
-class QHttpSetUserRequest : public QHttpRequest
-{
-public:
- QHttpSetUserRequest(const QString &userName, const QString &password) :
- user(userName), pass(password)
- { }
-
- void start(QHttp *);
-
- QIODevice *sourceDevice()
- { return 0; }
- QIODevice *destinationDevice()
- { return 0; }
-
-private:
- QString user;
- QString pass;
-};
-
-void QHttpSetUserRequest::start(QHttp *http)
-{
- http->d_func()->authenticator.setUser(user);
- http->d_func()->authenticator.setPassword(pass);
- http->d_func()->finishedWithSuccess();
-}
-
-#ifndef QT_NO_NETWORKPROXY
-
-/****************************************************
- *
- * QHttpSetProxyRequest
- *
- ****************************************************/
-
-class QHttpSetProxyRequest : public QHttpRequest
-{
-public:
- inline QHttpSetProxyRequest(const QNetworkProxy &proxy)
- {
- this->proxy = proxy;
- }
-
- inline void start(QHttp *http)
- {
- http->d_func()->proxy = proxy;
- QString user = proxy.user();
- if (!user.isEmpty())
- http->d_func()->proxyAuthenticator.setUser(user);
- QString password = proxy.password();
- if (!password.isEmpty())
- http->d_func()->proxyAuthenticator.setPassword(password);
- http->d_func()->finishedWithSuccess();
- }
-
- inline QIODevice *sourceDevice()
- { return 0; }
- inline QIODevice *destinationDevice()
- { return 0; }
-private:
- QNetworkProxy proxy;
-};
-
-#endif // QT_NO_NETWORKPROXY
-
-/****************************************************
- *
- * QHttpSetSocketRequest
- *
- ****************************************************/
-
-class QHttpSetSocketRequest : public QHttpRequest
-{
-public:
- QHttpSetSocketRequest(QTcpSocket *s) : socket(s)
- { }
-
- void start(QHttp *);
-
- QIODevice *sourceDevice()
- { return 0; }
- QIODevice *destinationDevice()
- { return 0; }
-
-private:
- QTcpSocket *socket;
-};
-
-void QHttpSetSocketRequest::start(QHttp *http)
-{
- http->d_func()->setSock(socket);
- http->d_func()->finishedWithSuccess();
-}
-
-/****************************************************
- *
- * QHttpCloseRequest
- *
- ****************************************************/
-
-class QHttpCloseRequest : public QHttpRequest
-{
-public:
- QHttpCloseRequest()
- { }
- void start(QHttp *);
-
- QIODevice *sourceDevice()
- { return 0; }
- QIODevice *destinationDevice()
- { return 0; }
-};
-
-void QHttpCloseRequest::start(QHttp *http)
-{
- http->d_func()->closeConn();
-}
-
-class QHttpHeaderPrivate
-{
- Q_DECLARE_PUBLIC(QHttpHeader)
-public:
- inline virtual ~QHttpHeaderPrivate() {}
-
- QList<QPair<QString, QString> > values;
- bool valid;
- QHttpHeader *q_ptr;
-};
-
-/****************************************************
- *
- * QHttpHeader
- *
- ****************************************************/
-
-/*!
- \class QHttpHeader
- \obsolete
- \brief The QHttpHeader class contains header information for HTTP.
-
- \ingroup network
- \inmodule QtNetwork
-
- In most cases you should use the more specialized derivatives of
- this class, QHttpResponseHeader and QHttpRequestHeader, rather
- than directly using QHttpHeader.
-
- QHttpHeader provides the HTTP header fields. A HTTP header field
- consists of a name followed by a colon, a single space, and the
- field value. (See RFC 1945.) Field names are case-insensitive. A
- typical header field looks like this:
- \snippet doc/src/snippets/code/src_network_access_qhttp.cpp 0
-
- In the API the header field name is called the "key" and the
- content is called the "value". You can get and set a header
- field's value by using its key with value() and setValue(), e.g.
- \snippet doc/src/snippets/code/src_network_access_qhttp.cpp 1
-
- Some fields are so common that getters and setters are provided
- for them as a convenient alternative to using \l value() and
- \l setValue(), e.g. contentLength() and contentType(),
- setContentLength() and setContentType().
-
- Each header key has a \e single value associated with it. If you
- set the value for a key which already exists the previous value
- will be discarded.
-
- \sa QHttpRequestHeader QHttpResponseHeader
-*/
-
-/*!
- \fn int QHttpHeader::majorVersion() const
-
- Returns the major protocol-version of the HTTP header.
-*/
-
-/*!
- \fn int QHttpHeader::minorVersion() const
-
- Returns the minor protocol-version of the HTTP header.
-*/
-
-/*!
- Constructs an empty HTTP header.
-*/
-QHttpHeader::QHttpHeader()
- : d_ptr(new QHttpHeaderPrivate)
-{
- Q_D(QHttpHeader);
- d->q_ptr = this;
- d->valid = true;
-}
-
-/*!
- Constructs a copy of \a header.
-*/
-QHttpHeader::QHttpHeader(const QHttpHeader &header)
- : d_ptr(new QHttpHeaderPrivate)
-{
- Q_D(QHttpHeader);
- d->q_ptr = this;
- d->valid = header.d_func()->valid;
- d->values = header.d_func()->values;
-}
-
-/*!
- Constructs a HTTP header for \a str.
-
- This constructor parses the string \a str for header fields and
- adds this information. The \a str should consist of one or more
- "\r\n" delimited lines; each of these lines should have the format
- key, colon, space, value.
-*/
-QHttpHeader::QHttpHeader(const QString &str)
- : d_ptr(new QHttpHeaderPrivate)
-{
- Q_D(QHttpHeader);
- d->q_ptr = this;
- d->valid = true;
- parse(str);
-}
-
-/*! \internal
- */
-QHttpHeader::QHttpHeader(QHttpHeaderPrivate &dd, const QString &str)
- : d_ptr(&dd)
-{
- Q_D(QHttpHeader);
- d->q_ptr = this;
- d->valid = true;
- if (!str.isEmpty())
- parse(str);
-}
-
-/*! \internal
- */
-QHttpHeader::QHttpHeader(QHttpHeaderPrivate &dd, const QHttpHeader &header)
- : d_ptr(&dd)
-{
- Q_D(QHttpHeader);
- d->q_ptr = this;
- d->valid = header.d_func()->valid;
- d->values = header.d_func()->values;
-}
-/*!
- Destructor.
-*/
-QHttpHeader::~QHttpHeader()
-{
-}
-
-/*!
- Assigns \a h and returns a reference to this http header.
-*/
-QHttpHeader &QHttpHeader::operator=(const QHttpHeader &h)
-{
- Q_D(QHttpHeader);
- d->values = h.d_func()->values;
- d->valid = h.d_func()->valid;
- return *this;
-}
-
-/*!
- Returns true if the HTTP header is valid; otherwise returns false.
-
- A QHttpHeader is invalid if it was created by parsing a malformed string.
-*/
-bool QHttpHeader::isValid() const
-{
- Q_D(const QHttpHeader);
- return d->valid;
-}
-
-/*! \internal
- Parses the HTTP header string \a str for header fields and adds
- the keys/values it finds. If the string is not parsed successfully
- the QHttpHeader becomes \link isValid() invalid\endlink.
-
- Returns true if \a str was successfully parsed; otherwise returns false.
-
- \sa toString()
-*/
-bool QHttpHeader::parse(const QString &str)
-{
- Q_D(QHttpHeader);
- QStringList lst;
- int pos = str.indexOf(QLatin1Char('\n'));
- if (pos > 0 && str.at(pos - 1) == QLatin1Char('\r'))
- lst = str.trimmed().split(QLatin1String("\r\n"));
- else
- lst = str.trimmed().split(QLatin1String("\n"));
- lst.removeAll(QString()); // No empties
-
- if (lst.isEmpty())
- return true;
-
- QStringList lines;
- QStringList::Iterator it = lst.begin();
- for (; it != lst.end(); ++it) {
- if (!(*it).isEmpty()) {
- if ((*it)[0].isSpace()) {
- if (!lines.isEmpty()) {
- lines.last() += QLatin1Char(' ');
- lines.last() += (*it).trimmed();
- }
- } else {
- lines.append((*it));
- }
- }
- }
-
- int number = 0;
- it = lines.begin();
- for (; it != lines.end(); ++it) {
- if (!parseLine(*it, number++)) {
- d->valid = false;
- return false;
- }
- }
- return true;
-}
-
-/*! \internal
-*/
-void QHttpHeader::setValid(bool v)
-{
- Q_D(QHttpHeader);
- d->valid = v;
-}
-
-/*!
- Returns the first value for the entry with the given \a key. If no entry
- has this \a key, an empty string is returned.
-
- \sa setValue() removeValue() hasKey() keys()
-*/
-QString QHttpHeader::value(const QString &key) const
-{
- Q_D(const QHttpHeader);
- QString lowercaseKey = key.toLower();
- QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin();
- while (it != d->values.constEnd()) {
- if ((*it).first.toLower() == lowercaseKey)
- return (*it).second;
- ++it;
- }
- return QString();
-}
-
-/*!
- Returns all the entries with the given \a key. If no entry
- has this \a key, an empty string list is returned.
-*/
-QStringList QHttpHeader::allValues(const QString &key) const
-{
- Q_D(const QHttpHeader);
- QString lowercaseKey = key.toLower();
- QStringList valueList;
- QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin();
- while (it != d->values.constEnd()) {
- if ((*it).first.toLower() == lowercaseKey)
- valueList.append((*it).second);
- ++it;
- }
- return valueList;
-}
-
-/*!
- Returns a list of the keys in the HTTP header.
-
- \sa hasKey()
-*/
-QStringList QHttpHeader::keys() const
-{
- Q_D(const QHttpHeader);
- QStringList keyList;
- QSet<QString> seenKeys;
- QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin();
- while (it != d->values.constEnd()) {
- const QString &key = (*it).first;
- QString lowercaseKey = key.toLower();
- if (!seenKeys.contains(lowercaseKey)) {
- keyList.append(key);
- seenKeys.insert(lowercaseKey);
- }
- ++it;
- }
- return keyList;
-}
-
-/*!
- Returns true if the HTTP header has an entry with the given \a
- key; otherwise returns false.
-
- \sa value() setValue() keys()
-*/
-bool QHttpHeader::hasKey(const QString &key) const
-{
- Q_D(const QHttpHeader);
- QString lowercaseKey = key.toLower();
- QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin();
- while (it != d->values.constEnd()) {
- if ((*it).first.toLower() == lowercaseKey)
- return true;
- ++it;
- }
- return false;
-}
-
-/*!
- Sets the value of the entry with the \a key to \a value.
-
- If no entry with \a key exists, a new entry with the given \a key
- and \a value is created. If an entry with the \a key already
- exists, the first value is discarded and replaced with the given
- \a value.
-
- \sa value() hasKey() removeValue()
-*/
-void QHttpHeader::setValue(const QString &key, const QString &value)
-{
- Q_D(QHttpHeader);
- QString lowercaseKey = key.toLower();
- QList<QPair<QString, QString> >::Iterator it = d->values.begin();
- while (it != d->values.end()) {
- if ((*it).first.toLower() == lowercaseKey) {
- (*it).second = value;
- return;
- }
- ++it;
- }
- // not found so add
- addValue(key, value);
-}
-
-/*!
- Sets the header entries to be the list of key value pairs in \a values.
-*/
-void QHttpHeader::setValues(const QList<QPair<QString, QString> > &values)
-{
- Q_D(QHttpHeader);
- d->values = values;
-}
-
-/*!
- Adds a new entry with the \a key and \a value.
-*/
-void QHttpHeader::addValue(const QString &key, const QString &value)
-{
- Q_D(QHttpHeader);
- d->values.append(qMakePair(key, value));
-}
-
-/*!
- Returns all the entries in the header.
-*/
-QList<QPair<QString, QString> > QHttpHeader::values() const
-{
- Q_D(const QHttpHeader);
- return d->values;
-}
-
-/*!
- Removes the entry with the key \a key from the HTTP header.
-
- \sa value() setValue()
-*/
-void QHttpHeader::removeValue(const QString &key)
-{
- Q_D(QHttpHeader);
- QString lowercaseKey = key.toLower();
- QList<QPair<QString, QString> >::Iterator it = d->values.begin();
- while (it != d->values.end()) {
- if ((*it).first.toLower() == lowercaseKey) {
- d->values.erase(it);
- return;
- }
- ++it;
- }
-}
-
-/*!
- Removes all the entries with the key \a key from the HTTP header.
-*/
-void QHttpHeader::removeAllValues(const QString &key)
-{
- Q_D(QHttpHeader);
- QString lowercaseKey = key.toLower();
- QList<QPair<QString, QString> >::Iterator it = d->values.begin();
- while (it != d->values.end()) {
- if ((*it).first.toLower() == lowercaseKey) {
- it = d->values.erase(it);
- continue;
- }
- ++it;
- }
-}
-
-/*! \internal
- Parses the single HTTP header line \a line which has the format
- key, colon, space, value, and adds key/value to the headers. The
- linenumber is \a number. Returns true if the line was successfully
- parsed and the key/value added; otherwise returns false.
-
- \sa parse()
-*/
-bool QHttpHeader::parseLine(const QString &line, int)
-{
- int i = line.indexOf(QLatin1Char(':'));
- if (i == -1)
- return false;
-
- addValue(line.left(i).trimmed(), line.mid(i + 1).trimmed());
-
- return true;
-}
-
-/*!
- Returns a string representation of the HTTP header.
-
- The string is suitable for use by the constructor that takes a
- QString. It consists of lines with the format: key, colon, space,
- value, "\r\n".
-*/
-QString QHttpHeader::toString() const
-{
- Q_D(const QHttpHeader);
- if (!isValid())
- return QLatin1String("");
-
- QString ret = QLatin1String("");
-
- QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin();
- while (it != d->values.constEnd()) {
- ret += (*it).first + QLatin1String(": ") + (*it).second + QLatin1String("\r\n");
- ++it;
- }
- return ret;
-}
-
-/*!
- Returns true if the header has an entry for the special HTTP
- header field \c content-length; otherwise returns false.
-
- \sa contentLength() setContentLength()
-*/
-bool QHttpHeader::hasContentLength() const
-{
- return hasKey(QLatin1String("content-length"));
-}
-
-/*!
- Returns the value of the special HTTP header field \c
- content-length.
-
- \sa setContentLength() hasContentLength()
-*/
-uint QHttpHeader::contentLength() const
-{
- return value(QLatin1String("content-length")).toUInt();
-}
-
-/*!
- Sets the value of the special HTTP header field \c content-length
- to \a len.
-
- \sa contentLength() hasContentLength()
-*/
-void QHttpHeader::setContentLength(int len)
-{
- setValue(QLatin1String("content-length"), QString::number(len));
-}
-
-/*!
- Returns true if the header has an entry for the special HTTP
- header field \c content-type; otherwise returns false.
-
- \sa contentType() setContentType()
-*/
-bool QHttpHeader::hasContentType() const
-{
- return hasKey(QLatin1String("content-type"));
-}
-
-/*!
- Returns the value of the special HTTP header field \c content-type.
-
- \sa setContentType() hasContentType()
-*/
-QString QHttpHeader::contentType() const
-{
- QString type = value(QLatin1String("content-type"));
- if (type.isEmpty())
- return QString();
-
- int pos = type.indexOf(QLatin1Char(';'));
- if (pos == -1)
- return type;
-
- return type.left(pos).trimmed();
-}
-
-/*!
- Sets the value of the special HTTP header field \c content-type to
- \a type.
-
- \sa contentType() hasContentType()
-*/
-void QHttpHeader::setContentType(const QString &type)
-{
- setValue(QLatin1String("content-type"), type);
-}
-
-class QHttpResponseHeaderPrivate : public QHttpHeaderPrivate
-{
- Q_DECLARE_PUBLIC(QHttpResponseHeader)
-public:
- int statCode;
- QString reasonPhr;
- int majVer;
- int minVer;
-};
-
-/****************************************************
- *
- * QHttpResponseHeader
- *
- ****************************************************/
-
-/*!
- \class QHttpResponseHeader
- \obsolete
- \brief The QHttpResponseHeader class contains response header information for HTTP.
-
- \ingroup network
- \inmodule QtNetwork
-
- This class is used by the QHttp class to report the header
- information that the client received from the server.
-
- HTTP responses have a status code that indicates the status of the
- response. This code is a 3-digit integer result code (for details
- see to RFC 1945). In addition to the status code, you can also
- specify a human-readable text that describes the reason for the
- code ("reason phrase"). This class allows you to get the status
- code and the reason phrase.
-
- \sa QHttpRequestHeader, QHttp, {HTTP Example}
-*/
-
-/*!
- Constructs an empty HTTP response header.
-*/
-QHttpResponseHeader::QHttpResponseHeader()
- : QHttpHeader(*new QHttpResponseHeaderPrivate)
-{
- setValid(false);
-}
-
-/*!
- Constructs a copy of \a header.
-*/
-QHttpResponseHeader::QHttpResponseHeader(const QHttpResponseHeader &header)
- : QHttpHeader(*new QHttpResponseHeaderPrivate, header)
-{
- Q_D(QHttpResponseHeader);
- d->statCode = header.d_func()->statCode;
- d->reasonPhr = header.d_func()->reasonPhr;
- d->majVer = header.d_func()->majVer;
- d->minVer = header.d_func()->minVer;
-}
-
-/*!
- Copies the contents of \a header into this QHttpResponseHeader.
-*/
-QHttpResponseHeader &QHttpResponseHeader::operator=(const QHttpResponseHeader &header)
-{
- Q_D(QHttpResponseHeader);
- QHttpHeader::operator=(header);
- d->statCode = header.d_func()->statCode;
- d->reasonPhr = header.d_func()->reasonPhr;
- d->majVer = header.d_func()->majVer;
- d->minVer = header.d_func()->minVer;
- return *this;
-}
-
-/*!
- Constructs a HTTP response header from the string \a str. The
- string is parsed and the information is set. The \a str should
- consist of one or more "\r\n" delimited lines; the first line should be the
- status-line (format: HTTP-version, space, status-code, space,
- reason-phrase); each of remaining lines should have the format key, colon,
- space, value.
-*/
-QHttpResponseHeader::QHttpResponseHeader(const QString &str)
- : QHttpHeader(*new QHttpResponseHeaderPrivate)
-{
- parse(str);
-}
-
-/*!
- \since 4.1
-
- Constructs a QHttpResponseHeader, setting the status code to \a code, the
- reason phrase to \a text and the protocol-version to \a majorVer and \a
- minorVer.
-
- \sa statusCode() reasonPhrase() majorVersion() minorVersion()
-*/
-QHttpResponseHeader::QHttpResponseHeader(int code, const QString &text, int majorVer, int minorVer)
- : QHttpHeader(*new QHttpResponseHeaderPrivate)
-{
- setStatusLine(code, text, majorVer, minorVer);
-}
-
-/*!
- \since 4.1
-
- Sets the status code to \a code, the reason phrase to \a text and
- the protocol-version to \a majorVer and \a minorVer.
-
- \sa statusCode() reasonPhrase() majorVersion() minorVersion()
-*/
-void QHttpResponseHeader::setStatusLine(int code, const QString &text, int majorVer, int minorVer)
-{
- Q_D(QHttpResponseHeader);
- setValid(true);
- d->statCode = code;
- d->reasonPhr = text;
- d->majVer = majorVer;
- d->minVer = minorVer;
-}
-
-/*!
- Returns the status code of the HTTP response header.
-
- \sa reasonPhrase() majorVersion() minorVersion()
-*/
-int QHttpResponseHeader::statusCode() const
-{
- Q_D(const QHttpResponseHeader);
- return d->statCode;
-}
-
-/*!
- Returns the reason phrase of the HTTP response header.
-
- \sa statusCode() majorVersion() minorVersion()
-*/
-QString QHttpResponseHeader::reasonPhrase() const
-{
- Q_D(const QHttpResponseHeader);
- return d->reasonPhr;
-}
-
-/*!
- Returns the major protocol-version of the HTTP response header.
-
- \sa minorVersion() statusCode() reasonPhrase()
-*/
-int QHttpResponseHeader::majorVersion() const
-{
- Q_D(const QHttpResponseHeader);
- return d->majVer;
-}
-
-/*!
- Returns the minor protocol-version of the HTTP response header.
-
- \sa majorVersion() statusCode() reasonPhrase()
-*/
-int QHttpResponseHeader::minorVersion() const
-{
- Q_D(const QHttpResponseHeader);
- return d->minVer;
-}
-
-/*! \internal
-*/
-bool QHttpResponseHeader::parseLine(const QString &line, int number)
-{
- Q_D(QHttpResponseHeader);
- if (number != 0)
- return QHttpHeader::parseLine(line, number);
-
- QString l = line.simplified();
- if (l.length() < 10)
- return false;
-
- if (l.left(5) == QLatin1String("HTTP/") && l[5].isDigit() && l[6] == QLatin1Char('.') &&
- l[7].isDigit() && l[8] == QLatin1Char(' ') && l[9].isDigit()) {
- d->majVer = l[5].toLatin1() - '0';
- d->minVer = l[7].toLatin1() - '0';
-
- int pos = l.indexOf(QLatin1Char(' '), 9);
- if (pos != -1) {
- d->reasonPhr = l.mid(pos + 1);
- d->statCode = l.mid(9, pos - 9).toInt();
- } else {
- d->statCode = l.mid(9).toInt();
- d->reasonPhr.clear();
- }
- } else {
- return false;
- }
-
- return true;
-}
-
-/*! \reimp
-*/
-QString QHttpResponseHeader::toString() const
-{
- Q_D(const QHttpResponseHeader);
- QString ret(QLatin1String("HTTP/%1.%2 %3 %4\r\n%5\r\n"));
- return ret.arg(d->majVer).arg(d->minVer).arg(d->statCode).arg(d->reasonPhr).arg(QHttpHeader::toString());
-}
-
-class QHttpRequestHeaderPrivate : public QHttpHeaderPrivate
-{
- Q_DECLARE_PUBLIC(QHttpRequestHeader)
-public:
- QString m;
- QString p;
- int majVer;
- int minVer;
-};
-
-/****************************************************
- *
- * QHttpRequestHeader
- *
- ****************************************************/
-
-/*!
- \class QHttpRequestHeader
- \obsolete
- \brief The QHttpRequestHeader class contains request header information for HTTP.
-
- \ingroup network
- \inmodule QtNetwork
-
- This class is used in the QHttp class to report the header
- information if the client requests something from the server.
-
- HTTP requests have a method which describes the request's action.
- The most common requests are "GET" and "POST". In addition to the
- request method the header also includes a request-URI to specify
- the location for the method to use.
-
- The method, request-URI and protocol-version can be set using a
- constructor or later using setRequest(). The values can be
- obtained using method(), path(), majorVersion() and
- minorVersion().
-
- Note that the request-URI must be in the format expected by the
- HTTP server. That is, all reserved characters must be encoded in
- %HH (where HH are two hexadecimal digits). See
- QUrl::toPercentEncoding() for more information.
-
- Important inherited functions: setValue() and value().
-
- \sa QHttpResponseHeader QHttp
-*/
-
-/*!
- Constructs an empty HTTP request header.
-*/
-QHttpRequestHeader::QHttpRequestHeader()
- : QHttpHeader(*new QHttpRequestHeaderPrivate)
-{
- setValid(false);
-}
-
-/*!
- Constructs a HTTP request header for the method \a method, the
- request-URI \a path and the protocol-version \a majorVer and \a
- minorVer. The \a path argument must be properly encoded for an
- HTTP request.
-*/
-QHttpRequestHeader::QHttpRequestHeader(const QString &method, const QString &path, int majorVer, int minorVer)
- : QHttpHeader(*new QHttpRequestHeaderPrivate)
-{
- Q_D(QHttpRequestHeader);
- d->m = method;
- d->p = path;
- d->majVer = majorVer;
- d->minVer = minorVer;
-}
-
-/*!
- Constructs a copy of \a header.
-*/
-QHttpRequestHeader::QHttpRequestHeader(const QHttpRequestHeader &header)
- : QHttpHeader(*new QHttpRequestHeaderPrivate, header)
-{
- Q_D(QHttpRequestHeader);
- d->m = header.d_func()->m;
- d->p = header.d_func()->p;
- d->majVer = header.d_func()->majVer;
- d->minVer = header.d_func()->minVer;
-}
-
-/*!
- Copies the content of \a header into this QHttpRequestHeader
-*/
-QHttpRequestHeader &QHttpRequestHeader::operator=(const QHttpRequestHeader &header)
-{
- Q_D(QHttpRequestHeader);
- QHttpHeader::operator=(header);
- d->m = header.d_func()->m;
- d->p = header.d_func()->p;
- d->majVer = header.d_func()->majVer;
- d->minVer = header.d_func()->minVer;
- return *this;
-}
-
-/*!
- Constructs a HTTP request header from the string \a str. The \a
- str should consist of one or more "\r\n" delimited lines; the first line
- should be the request-line (format: method, space, request-URI, space
- HTTP-version); each of the remaining lines should have the format key,
- colon, space, value.
-*/
-QHttpRequestHeader::QHttpRequestHeader(const QString &str)
- : QHttpHeader(*new QHttpRequestHeaderPrivate)
-{
- parse(str);
-}
-
-/*!
- This function sets the request method to \a method, the
- request-URI to \a path and the protocol-version to \a majorVer and
- \a minorVer. The \a path argument must be properly encoded for an
- HTTP request.
-
- \sa method() path() majorVersion() minorVersion()
-*/
-void QHttpRequestHeader::setRequest(const QString &method, const QString &path, int majorVer, int minorVer)
-{
- Q_D(QHttpRequestHeader);
- setValid(true);
- d->m = method;
- d->p = path;
- d->majVer = majorVer;
- d->minVer = minorVer;
-}
-
-/*!
- Returns the method of the HTTP request header.
-
- \sa path() majorVersion() minorVersion() setRequest()
-*/
-QString QHttpRequestHeader::method() const
-{
- Q_D(const QHttpRequestHeader);
- return d->m;
-}
-
-/*!
- Returns the request-URI of the HTTP request header.
-
- \sa method() majorVersion() minorVersion() setRequest()
-*/
-QString QHttpRequestHeader::path() const
-{
- Q_D(const QHttpRequestHeader);
- return d->p;
-}
-
-/*!
- Returns the major protocol-version of the HTTP request header.
-
- \sa minorVersion() method() path() setRequest()
-*/
-int QHttpRequestHeader::majorVersion() const
-{
- Q_D(const QHttpRequestHeader);
- return d->majVer;
-}
-
-/*!
- Returns the minor protocol-version of the HTTP request header.
-
- \sa majorVersion() method() path() setRequest()
-*/
-int QHttpRequestHeader::minorVersion() const
-{
- Q_D(const QHttpRequestHeader);
- return d->minVer;
-}
-
-/*! \internal
-*/
-bool QHttpRequestHeader::parseLine(const QString &line, int number)
-{
- Q_D(QHttpRequestHeader);
- if (number != 0)
- return QHttpHeader::parseLine(line, number);
-
- QStringList lst = line.simplified().split(QLatin1String(" "));
- if (lst.count() > 0) {
- d->m = lst[0];
- if (lst.count() > 1) {
- d->p = lst[1];
- if (lst.count() > 2) {
- QString v = lst[2];
- if (v.length() >= 8 && v.left(5) == QLatin1String("HTTP/") &&
- v[5].isDigit() && v[6] == QLatin1Char('.') && v[7].isDigit()) {
- d->majVer = v[5].toLatin1() - '0';
- d->minVer = v[7].toLatin1() - '0';
- return true;
- }
- }
- }
- }
-
- return false;
-}
-
-/*! \reimp
-*/
-QString QHttpRequestHeader::toString() const
-{
- Q_D(const QHttpRequestHeader);
- QString first(QLatin1String("%1 %2"));
- QString last(QLatin1String(" HTTP/%3.%4\r\n%5\r\n"));
- return first.arg(d->m).arg(d->p) +
- last.arg(d->majVer).arg(d->minVer).arg(QHttpHeader::toString());
-}
-
-
-/****************************************************
- *
- * QHttp
- *
- ****************************************************/
-/*!
- \class QHttp
- \obsolete
- \reentrant
-
- \brief The QHttp class provides an implementation of the HTTP protocol.
-
- \ingroup network
- \inmodule QtNetwork
-
-
- This class provides a direct interface to HTTP that allows you to
- download and upload data with the HTTP protocol.
- However, for new applications, it is
- recommended to use QNetworkAccessManager and QNetworkReply, as
- those classes possess a simpler, yet more powerful API
- and a more modern protocol implementation.
-
- The class works asynchronously, so there are no blocking
- functions. If an operation cannot be executed immediately, the
- function will still return straight away and the operation will be
- scheduled for later execution. The results of scheduled operations
- are reported via signals. This approach depends on the event loop
- being in operation.
-
- The operations that can be scheduled (they are called "requests"
- in the rest of the documentation) are the following: setHost(),
- get(), post(), head() and request().
-
- All of these requests return a unique identifier that allows you
- to keep track of the request that is currently executed. When the
- execution of a request starts, the requestStarted() signal with
- the identifier is emitted and when the request is finished, the
- requestFinished() signal is emitted with the identifier and a bool
- that indicates if the request finished with an error.
-
- To make an HTTP request you must set up suitable HTTP headers. The
- following example demonstrates how to request the main HTML page
- from the Qt website (i.e., the URL \c http://qt.nokia.com/index.html):
-
- \snippet doc/src/snippets/code/src_network_access_qhttp.cpp 2
-
- For the common HTTP requests \c GET, \c POST and \c HEAD, QHttp
- provides the convenience functions get(), post() and head(). They
- already use a reasonable header and if you don't have to set
- special header fields, they are easier to use. The above example
- can also be written as:
-
- \snippet doc/src/snippets/code/src_network_access_qhttp.cpp 3
-
- For this example the following sequence of signals is emitted
- (with small variations, depending on network traffic, etc.):
-
- \snippet doc/src/snippets/code/src_network_access_qhttp.cpp 4
-
- The dataSendProgress() and dataReadProgress() signals in the above
- example are useful if you want to show a \link QProgressBar
- progress bar\endlink to inform the user about the progress of the
- download. The second argument is the total size of data. In
- certain cases it is not possible to know the total amount in
- advance, in which case the second argument is 0. (If you connect
- to a QProgressBar a total of 0 results in a busy indicator.)
-
- When the response header is read, it is reported with the
- responseHeaderReceived() signal.
-
- The readyRead() signal tells you that there is data ready to be
- read. The amount of data can then be queried with the
- bytesAvailable() function and it can be read with the read()
- or readAll() functions.
-
- If an error occurs during the execution of one of the commands in
- a sequence of commands, all the pending commands (i.e. scheduled,
- but not yet executed commands) are cleared and no signals are
- emitted for them.
-
- For example, if you have the following sequence of requests
-
- \snippet doc/src/snippets/code/src_network_access_qhttp.cpp 5
-
- and the get() request fails because the host lookup fails, then
- the post() request is never executed and the signals would look
- like this:
-
- \snippet doc/src/snippets/code/src_network_access_qhttp.cpp 6
-
- You can then get details about the error with the error() and
- errorString() functions. Note that only unexpected behavior, like
- network failure is considered as an error. If the server response
- contains an error status, like a 404 response, this is reported as
- a normal response case. So you should always check the \link
- QHttpResponseHeader::statusCode() status code \endlink of the
- response header.
-
- The functions currentId() and currentRequest() provide more
- information about the currently executing request.
-
- The functions hasPendingRequests() and clearPendingRequests()
- allow you to query and clear the list of pending requests.
-
- \sa QFtp, QNetworkAccessManager, QNetworkRequest, QNetworkReply,
- {HTTP Example}, {Torrent Example}
-*/
-
-/*!
- Constructs a QHttp object. The \a parent parameter is passed on
- to the QObject constructor.
-*/
-QHttp::QHttp(QObject *parent)
- : QObject(*new QHttpPrivate, parent)
-{
- Q_D(QHttp);
- d->init();
-}
-
-/*!
- Constructs a QHttp object. Subsequent requests are done by
- connecting to the server \a hostName on port \a port.
-
- The \a parent parameter is passed on to the QObject constructor.
-
- \sa setHost()
-*/
-QHttp::QHttp(const QString &hostName, quint16 port, QObject *parent)
- : QObject(*new QHttpPrivate, parent)
-{
- Q_D(QHttp);
- d->init();
-
- d->hostName = hostName;
- d->port = port;
-}
-
-/*!
- Constructs a QHttp object. Subsequent requests are done by
- connecting to the server \a hostName on 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 for Https).
-
- The \a parent parameter is passed on to the QObject constructor.
-
- \sa setHost()
-*/
-QHttp::QHttp(const QString &hostName, ConnectionMode mode, quint16 port, QObject *parent)
- : QObject(*new QHttpPrivate, parent)
-{
- Q_D(QHttp);
- d->init();
-
- d->hostName = hostName;
- if (port == 0)
- port = (mode == ConnectionModeHttp) ? 80 : 443;
- d->port = port;
- d->mode = mode;
-}
-
-void QHttpPrivate::init()
-{
- Q_Q(QHttp);
- errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Unknown error"));
- QMetaObject::invokeMethod(q, "_q_slotDoFinished", Qt::QueuedConnection);
- post100ContinueTimer.setSingleShot(true);
- QObject::connect(&post100ContinueTimer, SIGNAL(timeout()), q, SLOT(_q_continuePost()));
-}
-
-/*!
- Destroys the QHttp object. If there is an open connection, it is
- closed.
-*/
-QHttp::~QHttp()
-{
- abort();
-}
-
-/*!
- \enum QHttp::ConnectionMode
- \since 4.3
-
- 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.
-
- When using the HTTPS mode, care should be taken to connect to the sslErrors signal, and
- handle possible SSL errors.
-
- \sa QSslSocket
-*/
-
-/*!
- \enum QHttp::State
-
- This enum is used to specify the state the client is in:
-
- \value Unconnected There is no connection to the host.
- \value HostLookup A host name lookup is in progress.
- \value Connecting An attempt to connect to the host is in progress.
- \value Sending The client is sending its request to the server.
- \value Reading The client's request has been sent and the client
- is reading the server's response.
- \value Connected The connection to the host is open, but the client is
- neither sending a request, nor waiting for a response.
- \value Closing The connection is closing down, but is not yet
- closed. (The state will be \c Unconnected when the connection is
- closed.)
-
- \sa stateChanged() state()
-*/
-
-/*! \enum QHttp::Error
-
- This enum identifies the error that occurred.
-
- \value NoError No error occurred.
- \value HostNotFound The host name lookup failed.
- \value ConnectionRefused The server refused the connection.
- \value UnexpectedClose The server closed the connection unexpectedly.
- \value InvalidResponseHeader The server sent an invalid response header.
- \value WrongContentLength The client could not read the content correctly
- because an error with respect to the content length occurred.
- \value Aborted The request was aborted with abort().
- \value ProxyAuthenticationRequiredError QHttp is using a proxy, and the
- proxy server requires authentication to establish a connection.
- \value AuthenticationRequiredError The web server requires authentication
- to complete the request.
- \value UnknownError An error other than those specified above
- occurred.
-
- \sa error()
-*/
-
-/*!
- \fn void QHttp::stateChanged(int state)
-
- This signal is emitted when the state of the QHttp object changes.
- The argument \a state is the new state of the connection; it is
- one of the \l State values.
-
- This usually happens when a request is started, but it can also
- happen when the server closes the connection or when a call to
- close() succeeded.
-
- \sa get() post() head() request() close() state() State
-*/
-
-/*!
- \fn void QHttp::responseHeaderReceived(const QHttpResponseHeader &resp);
-
- This signal is emitted when the HTTP header of a server response
- is available. The header is passed in \a resp.
-
- \sa get() post() head() request() readyRead()
-*/
-
-/*!
- \fn void QHttp::readyRead(const QHttpResponseHeader &resp)
-
- This signal is emitted when there is new response data to read.
-
- If you specified a device in the request where the data should be
- written to, then this signal is \e not emitted; instead the data
- is written directly to the device.
-
- The response header is passed in \a resp.
-
- You can read the data with the readAll() or read() functions
-
- This signal is useful if you want to process the data in chunks as
- soon as it becomes available. If you are only interested in the
- complete data, just connect to the requestFinished() signal and
- read the data then instead.
-
- \sa get() post() request() readAll() read() bytesAvailable()
-*/
-
-/*!
- \fn void QHttp::dataSendProgress(int done, int total)
-
- This signal is emitted when this object sends data to a HTTP
- server to inform it about the progress of the upload.
-
- \a done is the amount of data that has already arrived and \a
- total is the total amount of data. It is possible that the total
- amount of data that should be transferred cannot be determined, in
- which case \a total is 0.(If you connect to a QProgressBar, the
- progress bar shows a busy indicator if the total is 0).
-
- \warning \a done and \a total are not necessarily the size in
- bytes, since for large files these values might need to be
- "scaled" to avoid overflow.
-
- \sa dataReadProgress(), post(), request(), QProgressBar
-*/
-
-/*!
- \fn void QHttp::dataReadProgress(int done, int total)
-
- This signal is emitted when this object reads data from a HTTP
- server to indicate the current progress of the download.
-
- \a done is the amount of data that has already arrived and \a
- total is the total amount of data. It is possible that the total
- amount of data that should be transferred cannot be determined, in
- which case \a total is 0.(If you connect to a QProgressBar, the
- progress bar shows a busy indicator if the total is 0).
-
- \warning \a done and \a total are not necessarily the size in
- bytes, since for large files these values might need to be
- "scaled" to avoid overflow.
-
- \sa dataSendProgress() get() post() request() QProgressBar
-*/
-
-/*!
- \fn void QHttp::requestStarted(int id)
-
- This signal is emitted when processing the request identified by
- \a id starts.
-
- \sa requestFinished() done()
-*/
-
-/*!
- \fn void QHttp::requestFinished(int id, bool error)
-
- This signal is emitted when processing the request identified by
- \a id has finished. \a error is true if an error occurred during
- the processing; otherwise \a error is false.
-
- \sa requestStarted() done() error() errorString()
-*/
-
-/*!
- \fn void QHttp::done(bool error)
-
- This signal is emitted when the last pending request has finished;
- (it is emitted after the last request's requestFinished() signal).
- \a error is true if an error occurred during the processing;
- otherwise \a error is false.
-
- \sa requestFinished() error() errorString()
-*/
-
-#ifndef QT_NO_NETWORKPROXY
-
-/*!
- \fn void QHttp::proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator)
- \since 4.3
-
- This signal can be emitted when a \a proxy that requires
- authentication is used. The \a authenticator object can then be
- filled in with the required details to allow authentication and
- continue the connection.
-
- \note It is not possible to use a QueuedConnection to connect to
- this signal, as the connection will fail if the authenticator has
- not been filled in with new information when the signal returns.
-
- \sa QAuthenticator, QNetworkProxy
-*/
-
-#endif
-
-/*!
- \fn void QHttp::authenticationRequired(const QString &hostname, quint16 port, QAuthenticator *authenticator)
- \since 4.3
-
- This signal can be emitted when a web server on a given \a hostname and \a
- port requires authentication. The \a authenticator object can then be
- filled in with the required details to allow authentication and continue
- the connection.
-
- \note It is not possible to use a QueuedConnection to connect to
- this signal, as the connection will fail if the authenticator has
- not been filled in with new information when the signal returns.
-
- \sa QAuthenticator, QNetworkProxy
-*/
-
-/*!
- \fn void QHttp::sslErrors(const QList<QSslError> &errors)
- \since 4.3
-
- Forwards the sslErrors signal from the QSslSocket used in QHttp. \a errors
- is the list of errors that occurred during the SSL handshake. Unless you
- call ignoreSslErrors() from within a slot connected to this signal when an
- error occurs, QHttp will tear down the connection immediately after
- emitting the signal.
-
- \sa QSslSocket QSslSocket::ignoreSslErrors()
-*/
-
-/*!
- Aborts the current request and deletes all scheduled requests.
-
- For the current request, the requestFinished() signal with the \c
- error argument \c true is emitted. For all other requests that are
- affected by the abort(), no signals are emitted.
-
- Since this slot also deletes the scheduled requests, there are no
- requests left and the done() signal is emitted (with the \c error
- argument \c true).
-
- \sa clearPendingRequests()
-*/
-void QHttp::abort()
-{
- Q_D(QHttp);
- if (d->pending.isEmpty())
- return;
-
- d->finishedWithError(tr("Request aborted"), Aborted);
- clearPendingRequests();
- if (d->socket)
- d->socket->abort();
- d->closeConn();
-}
-
-/*!
- Returns the number of bytes that can be read from the response
- content at the moment.
-
- \sa get() post() request() readyRead() read() readAll()
-*/
-qint64 QHttp::bytesAvailable() const
-{
- Q_D(const QHttp);
-#if defined(QHTTP_DEBUG)
- qDebug("QHttp::bytesAvailable(): %d bytes", (int)d->rba.size());
-#endif
- return qint64(d->rba.size());
-}
-
-/*!
- Reads \a maxlen bytes from the response content into \a data and
- returns the number of bytes read. Returns -1 if an error occurred.
-
- \sa get() post() request() readyRead() bytesAvailable() readAll()
-*/
-qint64 QHttp::read(char *data, qint64 maxlen)
-{
- Q_D(QHttp);
- if (data == 0 && maxlen != 0) {
- qWarning("QHttp::read: Null pointer error");
- return -1;
- }
- if (maxlen >= d->rba.size())
- maxlen = d->rba.size();
- int readSoFar = 0;
- while (!d->rba.isEmpty() && readSoFar < maxlen) {
- int nextBlockSize = d->rba.nextDataBlockSize();
- int bytesToRead = qMin<qint64>(maxlen - readSoFar, nextBlockSize);
- memcpy(data + readSoFar, d->rba.readPointer(), bytesToRead);
- d->rba.free(bytesToRead);
- readSoFar += bytesToRead;
- }
-
- d->bytesDone += maxlen;
-#if defined(QHTTP_DEBUG)
- qDebug("QHttp::read(): read %lld bytes (%lld bytes done)", maxlen, d->bytesDone);
-#endif
- return maxlen;
-}
-
-/*!
- Reads all the bytes from the response content and returns them.
-
- \sa get() post() request() readyRead() bytesAvailable() read()
-*/
-QByteArray QHttp::readAll()
-{
- qint64 avail = bytesAvailable();
- QByteArray tmp;
- tmp.resize(int(avail));
- qint64 got = read(tmp.data(), int(avail));
- tmp.resize(got);
- return tmp;
-}
-
-/*!
- Returns the identifier of the HTTP request being executed or 0 if
- there is no request being executed (i.e. they've all finished).
-
- \sa currentRequest()
-*/
-int QHttp::currentId() const
-{
- Q_D(const QHttp);
- if (d->pending.isEmpty())
- return 0;
- return d->pending.first()->id;
-}
-
-/*!
- Returns the request header of the HTTP request being executed. If
- the request is one issued by setHost() or close(), it
- returns an invalid request header, i.e.
- QHttpRequestHeader::isValid() returns false.
-
- \sa currentId()
-*/
-QHttpRequestHeader QHttp::currentRequest() const
-{
- Q_D(const QHttp);
- if (!d->pending.isEmpty()) {
- QHttpRequest *r = d->pending.first();
- if (r->hasRequestHeader())
- return r->requestHeader();
- }
- return QHttpRequestHeader();
-}
-
-/*!
- Returns the received response header of the most recently finished HTTP
- request. If no response has yet been received
- QHttpResponseHeader::isValid() will return false.
-
- \sa currentRequest()
-*/
-QHttpResponseHeader QHttp::lastResponse() const
-{
- Q_D(const QHttp);
- return d->response;
-}
-
-/*!
- Returns the QIODevice pointer that is used as the data source of the HTTP
- request being executed. If there is no current request or if the request
- does not use an IO device as the data source, this function returns 0.
-
- This function can be used to delete the QIODevice in the slot connected to
- the requestFinished() signal.
-
- \sa currentDestinationDevice() post() request()
-*/
-QIODevice *QHttp::currentSourceDevice() const
-{
- Q_D(const QHttp);
- if (d->pending.isEmpty())
- return 0;
- return d->pending.first()->sourceDevice();
-}
-
-/*!
- Returns the QIODevice pointer that is used as to store the data of the HTTP
- request being executed. If there is no current request or if the request
- does not store the data to an IO device, this function returns 0.
-
- This function can be used to delete the QIODevice in the slot connected to
- the requestFinished() signal.
-
- \sa currentSourceDevice() get() post() request()
-*/
-QIODevice *QHttp::currentDestinationDevice() const
-{
- Q_D(const QHttp);
- if (d->pending.isEmpty())
- return 0;
- return d->pending.first()->destinationDevice();
-}
-
-/*!
- Returns true if there are any requests scheduled that have not yet
- been executed; otherwise returns false.
-
- The request that is being executed is \e not considered as a
- scheduled request.
-
- \sa clearPendingRequests() currentId() currentRequest()
-*/
-bool QHttp::hasPendingRequests() const
-{
- Q_D(const QHttp);
- return d->pending.count() > 1;
-}
-
-/*!
- Deletes all pending requests from the list of scheduled requests.
- This does not affect the request that is being executed. If
- you want to stop this as well, use abort().
-
- \sa hasPendingRequests() abort()
-*/
-void QHttp::clearPendingRequests()
-{
- Q_D(QHttp);
- // delete all entires except the first one
- while (d->pending.count() > 1)
- delete d->pending.takeLast();
-}
-
-/*!
- Sets the HTTP server that is used for requests to \a hostName on
- port \a port.
-
- The function does not block; instead, it returns immediately. The request
- is scheduled, and its execution is performed asynchronously. The
- function returns a unique identifier which is passed by
- requestStarted() and requestFinished().
-
- When the request is started the requestStarted() signal is
- emitted. When it is finished the requestFinished() signal is
- emitted.
-
- \sa get() post() head() request() requestStarted() requestFinished() done()
-*/
-int QHttp::setHost(const QString &hostName, quint16 port)
-{
- Q_D(QHttp);
- return d->addRequest(new QHttpSetHostRequest(hostName, port, ConnectionModeHttp));
-}
-
-/*!
- Sets the HTTP server that is used for requests to \a hostName on
- 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 for HTTPS).
-
- The function does not block; instead, it returns immediately. The request
- is scheduled, and its execution is performed asynchronously. The
- function returns a unique identifier which is passed by
- requestStarted() and requestFinished().
-
- When the request is started the requestStarted() signal is
- emitted. When it is finished the requestFinished() signal is
- emitted.
-
- \sa get() post() head() request() requestStarted() requestFinished() done()
-*/
-int QHttp::setHost(const QString &hostName, ConnectionMode mode, quint16 port)
-{
-#ifdef QT_NO_OPENSSL
- if (mode == ConnectionModeHttps)
- qWarning("QHttp::setHost: HTTPS connection requested but SSL support not compiled in");
-#endif
- Q_D(QHttp);
- if (port == 0)
- port = (mode == ConnectionModeHttp) ? 80 : 443;
- return d->addRequest(new QHttpSetHostRequest(hostName, port, mode));
-}
-
-/*!
- Replaces the internal QTcpSocket that QHttp uses with \a
- socket. This is useful if you want to use your own custom QTcpSocket
- subclass instead of the plain QTcpSocket that QHttp uses by default.
- QHttp does not take ownership of the socket, and will not delete \a
- socket when destroyed.
-
- The function does not block; instead, it returns immediately. The request
- is scheduled, and its execution is performed asynchronously. The
- function returns a unique identifier which is passed by
- requestStarted() and requestFinished().
-
- When the request is started the requestStarted() signal is
- emitted. When it is finished the requestFinished() signal is
- emitted.
-
- Note: If QHttp is used in a non-GUI thread that runs its own event
- loop, you must move \a socket to that thread before calling setSocket().
-
- \sa QObject::moveToThread(), {Thread Support in Qt}
-*/
-int QHttp::setSocket(QTcpSocket *socket)
-{
- Q_D(QHttp);
- return d->addRequest(new QHttpSetSocketRequest(socket));
-}
-
-/*!
- This function sets the user name \a userName and password \a
- password for web pages that require authentication.
-
- The function does not block; instead, it returns immediately. The request
- is scheduled, and its execution is performed asynchronously. The
- function returns a unique identifier which is passed by
- requestStarted() and requestFinished().
-
- When the request is started the requestStarted() signal is
- emitted. When it is finished the requestFinished() signal is
- emitted.
-*/
-int QHttp::setUser(const QString &userName, const QString &password)
-{
- Q_D(QHttp);
- return d->addRequest(new QHttpSetUserRequest(userName, password));
-}
-
-#ifndef QT_NO_NETWORKPROXY
-
-/*!
- Enables HTTP proxy support, using the proxy server \a host on port \a
- port. \a username and \a password can be provided if the proxy server
- requires authentication.
-
- Example:
-
- \snippet doc/src/snippets/code/src_network_access_qhttp.cpp 7
-
- QHttp supports non-transparent web proxy servers only, such as the Squid
- Web proxy cache server (from \l http://www.squid.org/). For transparent
- proxying, such as SOCKS5, use QNetworkProxy instead.
-
- \note setProxy() has to be called before setHost() for it to take effect.
- If setProxy() is called after setHost(), then it will not apply until after
- setHost() is called again.
-
- \sa QFtp::setProxy()
-*/
-int QHttp::setProxy(const QString &host, int port,
- const QString &username, const QString &password)
-{
- Q_D(QHttp);
- QNetworkProxy proxy(QNetworkProxy::HttpProxy, host, port, username, password);
- return d->addRequest(new QHttpSetProxyRequest(proxy));
-}
-
-/*!
- \overload
-
- Enables HTTP proxy support using the proxy settings from \a
- proxy. If \a proxy is a transparent proxy, QHttp will call
- QAbstractSocket::setProxy() on the underlying socket. If the type
- is QNetworkProxy::HttpCachingProxy, QHttp will behave like the
- previous function.
-
- \note for compatibility with Qt 4.3, if the proxy type is
- QNetworkProxy::HttpProxy and the request type is unencrypted (that
- is, ConnectionModeHttp), QHttp will treat the proxy as a caching
- proxy.
-*/
-int QHttp::setProxy(const QNetworkProxy &proxy)
-{
- Q_D(QHttp);
- return d->addRequest(new QHttpSetProxyRequest(proxy));
-}
-
-#endif
-
-/*!
- Sends a get request for \a path to the server set by setHost() or
- as specified in the constructor.
-
- \a path must be a absolute path like \c /index.html or an
- absolute URI like \c http://example.com/index.html and
- must be encoded with either QUrl::toPercentEncoding() or
- QUrl::encodedPath().
-
- If the IO device \a to is 0 the readyRead() signal is emitted
- every time new content data is available to read.
-
- If the IO device \a to is not 0, the content data of the response
- is written directly to the device. Make sure that the \a to
- pointer is valid for the duration of the operation (it is safe to
- delete it when the requestFinished() signal is emitted).
-
- \section1 Request Processing
-
- The function does not block; instead, it returns immediately. The request
- is scheduled, and its execution is performed asynchronously. The
- function returns a unique identifier which is passed by
- requestStarted() and requestFinished().
-
- When the request is started the requestStarted() signal is
- emitted. When it is finished the requestFinished() signal is
- emitted.
-
- \sa setHost(), post(), head(), request(), requestStarted(),
- requestFinished(), done()
-*/
-int QHttp::get(const QString &path, QIODevice *to)
-{
- Q_D(QHttp);
- QHttpRequestHeader header(QLatin1String("GET"), path);
- header.setValue(QLatin1String("Connection"), QLatin1String("Keep-Alive"));
- return d->addRequest(new QHttpPGHRequest(header, (QIODevice *) 0, to));
-}
-
-/*!
- Sends a post request for \a path to the server set by setHost() or
- as specified in the constructor.
-
- \a path must be an absolute path like \c /index.html or an
- absolute URI like \c http://example.com/index.html and
- must be encoded with either QUrl::toPercentEncoding() or
- QUrl::encodedPath().
-
- The incoming data comes via the \a data IO device.
-
- If the IO device \a to is 0 the readyRead() signal is emitted
- every time new content data is available to read.
-
- If the IO device \a to is not 0, the content data of the response
- is written directly to the device. Make sure that the \a to
- pointer is valid for the duration of the operation (it is safe to
- delete it when the requestFinished() signal is emitted).
-
- The function does not block; instead, it returns immediately. The request
- is scheduled, and its execution is performed asynchronously. The
- function returns a unique identifier which is passed by
- requestStarted() and requestFinished().
-
- When the request is started the requestStarted() signal is
- emitted. When it is finished the requestFinished() signal is
- emitted.
-
- \sa setHost() get() head() request() requestStarted() requestFinished() done()
-*/
-int QHttp::post(const QString &path, QIODevice *data, QIODevice *to )
-{
- Q_D(QHttp);
- QHttpRequestHeader header(QLatin1String("POST"), path);
- header.setValue(QLatin1String("Connection"), QLatin1String("Keep-Alive"));
- return d->addRequest(new QHttpPGHRequest(header, data, to));
-}
-
-/*!
- \overload
-
- \a data is used as the content data of the HTTP request.
-*/
-int QHttp::post(const QString &path, const QByteArray &data, QIODevice *to)
-{
- Q_D(QHttp);
- QHttpRequestHeader header(QLatin1String("POST"), path);
- header.setValue(QLatin1String("Connection"), QLatin1String("Keep-Alive"));
- return d->addRequest(new QHttpPGHRequest(header, new QByteArray(data), to));
-}
-
-/*!
- Sends a header request for \a path to the server set by setHost()
- or as specified in the constructor.
-
- \a path must be an absolute path like \c /index.html or an
- absolute URI like \c http://example.com/index.html.
-
- The function does not block; instead, it returns immediately. The request
- is scheduled, and its execution is performed asynchronously. The
- function returns a unique identifier which is passed by
- requestStarted() and requestFinished().
-
- When the request is started the requestStarted() signal is
- emitted. When it is finished the requestFinished() signal is
- emitted.
-
- \sa setHost() get() post() request() requestStarted() requestFinished() done()
-*/
-int QHttp::head(const QString &path)
-{
- Q_D(QHttp);
- QHttpRequestHeader header(QLatin1String("HEAD"), path);
- header.setValue(QLatin1String("Connection"), QLatin1String("Keep-Alive"));
- return d->addRequest(new QHttpPGHRequest(header, (QIODevice*)0, 0));
-}
-
-/*!
- Sends a request to the server set by setHost() or as specified in
- the constructor. Uses the \a header as the HTTP request header.
- You are responsible for setting up a header that is appropriate
- for your request.
-
- The incoming data comes via the \a data IO device.
-
- If the IO device \a to is 0 the readyRead() signal is emitted
- every time new content data is available to read.
-
- If the IO device \a to is not 0, the content data of the response
- is written directly to the device. Make sure that the \a to
- pointer is valid for the duration of the operation (it is safe to
- delete it when the requestFinished() signal is emitted).
-
- The function does not block; instead, it returns immediately. The request
- is scheduled, and its execution is performed asynchronously. The
- function returns a unique identifier which is passed by
- requestStarted() and requestFinished().
-
- When the request is started the requestStarted() signal is
- emitted. When it is finished the requestFinished() signal is
- emitted.
-
- \sa setHost() get() post() head() requestStarted() requestFinished() done()
-*/
-int QHttp::request(const QHttpRequestHeader &header, QIODevice *data, QIODevice *to)
-{
- Q_D(QHttp);
- return d->addRequest(new QHttpNormalRequest(header, data, to));
-}
-
-/*!
- \overload
-
- \a data is used as the content data of the HTTP request.
-*/
-int QHttp::request(const QHttpRequestHeader &header, const QByteArray &data, QIODevice *to )
-{
- Q_D(QHttp);
- return d->addRequest(new QHttpNormalRequest(header, new QByteArray(data), to));
-}
-
-/*!
- Closes the connection; this is useful if you have a keep-alive
- connection and want to close it.
-
- For the requests issued with get(), post() and head(), QHttp sets
- the connection to be keep-alive. You can also do this using the
- header you pass to the request() function. QHttp only closes the
- connection to the HTTP server if the response header requires it
- to do so.
-
- The function does not block; instead, it returns immediately. The request
- is scheduled, and its execution is performed asynchronously. The
- function returns a unique identifier which is passed by
- requestStarted() and requestFinished().
-
- When the request is started the requestStarted() signal is
- emitted. When it is finished the requestFinished() signal is
- emitted.
-
- If you want to close the connection immediately, you have to use
- abort() instead.
-
- \sa stateChanged() abort() requestStarted() requestFinished() done()
-*/
-int QHttp::close()
-{
- Q_D(QHttp);
- return d->addRequest(new QHttpCloseRequest());
-}
-
-/*!
- \obsolete
-
- Behaves the same as close().
-*/
-int QHttp::closeConnection()
-{
- Q_D(QHttp);
- return d->addRequest(new QHttpCloseRequest());
-}
-
-int QHttpPrivate::addRequest(QHttpNormalRequest *req)
-{
- QHttpRequestHeader h = req->requestHeader();
- if (h.path().isEmpty()) {
- // note: the following qWarning is autotested. If you change it, change the test too.
- qWarning("QHttp: empty path requested is invalid -- using '/'");
- h.setRequest(h.method(), QLatin1String("/"), h.majorVersion(), h.minorVersion());
- req->setRequestHeader(h);
- }
-
- // contine below
- return addRequest(static_cast<QHttpRequest *>(req));
-}
-
-int QHttpPrivate::addRequest(QHttpRequest *req)
-{
- Q_Q(QHttp);
- pending.append(req);
-
- if (pending.count() == 1) {
- // don't emit the requestStarted() signal before the id is returned
- QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);
- }
- return req->id;
-}
-
-void QHttpPrivate::_q_startNextRequest()
-{
- Q_Q(QHttp);
- if (pending.isEmpty())
- return;
- QHttpRequest *r = pending.first();
-
- error = QHttp::NoError;
- errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Unknown error"));
-
- if (q->bytesAvailable() != 0)
- q->readAll(); // clear the data
- emit q->requestStarted(r->id);
- r->start(q);
-}
-
-void QHttpPrivate::_q_slotSendRequest()
-{
- if (hostName.isNull()) {
- finishedWithError(QLatin1String(QT_TRANSLATE_NOOP("QHttp", "No server set to connect to")),
- QHttp::UnknownError);
- return;
- }
-
- QString connectionHost = hostName;
- int connectionPort = port;
- bool sslInUse = false;
-
-#ifndef QT_NO_OPENSSL
- QSslSocket *sslSocket = qobject_cast<QSslSocket *>(socket);
- if (mode == QHttp::ConnectionModeHttps || (sslSocket && sslSocket->isEncrypted()))
- sslInUse = true;
-#endif
-
-#ifndef QT_NO_NETWORKPROXY
- bool cachingProxyInUse = false;
- bool transparentProxyInUse = false;
- if (proxy.type() == QNetworkProxy::DefaultProxy)
- proxy = QNetworkProxy::applicationProxy();
-
- if (proxy.type() == QNetworkProxy::HttpCachingProxy) {
- if (proxy.hostName().isEmpty())
- proxy.setType(QNetworkProxy::NoProxy);
- else
- cachingProxyInUse = true;
- } else if (proxy.type() == QNetworkProxy::HttpProxy) {
- // Compatibility behaviour: HttpProxy can be used to mean both
- // transparent and caching proxy
- if (proxy.hostName().isEmpty()) {
- proxy.setType(QNetworkProxy::NoProxy);
- } else if (sslInUse) {
- // Disallow use of caching proxy with HTTPS; instead fall back to
- // transparent HTTP CONNECT proxying.
- transparentProxyInUse = true;
- } else {
- proxy.setType(QNetworkProxy::HttpCachingProxy);
- cachingProxyInUse = true;
- }
- }
-
- // Proxy support. Insert the Proxy-Authorization item into the
- // header before it's sent off to the proxy.
- if (cachingProxyInUse) {
- QUrl proxyUrl;
- proxyUrl.setScheme(QLatin1String("http"));
- proxyUrl.setHost(hostName);
- if (port && port != 80)
- proxyUrl.setPort(port);
- QString request = QString::fromAscii(proxyUrl.resolved(QUrl::fromEncoded(header.path().toLatin1())).toEncoded());
-
- header.setRequest(header.method(), request, header.majorVersion(), header.minorVersion());
- header.setValue(QLatin1String("Proxy-Connection"), QLatin1String("keep-alive"));
-
- QAuthenticatorPrivate *auth = QAuthenticatorPrivate::getPrivate(proxyAuthenticator);
- if (auth && auth->method != QAuthenticatorPrivate::None) {
- QByteArray response = auth->calculateResponse(header.method().toLatin1(), header.path().toLatin1());
- header.setValue(QLatin1String("Proxy-Authorization"), QString::fromLatin1(response));
- }
-
- connectionHost = proxy.hostName();
- connectionPort = proxy.port();
- }
-
- if (transparentProxyInUse || sslInUse) {
- socket->setProxy(proxy);
- }
-#endif
-
- // Username support. Insert the user and password into the query
- // string.
- QAuthenticatorPrivate *auth = QAuthenticatorPrivate::getPrivate(authenticator);
- if (auth && auth->method != QAuthenticatorPrivate::None) {
- QByteArray response = auth->calculateResponse(header.method().toLatin1(), header.path().toLatin1());
- header.setValue(QLatin1String("Authorization"), QString::fromLatin1(response));
- }
-
- // Do we need to setup a new connection or can we reuse an
- // existing one?
- if (socket->peerName() != connectionHost || socket->peerPort() != connectionPort
- || socket->state() != QTcpSocket::ConnectedState
-#ifndef QT_NO_OPENSSL
- || (sslSocket && sslSocket->isEncrypted() != (mode == QHttp::ConnectionModeHttps))
-#endif
- ) {
- socket->blockSignals(true);
- socket->abort();
- socket->blockSignals(false);
-
- setState(QHttp::Connecting);
-#ifndef QT_NO_OPENSSL
- if (sslSocket && mode == QHttp::ConnectionModeHttps) {
- sslSocket->connectToHostEncrypted(hostName, port);
- } else
-#endif
- {
- socket->connectToHost(connectionHost, connectionPort);
- }
- } else {
- _q_slotConnected();
- }
-
-}
-
-void QHttpPrivate::finishedWithSuccess()
-{
- Q_Q(QHttp);
- if (pending.isEmpty())
- return;
- QHttpRequest *r = pending.first();
-
- // did we recurse?
- if (r->finished)
- return;
- r->finished = true;
- hasFinishedWithError = false;
-
- emit q->requestFinished(r->id, false);
- if (hasFinishedWithError) {
- // we recursed and changed into an error. The finishedWithError function
- // below has emitted the done(bool) signal and cleared the queue by now.
- return;
- }
-
- pending.removeFirst();
- delete r;
-
- if (pending.isEmpty()) {
- emit q->done(false);
- } else {
- _q_startNextRequest();
- }
-}
-
-void QHttpPrivate::finishedWithError(const QString &detail, int errorCode)
-{
- Q_Q(QHttp);
- if (pending.isEmpty())
- return;
- QHttpRequest *r = pending.first();
- hasFinishedWithError = true;
-
- error = QHttp::Error(errorCode);
- errorString = detail;
-
- // did we recurse?
- if (!r->finished) {
- r->finished = true;
- emit q->requestFinished(r->id, true);
- }
-
- while (!pending.isEmpty())
- delete pending.takeFirst();
- emit q->done(hasFinishedWithError);
-}
-
-void QHttpPrivate::_q_slotClosed()
-{
- Q_Q(QHttp);
-
- if (state == QHttp::Reading) {
- if (response.hasKey(QLatin1String("content-length"))) {
- // We got Content-Length, so did we get all bytes?
- if (bytesDone + q->bytesAvailable() != response.contentLength()) {
- finishedWithError(QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Wrong content length")), QHttp::WrongContentLength);
- }
- }
- } else if (state == QHttp::Connecting || state == QHttp::Sending) {
- finishedWithError(QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Server closed connection unexpectedly")), QHttp::UnexpectedClose);
- }
-
- postDevice = 0;
- if (state != QHttp::Closing)
- setState(QHttp::Closing);
- QMetaObject::invokeMethod(q, "_q_slotDoFinished", Qt::QueuedConnection);
-}
-
-void QHttpPrivate::_q_continuePost()
-{
- if (pendingPost) {
- pendingPost = false;
- setState(QHttp::Sending);
- _q_slotBytesWritten(0);
- }
-}
-
-void QHttpPrivate::_q_slotConnected()
-{
- if (state != QHttp::Sending) {
- bytesDone = 0;
- setState(QHttp::Sending);
- }
-
- QString str = header.toString();
- bytesTotal = str.length();
- socket->write(str.toLatin1(), bytesTotal);
-#if defined(QHTTP_DEBUG)
- qDebug("QHttp: write request header %p:\n---{\n%s}---", &header, str.toLatin1().constData());
-#endif
-
- if (postDevice) {
- postDevice->seek(0); // reposition the device
- bytesTotal += postDevice->size();
- //check for 100-continue
- if (header.value(QLatin1String("expect")).contains(QLatin1String("100-continue"), Qt::CaseInsensitive)) {
- //create a time out for 2 secs.
- pendingPost = true;
- post100ContinueTimer.start(2000);
- }
- } else {
- bytesTotal += buffer.size();
- socket->write(buffer, buffer.size());
- }
-}
-
-void QHttpPrivate::_q_slotError(QAbstractSocket::SocketError err)
-{
- Q_Q(QHttp);
- postDevice = 0;
-
- if (state == QHttp::Connecting || state == QHttp::Reading || state == QHttp::Sending) {
- switch (err) {
- case QTcpSocket::ConnectionRefusedError:
- finishedWithError(QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Connection refused (or timed out)")), QHttp::ConnectionRefused);
- break;
- case QTcpSocket::HostNotFoundError:
- finishedWithError(QString::fromLatin1(QT_TRANSLATE_NOOP("QHttp", "Host %1 not found"))
- .arg(socket->peerName()), QHttp::HostNotFound);
- break;
- case QTcpSocket::RemoteHostClosedError:
- if (state == QHttp::Sending && reconnectAttempts--) {
- setState(QHttp::Closing);
- setState(QHttp::Unconnected);
- socket->blockSignals(true);
- socket->abort();
- socket->blockSignals(false);
- QMetaObject::invokeMethod(q, "_q_slotSendRequest", Qt::QueuedConnection);
- return;
- }
- break;
-#ifndef QT_NO_NETWORKPROXY
- case QTcpSocket::ProxyAuthenticationRequiredError:
- finishedWithError(socket->errorString(), QHttp::ProxyAuthenticationRequiredError);
- break;
-#endif
- default:
- finishedWithError(QLatin1String(QT_TRANSLATE_NOOP("QHttp", "HTTP request failed")), QHttp::UnknownError);
- break;
- }
- }
-
- closeConn();
-}
-
-#ifndef QT_NO_OPENSSL
-void QHttpPrivate::_q_slotEncryptedBytesWritten(qint64 written)
-{
- Q_UNUSED(written);
- postMoreData();
-}
-#endif
-
-void QHttpPrivate::_q_slotBytesWritten(qint64 written)
-{
- Q_Q(QHttp);
- bytesDone += written;
- emit q->dataSendProgress(bytesDone, bytesTotal);
- postMoreData();
-}
-
-// Send the POST data
-void QHttpPrivate::postMoreData()
-{
- if (pendingPost)
- return;
-
- if (!postDevice)
- return;
-
- // the following is backported code from Qt 4.6 QNetworkAccessManager.
- // We also have to check the encryptedBytesToWrite() if it is an SSL socket.
-#ifndef QT_NO_OPENSSL
- QSslSocket *sslSocket = qobject_cast<QSslSocket*>(socket);
- // if it is really an ssl socket, check more than just bytesToWrite()
- if ((socket->bytesToWrite() + (sslSocket ? sslSocket->encryptedBytesToWrite() : 0)) == 0) {
-#else
- if (socket->bytesToWrite() == 0) {
-#endif
- int max = qMin<qint64>(4096, postDevice->size() - postDevice->pos());
- QByteArray arr;
- arr.resize(max);
-
- int n = postDevice->read(arr.data(), max);
- if (n < 0) {
- qWarning("Could not read enough bytes from the device");
- closeConn();
- return;
- }
- if (postDevice->atEnd()) {
- postDevice = 0;
- }
-
- socket->write(arr, n);
- }
-}
-
-void QHttpPrivate::_q_slotReadyRead()
-{
- Q_Q(QHttp);
- QHttp::State oldState = state;
- if (state != QHttp::Reading) {
- setState(QHttp::Reading);
- readHeader = true;
- headerStr = QLatin1String("");
- bytesDone = 0;
- chunkedSize = -1;
- repost = false;
- }
-
- while (readHeader) {
- bool end = false;
- QString tmp;
- while (!end && socket->canReadLine()) {
- tmp = QString::fromAscii(socket->readLine());
- if (tmp == QLatin1String("\r\n") || tmp == QLatin1String("\n") || tmp.isEmpty())
- end = true;
- else
- headerStr += tmp;
- }
-
- if (!end)
- return;
-
- response = QHttpResponseHeader(headerStr);
- headerStr = QLatin1String("");
-#if defined(QHTTP_DEBUG)
- qDebug("QHttp: read response header:\n---{\n%s}---", response.toString().toLatin1().constData());
-#endif
- // Check header
- if (!response.isValid()) {
- finishedWithError(QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Invalid HTTP response header")),
- QHttp::InvalidResponseHeader);
- closeConn();
- return;
- }
-
- int statusCode = response.statusCode();
- if (statusCode == 401 || statusCode == 407) { // (Proxy) Authentication required
- QAuthenticator *auth =
-#ifndef QT_NO_NETWORKPROXY
- statusCode == 407
- ? &proxyAuthenticator :
-#endif
- &authenticator;
- if (auth->isNull())
- auth->detach();
- QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(*auth);
- priv->parseHttpResponse(response, (statusCode == 407));
- if (priv->phase == QAuthenticatorPrivate::Done) {
- socket->blockSignals(true);
-#ifndef QT_NO_NETWORKPROXY
- if (statusCode == 407)
- emit q->proxyAuthenticationRequired(proxy, auth);
- else
-#endif
- emit q->authenticationRequired(hostName, port, auth);
- socket->blockSignals(false);
- } else if (priv->phase == QAuthenticatorPrivate::Invalid) {
- finishedWithError(QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Unknown authentication method")),
- QHttp::AuthenticationRequiredError);
- closeConn();
- return;
- }
-
- // priv->phase will get reset to QAuthenticatorPrivate::Start if the authenticator got modified in the signal above.
- if (priv->phase == QAuthenticatorPrivate::Done) {
-#ifndef QT_NO_NETWORKPROXY
- if (statusCode == 407)
- finishedWithError(QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Proxy authentication required")),
- QHttp::ProxyAuthenticationRequiredError);
- else
-#endif
- finishedWithError(QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Authentication required")),
- QHttp::AuthenticationRequiredError);
- closeConn();
- return;
- } else {
- // close the connection if it isn't already and reconnect using the chosen authentication method
- bool willClose = (response.value(QLatin1String("proxy-connection")).toLower() == QLatin1String("close"))
- || (response.value(QLatin1String("connection")).toLower() == QLatin1String("close"));
- if (willClose) {
- if (socket) {
- setState(QHttp::Closing);
- socket->blockSignals(true);
- socket->close();
- socket->blockSignals(false);
- socket->readAll();
- }
- _q_slotSendRequest();
- return;
- } else {
- repost = true;
- }
- }
- } else {
- buffer.clear();
- }
-
- if (response.statusCode() == 100 && pendingPost) {
- // if we have pending POST, start sending data otherwise ignore
- post100ContinueTimer.stop();
- QMetaObject::invokeMethod(q, "_q_continuePost", Qt::QueuedConnection);
- return;
- }
-
- // The 100-continue header is ignored (in case of no 'expect:100-continue' header),
- // because when using the POST method, we send both the request header and data in
- // one chunk.
- if (response.statusCode() != 100) {
- post100ContinueTimer.stop();
- pendingPost = false;
- readHeader = false;
- if (response.hasKey(QLatin1String("transfer-encoding")) &&
- response.value(QLatin1String("transfer-encoding")).toLower().contains(QLatin1String("chunked")))
- chunkedSize = 0;
-
- if (!repost)
- emit q->responseHeaderReceived(response);
- if (state == QHttp::Unconnected || state == QHttp::Closing)
- return;
- } else {
- // Restore the state, the next incoming data will be treated as if
- // we never say the 100 response.
- state = oldState;
- }
- }
-
- bool everythingRead = false;
-
- if (q->currentRequest().method() == QLatin1String("HEAD") ||
- response.statusCode() == 304 || response.statusCode() == 204 ||
- response.statusCode() == 205) {
- // HEAD requests have only headers as replies
- // These status codes never have a body:
- // 304 Not Modified
- // 204 No Content
- // 205 Reset Content
- everythingRead = true;
- } else {
- qint64 n = socket->bytesAvailable();
- QByteArray *arr = 0;
- if (chunkedSize != -1) {
- // transfer-encoding is chunked
- for (;;) {
- // get chunk size
- if (chunkedSize == 0) {
- if (!socket->canReadLine())
- break;
- QString sizeString = QString::fromAscii(socket->readLine());
- int tPos = sizeString.indexOf(QLatin1Char(';'));
- if (tPos != -1)
- sizeString.truncate(tPos);
- bool ok;
- chunkedSize = sizeString.toInt(&ok, 16);
- if (!ok) {
- finishedWithError(QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Invalid HTTP chunked body")),
- QHttp::WrongContentLength);
- closeConn();
- delete arr;
- return;
- }
- if (chunkedSize == 0) // last-chunk
- chunkedSize = -2;
- }
-
- // read trailer
- while (chunkedSize == -2 && socket->canReadLine()) {
- QString read = QString::fromAscii(socket->readLine());
- if (read == QLatin1String("\r\n") || read == QLatin1String("\n"))
- chunkedSize = -1;
- }
- if (chunkedSize == -1) {
- everythingRead = true;
- break;
- }
-
- // make sure that you can read the terminating CRLF,
- // otherwise wait until next time...
- n = socket->bytesAvailable();
- if (n == 0)
- break;
- if (n == chunkedSize || n == chunkedSize+1) {
- n = chunkedSize - 1;
- if (n == 0)
- break;
- }
-
- // read data
- qint64 toRead = chunkedSize < 0 ? n : qMin(n, chunkedSize);
- if (!arr)
- arr = new QByteArray;
- uint oldArrSize = arr->size();
- arr->resize(oldArrSize + toRead);
- qint64 read = socket->read(arr->data()+oldArrSize, toRead);
- arr->resize(oldArrSize + read);
-
- chunkedSize -= read;
-
- if (chunkedSize == 0 && n - read >= 2) {
- // read terminating CRLF
- char tmp[2];
- socket->read(tmp, 2);
- if (tmp[0] != '\r' || tmp[1] != '\n') {
- finishedWithError(QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Invalid HTTP chunked body")),
- QHttp::WrongContentLength);
- closeConn();
- delete arr;
- return;
- }
- }
- }
- } else if (response.hasContentLength()) {
- if (repost && (n < response.contentLength())) {
- // wait for the content to be available fully
- // if repost is required, the content is ignored
- return;
- }
- n = qMin(qint64(response.contentLength() - bytesDone), n);
- if (n > 0) {
- arr = new QByteArray;
- arr->resize(n);
- qint64 read = socket->read(arr->data(), n);
- arr->resize(read);
- }
- if (bytesDone + q->bytesAvailable() + n == response.contentLength())
- everythingRead = true;
- } else if (n > 0) {
- // workaround for VC++ bug
- QByteArray temp = socket->readAll();
- arr = new QByteArray(temp);
- }
-
- if (arr && !repost) {
- n = arr->size();
- if (toDevice) {
- qint64 bytesWritten;
- bytesWritten = toDevice->write(*arr, n);
- delete arr;
- arr = 0;
- // if writing to the device does not succeed, quit with error
- if (bytesWritten == -1 || bytesWritten < n) {
- finishedWithError(QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Error writing response to device")), QHttp::UnknownError);
- } else {
- bytesDone += bytesWritten;
-#if defined(QHTTP_DEBUG)
- qDebug("QHttp::_q_slotReadyRead(): read %lld bytes (%lld bytes done)", n, bytesDone);
-#endif
- }
- if (response.hasContentLength())
- emit q->dataReadProgress(bytesDone, response.contentLength());
- else
- emit q->dataReadProgress(bytesDone, 0);
- } else {
- char *ptr = rba.reserve(arr->size());
- memcpy(ptr, arr->data(), arr->size());
- delete arr;
- arr = 0;
-#if defined(QHTTP_DEBUG)
- qDebug("QHttp::_q_slotReadyRead(): read %lld bytes (%lld bytes done)", n, bytesDone + q->bytesAvailable());
-#endif
- if (response.hasContentLength())
- emit q->dataReadProgress(bytesDone + q->bytesAvailable(), response.contentLength());
- else
- emit q->dataReadProgress(bytesDone + q->bytesAvailable(), 0);
- emit q->readyRead(response);
- }
- }
-
- delete arr;
- }
-
- if (everythingRead) {
- if (repost) {
- _q_slotSendRequest();
- return;
- }
- // Handle "Connection: close"
- if (response.value(QLatin1String("connection")).toLower() == QLatin1String("close")) {
- closeConn();
- } else {
- setState(QHttp::Connected);
- // Start a timer, so that we emit the keep alive signal
- // "after" this method returned.
- QMetaObject::invokeMethod(q, "_q_slotDoFinished", Qt::QueuedConnection);
- }
- }
-}
-
-void QHttpPrivate::_q_slotDoFinished()
-{
- if (state == QHttp::Connected) {
- finishedWithSuccess();
- } else if (state != QHttp::Unconnected) {
- setState(QHttp::Unconnected);
- finishedWithSuccess();
- }
-}
-
-
-/*!
- Returns the current state of the object. When the state changes,
- the stateChanged() signal is emitted.
-
- \sa State stateChanged()
-*/
-QHttp::State QHttp::state() const
-{
- Q_D(const QHttp);
- return d->state;
-}
-
-/*!
- Returns the last error that occurred. This is useful to find out
- what happened when receiving a requestFinished() or a done()
- signal with the \c error argument \c true.
-
- If you start a new request, the error status is reset to \c NoError.
-*/
-QHttp::Error QHttp::error() const
-{
- Q_D(const QHttp);
- return d->error;
-}
-
-/*!
- Returns a human-readable description of the last error that
- occurred. This is useful to present a error message to the user
- when receiving a requestFinished() or a done() signal with the \c
- error argument \c true.
-*/
-QString QHttp::errorString() const
-{
- Q_D(const QHttp);
- return d->errorString;
-}
-
-void QHttpPrivate::setState(int s)
-{
- Q_Q(QHttp);
-#if defined(QHTTP_DEBUG)
- qDebug("QHttp state changed %d -> %d", state, s);
-#endif
- state = QHttp::State(s);
- emit q->stateChanged(s);
-}
-
-void QHttpPrivate::closeConn()
-{
- Q_Q(QHttp);
- // If no connection is open -> ignore
- if (state == QHttp::Closing || state == QHttp::Unconnected)
- return;
-
- postDevice = 0;
- setState(QHttp::Closing);
-
- // Already closed ?
- if (!socket || !socket->isOpen()) {
- QMetaObject::invokeMethod(q, "_q_slotDoFinished", Qt::QueuedConnection);
- } else {
- // Close now.
- socket->close();
- }
-}
-
-void QHttpPrivate::setSock(QTcpSocket *sock)
-{
- Q_Q(const QHttp);
-
- // disconnect all existing signals
- if (socket)
- socket->disconnect();
- if (deleteSocket)
- delete socket;
-
- // use the new QTcpSocket socket, or create one if socket is 0.
- deleteSocket = (sock == 0);
- socket = sock;
- if (!socket) {
-#ifndef QT_NO_OPENSSL
- if (QSslSocket::supportsSsl())
- socket = new QSslSocket();
- else
-#endif
- socket = new QTcpSocket();
- }
-
- // connect all signals
- QObject::connect(socket, SIGNAL(connected()), q, SLOT(_q_slotConnected()));
- QObject::connect(socket, SIGNAL(disconnected()), q, SLOT(_q_slotClosed()));
- QObject::connect(socket, SIGNAL(readyRead()), q, SLOT(_q_slotReadyRead()));
- QObject::connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), q, SLOT(_q_slotError(QAbstractSocket::SocketError)));
- QObject::connect(socket, SIGNAL(bytesWritten(qint64)),
- q, SLOT(_q_slotBytesWritten(qint64)));
-#ifndef QT_NO_NETWORKPROXY
- QObject::connect(socket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
- q, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
-#endif
-
-#ifndef QT_NO_OPENSSL
- if (qobject_cast<QSslSocket *>(socket)) {
- QObject::connect(socket, SIGNAL(sslErrors(QList<QSslError>)),
- q, SIGNAL(sslErrors(QList<QSslError>)));
- QObject::connect(socket, SIGNAL(encryptedBytesWritten(qint64)),
- q, SLOT(_q_slotEncryptedBytesWritten(qint64)));
- }
-#endif
-}
-
-/*!
- Tells the QSslSocket used for the Http connection to ignore the errors
- reported in the sslErrors() signal.
-
- Note that this function must be called from within a slot connected to the
- sslErrors() signal to have any effect.
-
- \sa QSslSocket QSslSocket::sslErrors()
-*/
-#ifndef QT_NO_OPENSSL
-void QHttp::ignoreSslErrors()
-{
- Q_D(QHttp);
- QSslSocket *sslSocket = qobject_cast<QSslSocket *>(d->socket);
- if (sslSocket)
- sslSocket->ignoreSslErrors();
-}
-#endif
-
-QT_END_NAMESPACE
-
-#include "moc_qhttp.cpp"
-
-#endif
diff --git a/src/network/access/qhttp.h b/src/network/access/qhttp.h
deleted file mode 100644
index 83b23f85f9..0000000000
--- a/src/network/access/qhttp.h
+++ /dev/null
@@ -1,311 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QHTTP_H
-#define QHTTP_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qpair.h>
-#include <QtCore/qscopedpointer.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Network)
-
-#ifndef QT_NO_HTTP
-
-class QTcpSocket;
-class QTimerEvent;
-class QIODevice;
-class QAuthenticator;
-class QNetworkProxy;
-class QSslError;
-
-class QHttpPrivate;
-
-class QHttpHeaderPrivate;
-class Q_NETWORK_EXPORT QHttpHeader
-{
-public:
- QHttpHeader();
- QHttpHeader(const QHttpHeader &header);
- QHttpHeader(const QString &str);
- virtual ~QHttpHeader();
-
- QHttpHeader &operator=(const QHttpHeader &h);
-
- void setValue(const QString &key, const QString &value);
- void setValues(const QList<QPair<QString, QString> > &values);
- void addValue(const QString &key, const QString &value);
- QList<QPair<QString, QString> > values() const;
- bool hasKey(const QString &key) const;
- QStringList keys() const;
- QString value(const QString &key) const;
- QStringList allValues(const QString &key) const;
- void removeValue(const QString &key);
- void removeAllValues(const QString &key);
-
- // ### Qt 5: change to qint64
- bool hasContentLength() const;
- uint contentLength() const;
- void setContentLength(int len);
-
- bool hasContentType() const;
- QString contentType() const;
- void setContentType(const QString &type);
-
- virtual QString toString() const;
- bool isValid() const;
-
- virtual int majorVersion() const = 0;
- virtual int minorVersion() const = 0;
-
-protected:
- virtual bool parseLine(const QString &line, int number);
- bool parse(const QString &str);
- void setValid(bool);
-
- QHttpHeader(QHttpHeaderPrivate &dd, const QString &str = QString());
- QHttpHeader(QHttpHeaderPrivate &dd, const QHttpHeader &header);
- QScopedPointer<QHttpHeaderPrivate> d_ptr;
-
-private:
- Q_DECLARE_PRIVATE(QHttpHeader)
-};
-
-class QHttpResponseHeaderPrivate;
-class Q_NETWORK_EXPORT QHttpResponseHeader : public QHttpHeader
-{
-public:
- QHttpResponseHeader();
- QHttpResponseHeader(const QHttpResponseHeader &header);
- QHttpResponseHeader(const QString &str);
- QHttpResponseHeader(int code, const QString &text = QString(), int majorVer = 1, int minorVer = 1);
- QHttpResponseHeader &operator=(const QHttpResponseHeader &header);
-
- void setStatusLine(int code, const QString &text = QString(), int majorVer = 1, int minorVer = 1);
-
- int statusCode() const;
- QString reasonPhrase() const;
-
- int majorVersion() const;
- int minorVersion() const;
-
- QString toString() const;
-
-protected:
- bool parseLine(const QString &line, int number);
-
-private:
- Q_DECLARE_PRIVATE(QHttpResponseHeader)
- friend class QHttpPrivate;
-};
-
-class QHttpRequestHeaderPrivate;
-class Q_NETWORK_EXPORT QHttpRequestHeader : public QHttpHeader
-{
-public:
- QHttpRequestHeader();
- QHttpRequestHeader(const QString &method, const QString &path, int majorVer = 1, int minorVer = 1);
- QHttpRequestHeader(const QHttpRequestHeader &header);
- QHttpRequestHeader(const QString &str);
- QHttpRequestHeader &operator=(const QHttpRequestHeader &header);
-
- void setRequest(const QString &method, const QString &path, int majorVer = 1, int minorVer = 1);
-
- QString method() const;
- QString path() const;
-
- int majorVersion() const;
- int minorVersion() const;
-
- QString toString() const;
-
-protected:
- bool parseLine(const QString &line, int number);
-
-private:
- Q_DECLARE_PRIVATE(QHttpRequestHeader)
-};
-
-class Q_NETWORK_EXPORT QHttp : public QObject
-{
- Q_OBJECT
-
-public:
- enum ConnectionMode {
- ConnectionModeHttp,
- ConnectionModeHttps
- };
-
- explicit QHttp(QObject *parent = 0);
- QHttp(const QString &hostname, quint16 port = 80, QObject *parent = 0);
- QHttp(const QString &hostname, ConnectionMode mode, quint16 port = 0, QObject *parent = 0);
- virtual ~QHttp();
-
- enum State {
- Unconnected,
- HostLookup,
- Connecting,
- Sending,
- Reading,
- Connected,
- Closing
- };
- enum Error {
- NoError,
- UnknownError,
- HostNotFound,
- ConnectionRefused,
- UnexpectedClose,
- InvalidResponseHeader,
- WrongContentLength,
- Aborted,
- AuthenticationRequiredError,
- ProxyAuthenticationRequiredError
- };
-
- int setHost(const QString &hostname, quint16 port = 80);
- int setHost(const QString &hostname, ConnectionMode mode, quint16 port = 0);
-
- int setSocket(QTcpSocket *socket);
- int setUser(const QString &username, const QString &password = QString());
-
-#ifndef QT_NO_NETWORKPROXY
- int setProxy(const QString &host, int port,
- const QString &username = QString(),
- const QString &password = QString());
- int setProxy(const QNetworkProxy &proxy);
-#endif
-
- int get(const QString &path, QIODevice *to=0);
- int post(const QString &path, QIODevice *data, QIODevice *to=0 );
- int post(const QString &path, const QByteArray &data, QIODevice *to=0);
- int head(const QString &path);
- int request(const QHttpRequestHeader &header, QIODevice *device=0, QIODevice *to=0);
- int request(const QHttpRequestHeader &header, const QByteArray &data, QIODevice *to=0);
-
- int closeConnection();
- int close();
-
- qint64 bytesAvailable() const;
- qint64 read(char *data, qint64 maxlen);
- QByteArray readAll();
-
- int currentId() const;
- QIODevice *currentSourceDevice() const;
- QIODevice *currentDestinationDevice() const;
- QHttpRequestHeader currentRequest() const;
- QHttpResponseHeader lastResponse() const;
- bool hasPendingRequests() const;
- void clearPendingRequests();
-
- State state() const;
-
- Error error() const;
- QString errorString() const;
-
-public Q_SLOTS:
- void abort();
-
-#ifndef QT_NO_OPENSSL
- void ignoreSslErrors();
-#endif
-
-Q_SIGNALS:
- void stateChanged(int);
- void responseHeaderReceived(const QHttpResponseHeader &resp);
- void readyRead(const QHttpResponseHeader &resp);
-
- // ### Qt 5: change to qint64
- void dataSendProgress(int, int);
- void dataReadProgress(int, int);
-
- void requestStarted(int);
- void requestFinished(int, bool);
- void done(bool);
-
-#ifndef QT_NO_NETWORKPROXY
- void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *);
-#endif
- void authenticationRequired(const QString &hostname, quint16 port, QAuthenticator *);
-
-#ifndef QT_NO_OPENSSL
- void sslErrors(const QList<QSslError> &errors);
-#endif
-
-private:
- Q_DISABLE_COPY(QHttp)
- Q_DECLARE_PRIVATE(QHttp)
-
- Q_PRIVATE_SLOT(d_func(), void _q_startNextRequest())
- Q_PRIVATE_SLOT(d_func(), void _q_slotReadyRead())
- Q_PRIVATE_SLOT(d_func(), void _q_slotConnected())
- Q_PRIVATE_SLOT(d_func(), void _q_slotError(QAbstractSocket::SocketError))
- Q_PRIVATE_SLOT(d_func(), void _q_slotClosed())
- Q_PRIVATE_SLOT(d_func(), void _q_slotBytesWritten(qint64 numBytes))
-#ifndef QT_NO_OPENSSL
- Q_PRIVATE_SLOT(d_func(), void _q_slotEncryptedBytesWritten(qint64 numBytes))
-#endif
- Q_PRIVATE_SLOT(d_func(), void _q_slotDoFinished())
- Q_PRIVATE_SLOT(d_func(), void _q_slotSendRequest())
- Q_PRIVATE_SLOT(d_func(), void _q_continuePost())
-
- friend class QHttpNormalRequest;
- friend class QHttpSetHostRequest;
- friend class QHttpSetSocketRequest;
- friend class QHttpSetUserRequest;
- friend class QHttpSetProxyRequest;
- friend class QHttpCloseRequest;
- friend class QHttpPGHRequest;
-};
-
-#endif // QT_NO_HTTP
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QHTTP_H
diff --git a/src/network/access/qhttpheader.cpp b/src/network/access/qhttpheader.cpp
new file mode 100644
index 0000000000..6e87a05c6b
--- /dev/null
+++ b/src/network/access/qhttpheader.cpp
@@ -0,0 +1,770 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//#define QHTTP_DEBUG
+
+#include <qplatformdefs.h>
+#include "qhttpheader_p.h"
+
+#ifndef QT_NO_HTTP
+# include "private/qobject_p.h"
+# include "qtcpsocket.h"
+# include "qsslsocket.h"
+# include "qtextstream.h"
+# include "qmap.h"
+# include "qlist.h"
+# include "qstring.h"
+# include "qstringlist.h"
+# include "qbuffer.h"
+# include "private/qringbuffer_p.h"
+# include "qcoreevent.h"
+# include "qurl.h"
+# include "qnetworkproxy.h"
+# include "qauthenticator.h"
+# include "qauthenticator_p.h"
+# include "qdebug.h"
+# include "qtimer.h"
+#endif
+
+#ifndef QT_NO_HTTP
+
+QT_BEGIN_NAMESPACE
+
+class QHttpHeaderPrivate
+{
+ Q_DECLARE_PUBLIC(QHttpHeader)
+public:
+ inline virtual ~QHttpHeaderPrivate() {}
+
+ QList<QPair<QString, QString> > values;
+ bool valid;
+ QHttpHeader *q_ptr;
+};
+
+/****************************************************
+ *
+ * QHttpHeader
+ *
+ ****************************************************/
+
+/*!
+ \class QHttpHeader
+ \obsolete
+ \brief The QHttpHeader class contains header information for HTTP.
+
+ \ingroup network
+ \inmodule QtNetwork
+
+ In most cases you should use the more specialized derivatives of
+ this class, QHttpResponseHeader and QHttpRequestHeader, rather
+ than directly using QHttpHeader.
+
+ QHttpHeader provides the HTTP header fields. A HTTP header field
+ consists of a name followed by a colon, a single space, and the
+ field value. (See RFC 1945.) Field names are case-insensitive. A
+ typical header field looks like this:
+ \snippet doc/src/snippets/code/src_network_access_qhttp.cpp 0
+
+ In the API the header field name is called the "key" and the
+ content is called the "value". You can get and set a header
+ field's value by using its key with value() and setValue(), e.g.
+ \snippet doc/src/snippets/code/src_network_access_qhttp.cpp 1
+
+ Some fields are so common that getters and setters are provided
+ for them as a convenient alternative to using \l value() and
+ \l setValue(), e.g. contentLength() and contentType(),
+ setContentLength() and setContentType().
+
+ Each header key has a \e single value associated with it. If you
+ set the value for a key which already exists the previous value
+ will be discarded.
+
+ \sa QHttpRequestHeader QHttpResponseHeader
+*/
+
+/*!
+ \fn int QHttpHeader::majorVersion() const
+
+ Returns the major protocol-version of the HTTP header.
+*/
+
+/*!
+ \fn int QHttpHeader::minorVersion() const
+
+ Returns the minor protocol-version of the HTTP header.
+*/
+
+/*!
+ Constructs an empty HTTP header.
+*/
+QHttpHeader::QHttpHeader()
+ : d_ptr(new QHttpHeaderPrivate)
+{
+ Q_D(QHttpHeader);
+ d->q_ptr = this;
+ d->valid = true;
+}
+
+/*!
+ Constructs a copy of \a header.
+*/
+QHttpHeader::QHttpHeader(const QHttpHeader &header)
+ : d_ptr(new QHttpHeaderPrivate)
+{
+ Q_D(QHttpHeader);
+ d->q_ptr = this;
+ d->valid = header.d_func()->valid;
+ d->values = header.d_func()->values;
+}
+
+/*!
+ Constructs a HTTP header for \a str.
+
+ This constructor parses the string \a str for header fields and
+ adds this information. The \a str should consist of one or more
+ "\r\n" delimited lines; each of these lines should have the format
+ key, colon, space, value.
+*/
+QHttpHeader::QHttpHeader(const QString &str)
+ : d_ptr(new QHttpHeaderPrivate)
+{
+ Q_D(QHttpHeader);
+ d->q_ptr = this;
+ d->valid = true;
+ parse(str);
+}
+
+/*! \internal
+ */
+QHttpHeader::QHttpHeader(QHttpHeaderPrivate &dd, const QString &str)
+ : d_ptr(&dd)
+{
+ Q_D(QHttpHeader);
+ d->q_ptr = this;
+ d->valid = true;
+ if (!str.isEmpty())
+ parse(str);
+}
+
+/*! \internal
+ */
+QHttpHeader::QHttpHeader(QHttpHeaderPrivate &dd, const QHttpHeader &header)
+ : d_ptr(&dd)
+{
+ Q_D(QHttpHeader);
+ d->q_ptr = this;
+ d->valid = header.d_func()->valid;
+ d->values = header.d_func()->values;
+}
+/*!
+ Destructor.
+*/
+QHttpHeader::~QHttpHeader()
+{
+}
+
+/*!
+ Assigns \a h and returns a reference to this http header.
+*/
+QHttpHeader &QHttpHeader::operator=(const QHttpHeader &h)
+{
+ Q_D(QHttpHeader);
+ d->values = h.d_func()->values;
+ d->valid = h.d_func()->valid;
+ return *this;
+}
+
+/*!
+ Returns true if the HTTP header is valid; otherwise returns false.
+
+ A QHttpHeader is invalid if it was created by parsing a malformed string.
+*/
+bool QHttpHeader::isValid() const
+{
+ Q_D(const QHttpHeader);
+ return d->valid;
+}
+
+/*! \internal
+ Parses the HTTP header string \a str for header fields and adds
+ the keys/values it finds. If the string is not parsed successfully
+ the QHttpHeader becomes \link isValid() invalid\endlink.
+
+ Returns true if \a str was successfully parsed; otherwise returns false.
+
+ \sa toString()
+*/
+bool QHttpHeader::parse(const QString &str)
+{
+ Q_D(QHttpHeader);
+ QStringList lst;
+ int pos = str.indexOf(QLatin1Char('\n'));
+ if (pos > 0 && str.at(pos - 1) == QLatin1Char('\r'))
+ lst = str.trimmed().split(QLatin1String("\r\n"));
+ else
+ lst = str.trimmed().split(QLatin1String("\n"));
+ lst.removeAll(QString()); // No empties
+
+ if (lst.isEmpty())
+ return true;
+
+ QStringList lines;
+ QStringList::Iterator it = lst.begin();
+ for (; it != lst.end(); ++it) {
+ if (!(*it).isEmpty()) {
+ if ((*it)[0].isSpace()) {
+ if (!lines.isEmpty()) {
+ lines.last() += QLatin1Char(' ');
+ lines.last() += (*it).trimmed();
+ }
+ } else {
+ lines.append((*it));
+ }
+ }
+ }
+
+ int number = 0;
+ it = lines.begin();
+ for (; it != lines.end(); ++it) {
+ if (!parseLine(*it, number++)) {
+ d->valid = false;
+ return false;
+ }
+ }
+ return true;
+}
+
+/*! \internal
+*/
+void QHttpHeader::setValid(bool v)
+{
+ Q_D(QHttpHeader);
+ d->valid = v;
+}
+
+/*!
+ Returns the first value for the entry with the given \a key. If no entry
+ has this \a key, an empty string is returned.
+
+ \sa setValue() removeValue() hasKey() keys()
+*/
+QString QHttpHeader::value(const QString &key) const
+{
+ Q_D(const QHttpHeader);
+ QString lowercaseKey = key.toLower();
+ QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin();
+ while (it != d->values.constEnd()) {
+ if ((*it).first.toLower() == lowercaseKey)
+ return (*it).second;
+ ++it;
+ }
+ return QString();
+}
+
+/*!
+ Returns all the entries with the given \a key. If no entry
+ has this \a key, an empty string list is returned.
+*/
+QStringList QHttpHeader::allValues(const QString &key) const
+{
+ Q_D(const QHttpHeader);
+ QString lowercaseKey = key.toLower();
+ QStringList valueList;
+ QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin();
+ while (it != d->values.constEnd()) {
+ if ((*it).first.toLower() == lowercaseKey)
+ valueList.append((*it).second);
+ ++it;
+ }
+ return valueList;
+}
+
+/*!
+ Returns a list of the keys in the HTTP header.
+
+ \sa hasKey()
+*/
+QStringList QHttpHeader::keys() const
+{
+ Q_D(const QHttpHeader);
+ QStringList keyList;
+ QSet<QString> seenKeys;
+ QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin();
+ while (it != d->values.constEnd()) {
+ const QString &key = (*it).first;
+ QString lowercaseKey = key.toLower();
+ if (!seenKeys.contains(lowercaseKey)) {
+ keyList.append(key);
+ seenKeys.insert(lowercaseKey);
+ }
+ ++it;
+ }
+ return keyList;
+}
+
+/*!
+ Returns true if the HTTP header has an entry with the given \a
+ key; otherwise returns false.
+
+ \sa value() setValue() keys()
+*/
+bool QHttpHeader::hasKey(const QString &key) const
+{
+ Q_D(const QHttpHeader);
+ QString lowercaseKey = key.toLower();
+ QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin();
+ while (it != d->values.constEnd()) {
+ if ((*it).first.toLower() == lowercaseKey)
+ return true;
+ ++it;
+ }
+ return false;
+}
+
+/*!
+ Sets the value of the entry with the \a key to \a value.
+
+ If no entry with \a key exists, a new entry with the given \a key
+ and \a value is created. If an entry with the \a key already
+ exists, the first value is discarded and replaced with the given
+ \a value.
+
+ \sa value() hasKey() removeValue()
+*/
+void QHttpHeader::setValue(const QString &key, const QString &value)
+{
+ Q_D(QHttpHeader);
+ QString lowercaseKey = key.toLower();
+ QList<QPair<QString, QString> >::Iterator it = d->values.begin();
+ while (it != d->values.end()) {
+ if ((*it).first.toLower() == lowercaseKey) {
+ (*it).second = value;
+ return;
+ }
+ ++it;
+ }
+ // not found so add
+ addValue(key, value);
+}
+
+/*!
+ Sets the header entries to be the list of key value pairs in \a values.
+*/
+void QHttpHeader::setValues(const QList<QPair<QString, QString> > &values)
+{
+ Q_D(QHttpHeader);
+ d->values = values;
+}
+
+/*!
+ Adds a new entry with the \a key and \a value.
+*/
+void QHttpHeader::addValue(const QString &key, const QString &value)
+{
+ Q_D(QHttpHeader);
+ d->values.append(qMakePair(key, value));
+}
+
+/*!
+ Returns all the entries in the header.
+*/
+QList<QPair<QString, QString> > QHttpHeader::values() const
+{
+ Q_D(const QHttpHeader);
+ return d->values;
+}
+
+/*!
+ Removes the entry with the key \a key from the HTTP header.
+
+ \sa value() setValue()
+*/
+void QHttpHeader::removeValue(const QString &key)
+{
+ Q_D(QHttpHeader);
+ QString lowercaseKey = key.toLower();
+ QList<QPair<QString, QString> >::Iterator it = d->values.begin();
+ while (it != d->values.end()) {
+ if ((*it).first.toLower() == lowercaseKey) {
+ d->values.erase(it);
+ return;
+ }
+ ++it;
+ }
+}
+
+/*!
+ Removes all the entries with the key \a key from the HTTP header.
+*/
+void QHttpHeader::removeAllValues(const QString &key)
+{
+ Q_D(QHttpHeader);
+ QString lowercaseKey = key.toLower();
+ QList<QPair<QString, QString> >::Iterator it = d->values.begin();
+ while (it != d->values.end()) {
+ if ((*it).first.toLower() == lowercaseKey) {
+ it = d->values.erase(it);
+ continue;
+ }
+ ++it;
+ }
+}
+
+/*! \internal
+ Parses the single HTTP header line \a line which has the format
+ key, colon, space, value, and adds key/value to the headers. The
+ linenumber is \a number. Returns true if the line was successfully
+ parsed and the key/value added; otherwise returns false.
+
+ \sa parse()
+*/
+bool QHttpHeader::parseLine(const QString &line, int)
+{
+ int i = line.indexOf(QLatin1Char(':'));
+ if (i == -1)
+ return false;
+
+ addValue(line.left(i).trimmed(), line.mid(i + 1).trimmed());
+
+ return true;
+}
+
+/*!
+ Returns a string representation of the HTTP header.
+
+ The string is suitable for use by the constructor that takes a
+ QString. It consists of lines with the format: key, colon, space,
+ value, "\r\n".
+*/
+QString QHttpHeader::toString() const
+{
+ Q_D(const QHttpHeader);
+ if (!isValid())
+ return QLatin1String("");
+
+ QString ret = QLatin1String("");
+
+ QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin();
+ while (it != d->values.constEnd()) {
+ ret += (*it).first + QLatin1String(": ") + (*it).second + QLatin1String("\r\n");
+ ++it;
+ }
+ return ret;
+}
+
+/*!
+ Returns true if the header has an entry for the special HTTP
+ header field \c content-length; otherwise returns false.
+
+ \sa contentLength() setContentLength()
+*/
+bool QHttpHeader::hasContentLength() const
+{
+ return hasKey(QLatin1String("content-length"));
+}
+
+/*!
+ Returns the value of the special HTTP header field \c
+ content-length.
+
+ \sa setContentLength() hasContentLength()
+*/
+uint QHttpHeader::contentLength() const
+{
+ return value(QLatin1String("content-length")).toUInt();
+}
+
+/*!
+ Sets the value of the special HTTP header field \c content-length
+ to \a len.
+
+ \sa contentLength() hasContentLength()
+*/
+void QHttpHeader::setContentLength(int len)
+{
+ setValue(QLatin1String("content-length"), QString::number(len));
+}
+
+/*!
+ Returns true if the header has an entry for the special HTTP
+ header field \c content-type; otherwise returns false.
+
+ \sa contentType() setContentType()
+*/
+bool QHttpHeader::hasContentType() const
+{
+ return hasKey(QLatin1String("content-type"));
+}
+
+/*!
+ Returns the value of the special HTTP header field \c content-type.
+
+ \sa setContentType() hasContentType()
+*/
+QString QHttpHeader::contentType() const
+{
+ QString type = value(QLatin1String("content-type"));
+ if (type.isEmpty())
+ return QString();
+
+ int pos = type.indexOf(QLatin1Char(';'));
+ if (pos == -1)
+ return type;
+
+ return type.left(pos).trimmed();
+}
+
+/*!
+ Sets the value of the special HTTP header field \c content-type to
+ \a type.
+
+ \sa contentType() hasContentType()
+*/
+void QHttpHeader::setContentType(const QString &type)
+{
+ setValue(QLatin1String("content-type"), type);
+}
+
+class QHttpResponseHeaderPrivate : public QHttpHeaderPrivate
+{
+ Q_DECLARE_PUBLIC(QHttpResponseHeader)
+public:
+ int statCode;
+ QString reasonPhr;
+ int majVer;
+ int minVer;
+};
+
+/****************************************************
+ *
+ * QHttpResponseHeader
+ *
+ ****************************************************/
+
+/*!
+ \class QHttpResponseHeader
+ \obsolete
+ \brief The QHttpResponseHeader class contains response header information for HTTP.
+
+ \ingroup network
+ \inmodule QtNetwork
+
+ HTTP responses have a status code that indicates the status of the
+ response. This code is a 3-digit integer result code (for details
+ see to RFC 1945). In addition to the status code, you can also
+ specify a human-readable text that describes the reason for the
+ code ("reason phrase"). This class allows you to get the status
+ code and the reason phrase.
+
+ \sa QHttpRequestHeader, {HTTP Example}
+*/
+
+/*!
+ Constructs an empty HTTP response header.
+*/
+QHttpResponseHeader::QHttpResponseHeader()
+ : QHttpHeader(*new QHttpResponseHeaderPrivate)
+{
+ setValid(false);
+}
+
+/*!
+ Constructs a copy of \a header.
+*/
+QHttpResponseHeader::QHttpResponseHeader(const QHttpResponseHeader &header)
+ : QHttpHeader(*new QHttpResponseHeaderPrivate, header)
+{
+ Q_D(QHttpResponseHeader);
+ d->statCode = header.d_func()->statCode;
+ d->reasonPhr = header.d_func()->reasonPhr;
+ d->majVer = header.d_func()->majVer;
+ d->minVer = header.d_func()->minVer;
+}
+
+/*!
+ Copies the contents of \a header into this QHttpResponseHeader.
+*/
+QHttpResponseHeader &QHttpResponseHeader::operator=(const QHttpResponseHeader &header)
+{
+ Q_D(QHttpResponseHeader);
+ QHttpHeader::operator=(header);
+ d->statCode = header.d_func()->statCode;
+ d->reasonPhr = header.d_func()->reasonPhr;
+ d->majVer = header.d_func()->majVer;
+ d->minVer = header.d_func()->minVer;
+ return *this;
+}
+
+/*!
+ Constructs a HTTP response header from the string \a str. The
+ string is parsed and the information is set. The \a str should
+ consist of one or more "\r\n" delimited lines; the first line should be the
+ status-line (format: HTTP-version, space, status-code, space,
+ reason-phrase); each of remaining lines should have the format key, colon,
+ space, value.
+*/
+QHttpResponseHeader::QHttpResponseHeader(const QString &str)
+ : QHttpHeader(*new QHttpResponseHeaderPrivate)
+{
+ parse(str);
+}
+
+/*!
+ \since 4.1
+
+ Constructs a QHttpResponseHeader, setting the status code to \a code, the
+ reason phrase to \a text and the protocol-version to \a majorVer and \a
+ minorVer.
+
+ \sa statusCode() reasonPhrase() majorVersion() minorVersion()
+*/
+QHttpResponseHeader::QHttpResponseHeader(int code, const QString &text, int majorVer, int minorVer)
+ : QHttpHeader(*new QHttpResponseHeaderPrivate)
+{
+ setStatusLine(code, text, majorVer, minorVer);
+}
+
+/*!
+ \since 4.1
+
+ Sets the status code to \a code, the reason phrase to \a text and
+ the protocol-version to \a majorVer and \a minorVer.
+
+ \sa statusCode() reasonPhrase() majorVersion() minorVersion()
+*/
+void QHttpResponseHeader::setStatusLine(int code, const QString &text, int majorVer, int minorVer)
+{
+ Q_D(QHttpResponseHeader);
+ setValid(true);
+ d->statCode = code;
+ d->reasonPhr = text;
+ d->majVer = majorVer;
+ d->minVer = minorVer;
+}
+
+/*!
+ Returns the status code of the HTTP response header.
+
+ \sa reasonPhrase() majorVersion() minorVersion()
+*/
+int QHttpResponseHeader::statusCode() const
+{
+ Q_D(const QHttpResponseHeader);
+ return d->statCode;
+}
+
+/*!
+ Returns the reason phrase of the HTTP response header.
+
+ \sa statusCode() majorVersion() minorVersion()
+*/
+QString QHttpResponseHeader::reasonPhrase() const
+{
+ Q_D(const QHttpResponseHeader);
+ return d->reasonPhr;
+}
+
+/*!
+ Returns the major protocol-version of the HTTP response header.
+
+ \sa minorVersion() statusCode() reasonPhrase()
+*/
+int QHttpResponseHeader::majorVersion() const
+{
+ Q_D(const QHttpResponseHeader);
+ return d->majVer;
+}
+
+/*!
+ Returns the minor protocol-version of the HTTP response header.
+
+ \sa majorVersion() statusCode() reasonPhrase()
+*/
+int QHttpResponseHeader::minorVersion() const
+{
+ Q_D(const QHttpResponseHeader);
+ return d->minVer;
+}
+
+/*! \internal
+*/
+bool QHttpResponseHeader::parseLine(const QString &line, int number)
+{
+ Q_D(QHttpResponseHeader);
+ if (number != 0)
+ return QHttpHeader::parseLine(line, number);
+
+ QString l = line.simplified();
+ if (l.length() < 10)
+ return false;
+
+ if (l.left(5) == QLatin1String("HTTP/") && l[5].isDigit() && l[6] == QLatin1Char('.') &&
+ l[7].isDigit() && l[8] == QLatin1Char(' ') && l[9].isDigit()) {
+ d->majVer = l[5].toLatin1() - '0';
+ d->minVer = l[7].toLatin1() - '0';
+
+ int pos = l.indexOf(QLatin1Char(' '), 9);
+ if (pos != -1) {
+ d->reasonPhr = l.mid(pos + 1);
+ d->statCode = l.mid(9, pos - 9).toInt();
+ } else {
+ d->statCode = l.mid(9).toInt();
+ d->reasonPhr.clear();
+ }
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
+/*! \reimp
+*/
+QString QHttpResponseHeader::toString() const
+{
+ Q_D(const QHttpResponseHeader);
+ QString ret(QLatin1String("HTTP/%1.%2 %3 %4\r\n%5\r\n"));
+ return ret.arg(d->majVer).arg(d->minVer).arg(d->statCode).arg(d->reasonPhr).arg(QHttpHeader::toString());
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/network/access/qhttpheader_p.h b/src/network/access/qhttpheader_p.h
new file mode 100644
index 0000000000..fec7da4f92
--- /dev/null
+++ b/src/network/access/qhttpheader_p.h
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QHTTP_H
+#define QHTTP_H
+
+#include <QtCore/qobject.h>
+#include <QtCore/qstringlist.h>
+#include <QtCore/qmap.h>
+#include <QtCore/qpair.h>
+#include <QtCore/qscopedpointer.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Network)
+
+#ifndef QT_NO_HTTP
+
+#if 0
+#pragma qt_class(QHttp)
+#endif
+
+class QHttpHeaderPrivate;
+class QHttpHeader
+{
+public:
+ QHttpHeader();
+ QHttpHeader(const QHttpHeader &header);
+ QHttpHeader(const QString &str);
+ virtual ~QHttpHeader();
+
+ QHttpHeader &operator=(const QHttpHeader &h);
+
+ void setValue(const QString &key, const QString &value);
+ void setValues(const QList<QPair<QString, QString> > &values);
+ void addValue(const QString &key, const QString &value);
+ QList<QPair<QString, QString> > values() const;
+ bool hasKey(const QString &key) const;
+ QStringList keys() const;
+ QString value(const QString &key) const;
+ QStringList allValues(const QString &key) const;
+ void removeValue(const QString &key);
+ void removeAllValues(const QString &key);
+
+ // ### Qt 5: change to qint64
+ bool hasContentLength() const;
+ uint contentLength() const;
+ void setContentLength(int len);
+
+ bool hasContentType() const;
+ QString contentType() const;
+ void setContentType(const QString &type);
+
+ virtual QString toString() const;
+ bool isValid() const;
+
+ virtual int majorVersion() const = 0;
+ virtual int minorVersion() const = 0;
+
+protected:
+ virtual bool parseLine(const QString &line, int number);
+ bool parse(const QString &str);
+ void setValid(bool);
+
+ QHttpHeader(QHttpHeaderPrivate &dd, const QString &str = QString());
+ QHttpHeader(QHttpHeaderPrivate &dd, const QHttpHeader &header);
+ QScopedPointer<QHttpHeaderPrivate> d_ptr;
+
+private:
+ Q_DECLARE_PRIVATE(QHttpHeader)
+};
+
+class QHttpResponseHeaderPrivate;
+class QHttpResponseHeader : public QHttpHeader
+{
+public:
+ QHttpResponseHeader();
+ QHttpResponseHeader(const QHttpResponseHeader &header);
+ QHttpResponseHeader(const QString &str);
+ QHttpResponseHeader(int code, const QString &text = QString(), int majorVer = 1, int minorVer = 1);
+ QHttpResponseHeader &operator=(const QHttpResponseHeader &header);
+
+ void setStatusLine(int code, const QString &text = QString(), int majorVer = 1, int minorVer = 1);
+
+ int statusCode() const;
+ QString reasonPhrase() const;
+
+ int majorVersion() const;
+ int minorVersion() const;
+
+ QString toString() const;
+
+protected:
+ bool parseLine(const QString &line, int number);
+
+private:
+ Q_DECLARE_PRIVATE(QHttpResponseHeader)
+ friend class QHttpPrivate;
+};
+
+#endif // QT_NO_HTTP
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QHTTP_H
diff --git a/src/network/access/qhttpmultipart.cpp b/src/network/access/qhttpmultipart.cpp
index 75456581f8..6de7a807e4 100644
--- a/src/network/access/qhttpmultipart.cpp
+++ b/src/network/access/qhttpmultipart.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qhttpmultipart.h b/src/network/access/qhttpmultipart.h
index 76e8e14b8a..317b068e3d 100644
--- a/src/network/access/qhttpmultipart.h
+++ b/src/network/access/qhttpmultipart.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qhttpmultipart_p.h b/src/network/access/qhttpmultipart_p.h
index f57b0eb8a2..0ab2fa1d7f 100644
--- a/src/network/access/qhttpmultipart_p.h
+++ b/src/network/access/qhttpmultipart_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index fca3d5999e..104a21f591 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -53,7 +53,6 @@
#include <qbuffer.h>
#include <qpair.h>
-#include <qhttp.h>
#include <qdebug.h>
#ifndef QT_NO_HTTP
@@ -81,7 +80,7 @@ const int QHttpNetworkConnectionPrivate::defaultRePipelineLength = 2;
QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt)
: state(RunningState),
networkLayerState(Unknown),
- hostName(hostName), port(port), encrypt(encrypt),
+ hostName(hostName), port(port), encrypt(encrypt), delayIpv4(true),
channelCount(defaultChannelCount)
#ifndef QT_NO_NETWORKPROXY
, networkProxy(QNetworkProxy::NoProxy)
@@ -92,7 +91,7 @@ QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &host
QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(quint16 channelCount, const QString &hostName, quint16 port, bool encrypt)
: state(RunningState), networkLayerState(Unknown),
- hostName(hostName), port(port), encrypt(encrypt),
+ hostName(hostName), port(port), encrypt(encrypt), delayIpv4(true),
channelCount(channelCount)
#ifndef QT_NO_NETWORKPROXY
, networkProxy(QNetworkProxy::NoProxy)
@@ -116,6 +115,7 @@ QHttpNetworkConnectionPrivate::~QHttpNetworkConnectionPrivate()
void QHttpNetworkConnectionPrivate::init()
{
+ Q_Q(QHttpNetworkConnection);
for (int i = 0; i < channelCount; i++) {
channels[i].setConnection(this->q_func());
channels[i].ssl = encrypt;
@@ -125,6 +125,8 @@ void QHttpNetworkConnectionPrivate::init()
#endif
channels[i].init();
}
+ delayedConnectionTimer.setSingleShot(true);
+ QObject::connect(&delayedConnectionTimer, SIGNAL(timeout()), q, SLOT(_q_connectDelayedChannel()));
}
void QHttpNetworkConnectionPrivate::pauseConnection()
@@ -185,6 +187,12 @@ bool QHttpNetworkConnectionPrivate::shouldEmitChannelError(QAbstractSocket *sock
int i = indexOf(socket);
int otherSocket = (i == 0 ? 1 : 0);
+ // If the IPv4 connection still isn't started we need to start it now.
+ if (delayedConnectionTimer.isActive()) {
+ delayedConnectionTimer.stop();
+ channels[otherSocket].ensureConnection();
+ }
+
if (channelCount == 1) {
if (networkLayerState == QHttpNetworkConnectionPrivate::InProgress)
networkLayerState = QHttpNetworkConnectionPrivate::Unknown;
@@ -419,9 +427,23 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket
if (priv->phase == QAuthenticatorPrivate::Done) {
pauseConnection();
if (!isProxy) {
+ if (channels[i].authenticationCredentialsSent) {
+ auth->detach();
+ priv = QAuthenticatorPrivate::getPrivate(*auth);
+ priv->hasFailed = true;
+ priv->phase = QAuthenticatorPrivate::Done;
+ channels[i].authenticationCredentialsSent = false;
+ }
emit reply->authenticationRequired(reply->request(), auth);
#ifndef QT_NO_NETWORKPROXY
} else {
+ if (channels[i].proxyCredentialsSent) {
+ auth->detach();
+ priv = QAuthenticatorPrivate::getPrivate(*auth);
+ priv->hasFailed = true;
+ priv->phase = QAuthenticatorPrivate::Done;
+ channels[i].proxyCredentialsSent = false;
+ }
emit reply->proxyAuthenticationRequired(networkProxy, auth);
#endif
}
@@ -459,7 +481,6 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket
reply->d_func()->errorString = errorDetail(errorCode, socket);
emit reply->finishedWithError(errorCode, reply->d_func()->errorString);
// ### at this point the reply could be deleted
- socket->close();
return true;
}
//resend the request
@@ -482,6 +503,7 @@ void QHttpNetworkConnectionPrivate::createAuthorization(QAbstractSocket *socket,
if (priv && priv->method != QAuthenticatorPrivate::None) {
QByteArray response = priv->calculateResponse(request.d->methodName(), request.d->uri(false));
request.setHeaderField("Authorization", response);
+ channels[i].authenticationCredentialsSent = true;
}
}
}
@@ -493,6 +515,7 @@ void QHttpNetworkConnectionPrivate::createAuthorization(QAbstractSocket *socket,
if (priv && priv->method != QAuthenticatorPrivate::None) {
QByteArray response = priv->calculateResponse(request.d->methodName(), request.d->uri(false));
request.setHeaderField("Proxy-Authorization", response);
+ channels[i].proxyCredentialsSent = true;
}
}
}
@@ -632,9 +655,13 @@ void QHttpNetworkConnectionPrivate::fillPipeline(QAbstractSocket *socket)
// we do not like authentication stuff
// ### make sure to be OK with this in later releases
- if (!channels[i].authenticator.isNull() || !channels[i].authenticator.user().isEmpty())
+ if (!channels[i].authenticator.isNull()
+ && (!channels[i].authenticator.user().isEmpty()
+ || !channels[i].authenticator.password().isEmpty()))
return;
- if (!channels[i].proxyAuthenticator.isNull() || !channels[i].proxyAuthenticator.user().isEmpty())
+ if (!channels[i].proxyAuthenticator.isNull()
+ && (!channels[i].proxyAuthenticator.user().isEmpty()
+ || !channels[i].proxyAuthenticator.password().isEmpty()))
return;
// must be in ReadingState or WaitingState
@@ -965,12 +992,22 @@ void QHttpNetworkConnectionPrivate::_q_hostLookupFinished(QHostInfo info)
{
bool bIpv4 = false;
bool bIpv6 = false;
+ bool foundAddress = false;
- foreach (QHostAddress address, info.addresses()) {
- if (address.protocol() == QAbstractSocket::IPv4Protocol)
+ foreach (const QHostAddress &address, info.addresses()) {
+ if (address.protocol() == QAbstractSocket::IPv4Protocol) {
+ if (!foundAddress) {
+ foundAddress = true;
+ delayIpv4 = false;
+ }
bIpv4 = true;
- else if (address.protocol() == QAbstractSocket::IPv6Protocol)
+ } else if (address.protocol() == QAbstractSocket::IPv6Protocol) {
+ if (!foundAddress) {
+ foundAddress = true;
+ delayIpv4 = true;
+ }
bIpv6 = true;
+ }
}
if (bIpv4 && bIpv6)
@@ -1010,8 +1047,24 @@ void QHttpNetworkConnectionPrivate::startNetworkLayerStateLookup()
channels[0].networkLayerPreference = QAbstractSocket::IPv4Protocol;
channels[1].networkLayerPreference = QAbstractSocket::IPv6Protocol;
- channels[0].ensureConnection(); // Possibly delay this one..
- channels[1].ensureConnection();
+ int timeout = 300;
+#ifndef QT_NO_BEARERMANAGEMENT
+ if (networkSession) {
+ if (networkSession->configuration().bearerType() == QNetworkConfiguration::Bearer2G)
+ timeout = 800;
+ else if (networkSession->configuration().bearerType() == QNetworkConfiguration::BearerCDMA2000)
+ timeout = 500;
+ else if (networkSession->configuration().bearerType() == QNetworkConfiguration::BearerWCDMA)
+ timeout = 500;
+ else if (networkSession->configuration().bearerType() == QNetworkConfiguration::BearerHSPA)
+ timeout = 400;
+ }
+#endif
+ delayedConnectionTimer.start(timeout);
+ if (delayIpv4)
+ channels[1].ensureConnection();
+ else
+ channels[0].ensureConnection();
} else {
networkLayerState = InProgress;
channels[0].networkLayerPreference = QAbstractSocket::AnyIPProtocol;
@@ -1019,6 +1072,13 @@ void QHttpNetworkConnectionPrivate::startNetworkLayerStateLookup()
}
}
+void QHttpNetworkConnectionPrivate::_q_connectDelayedChannel()
+{
+ if (delayIpv4)
+ channels[0].ensureConnection();
+ else
+ channels[1].ensureConnection();
+}
#ifndef QT_NO_BEARERMANAGEMENT
QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16 port, bool encrypt, QObject *parent, QSharedPointer<QNetworkSession> networkSession)
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index 70b9cf3754..8ce9bf24fe 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -61,6 +61,7 @@
#include <qauthenticator.h>
#include <qnetworkproxy.h>
#include <qbuffer.h>
+#include <qtimer.h>
#include <private/qhttpnetworkheader_p.h>
#include <private/qhttpnetworkrequest_p.h>
@@ -134,6 +135,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_startNextRequest())
Q_PRIVATE_SLOT(d_func(), void _q_hostLookupFinished(QHostInfo))
+ Q_PRIVATE_SLOT(d_func(), void _q_connectDelayedChannel())
};
@@ -196,6 +198,7 @@ public:
void _q_startNextRequest(); // send the next request from the queue
void _q_hostLookupFinished(QHostInfo info);
+ void _q_connectDelayedChannel();
void createAuthorization(QAbstractSocket *socket, QHttpNetworkRequest &request);
@@ -207,8 +210,10 @@ public:
QString hostName;
quint16 port;
bool encrypt;
+ bool delayIpv4;
const int channelCount;
+ QTimer delayedConnectionTimer;
QHttpNetworkConnectionChannel *channels; // parallel connections to the server
bool shouldEmitChannelError(QAbstractSocket *socket);
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 072648cf62..3acfe54ef7 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -75,6 +75,8 @@ QHttpNetworkConnectionChannel::QHttpNetworkConnectionChannel()
, reconnectAttempts(2)
, authMethod(QAuthenticatorPrivate::None)
, proxyAuthMethod(QAuthenticatorPrivate::None)
+ , authenticationCredentialsSent(false)
+ , proxyCredentialsSent(false)
#ifndef QT_NO_OPENSSL
, ignoreAllSslErrors(false)
#endif
@@ -549,6 +551,14 @@ bool QHttpNetworkConnectionChannel::ensureConnection()
// reset state
pipeliningSupported = PipeliningSupportUnknown;
+ authenticationCredentialsSent = false;
+ proxyCredentialsSent = false;
+ authenticator.detach();
+ QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(authenticator);
+ priv->hasFailed = false;
+ proxyAuthenticator.detach();
+ priv = QAuthenticatorPrivate::getPrivate(proxyAuthenticator);
+ priv->hasFailed = false;
// This workaround is needed since we use QAuthenticator for NTLM authentication. The "phase == Done"
// is the usual criteria for emitting authentication signals. The "phase" is set to "Done" when the
@@ -556,7 +566,7 @@ bool QHttpNetworkConnectionChannel::ensureConnection()
// check the "phase" for generating the Authorization header. NTLM authentication is a two stage
// process & needs the "phase". To make sure the QAuthenticator uses the current username/password
// the phase is reset to Start.
- QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(authenticator);
+ priv = QAuthenticatorPrivate::getPrivate(authenticator);
if (priv && priv->phase == QAuthenticatorPrivate::Done)
priv->phase = QAuthenticatorPrivate::Start;
priv = QAuthenticatorPrivate::getPrivate(proxyAuthenticator);
@@ -580,8 +590,11 @@ bool QHttpNetworkConnectionChannel::ensureConnection()
value = connection->d_func()->predictNextRequest().headerField("user-agent");
else
value = request.headerField("user-agent");
- if (!value.isEmpty())
- socket->proxy().setRawHeader("User-Agent", value);
+ if (!value.isEmpty()) {
+ QNetworkProxy proxy(socket->proxy());
+ proxy.setRawHeader("User-Agent", value); //detaches
+ socket->setProxy(proxy);
+ }
}
#endif
if (ssl) {
@@ -780,6 +793,9 @@ void QHttpNetworkConnectionChannel::handleStatus()
closeAndResendCurrentRequest();
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
}
+ } else {
+ //authentication cancelled, close the channel.
+ close();
}
} else {
emit reply->headerChanged();
@@ -951,6 +967,8 @@ void QHttpNetworkConnectionChannel::_q_connected()
// For the Happy Eyeballs we need to check if this is the first channel to connect.
if (!pendingEncrypt) {
if (connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::InProgress) {
+ if (connection->d_func()->delayedConnectionTimer.isActive())
+ connection->d_func()->delayedConnectionTimer.stop();
if (networkLayerPreference == QAbstractSocket::IPv4Protocol)
connection->d_func()->networkLayerState = QHttpNetworkConnectionPrivate::IPv4;
else if (networkLayerPreference == QAbstractSocket::IPv6Protocol)
diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h
index 7a4dd07db1..d5a0925f7d 100644
--- a/src/network/access/qhttpnetworkconnectionchannel_p.h
+++ b/src/network/access/qhttpnetworkconnectionchannel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -113,6 +113,8 @@ public:
QAuthenticatorPrivate::Method proxyAuthMethod;
QAuthenticator authenticator;
QAuthenticator proxyAuthenticator;
+ bool authenticationCredentialsSent;
+ bool proxyCredentialsSent;
#ifndef QT_NO_OPENSSL
bool ignoreAllSslErrors;
QList<QSslError> ignoreSslErrorsList;
diff --git a/src/network/access/qhttpnetworkheader.cpp b/src/network/access/qhttpnetworkheader.cpp
index 1d457b90a7..531afe92e0 100644
--- a/src/network/access/qhttpnetworkheader.cpp
+++ b/src/network/access/qhttpnetworkheader.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qhttpnetworkheader_p.h b/src/network/access/qhttpnetworkheader_p.h
index 38db0506b9..00393b5e92 100644
--- a/src/network/access/qhttpnetworkheader_p.h
+++ b/src/network/access/qhttpnetworkheader_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index e6d0d3238c..a9ba5d2b24 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index a6bf3fcc8e..1bb0832d19 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp
index cbc0d97e12..e39faaeaa8 100644
--- a/src/network/access/qhttpnetworkrequest.cpp
+++ b/src/network/access/qhttpnetworkrequest.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qhttpnetworkrequest_p.h b/src/network/access/qhttpnetworkrequest_p.h
index 4000ecad87..71e09eba06 100644
--- a/src/network/access/qhttpnetworkrequest_p.h
+++ b/src/network/access/qhttpnetworkrequest_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp
index f0755337fc..39a7e8ed08 100644
--- a/src/network/access/qhttpthreaddelegate.cpp
+++ b/src/network/access/qhttpthreaddelegate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -364,7 +364,7 @@ void QHttpThreadDelegate::readyReadSlot()
void QHttpThreadDelegate::finishedSlot()
{
if (!httpReply) {
- qWarning() << "QHttpThreadDelegate::finishedSlot: HTTP reply had already been deleted, internal problem. Please report.";
+ qWarning("QHttpThreadDelegate::finishedSlot: HTTP reply had already been deleted, internal problem. Please report.");
return;
}
#ifdef QHTTPTHREADDELEGATE_DEBUG
@@ -420,7 +420,7 @@ void QHttpThreadDelegate::synchronousFinishedSlot()
void QHttpThreadDelegate::finishedWithErrorSlot(QNetworkReply::NetworkError errorCode, const QString &detail)
{
if (!httpReply) {
- qWarning() << "QHttpThreadDelegate::finishedWithErrorSlot: HTTP reply had already been deleted, internal problem. Please report.";
+ qWarning("QHttpThreadDelegate::finishedWithErrorSlot: HTTP reply had already been deleted, internal problem. Please report.");
return;
}
#ifdef QHTTPTHREADDELEGATE_DEBUG
diff --git a/src/network/access/qhttpthreaddelegate_p.h b/src/network/access/qhttpthreaddelegate_p.h
index d97193d7c7..366d3bcc60 100644
--- a/src/network/access/qhttpthreaddelegate_p.h
+++ b/src/network/access/qhttpthreaddelegate_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkaccessauthenticationmanager.cpp b/src/network/access/qnetworkaccessauthenticationmanager.cpp
index 1b15cf9cdf..30e3174f25 100644
--- a/src/network/access/qnetworkaccessauthenticationmanager.cpp
+++ b/src/network/access/qnetworkaccessauthenticationmanager.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -159,6 +159,11 @@ void QNetworkAccessAuthenticationManager::cacheProxyCredentials(const QNetworkPr
QString realm = authenticator->realm();
QNetworkProxy proxy = p;
proxy.setUser(authenticator->user());
+
+ // don't cache null passwords, empty password may be valid though
+ if (authenticator->password().isNull())
+ return;
+
// Set two credentials: one with the username and one without
do {
// Set two credentials actually: one with and one without the realm
@@ -283,9 +288,12 @@ QNetworkAccessAuthenticationManager::fetchCachedCredentials(const QUrl &url,
QNetworkAuthenticationCache *auth =
static_cast<QNetworkAuthenticationCache *>(authenticationCache.requestEntryNow(cacheKey));
- QNetworkAuthenticationCredential cred = *auth->findClosestMatch(url.path());
+ QNetworkAuthenticationCredential *cred = auth->findClosestMatch(url.path());
+ QNetworkAuthenticationCredential ret;
+ if (cred)
+ ret = *cred;
authenticationCache.releaseEntry(cacheKey);
- return cred;
+ return ret;
}
void QNetworkAccessAuthenticationManager::clearCache()
diff --git a/src/network/access/qnetworkaccessauthenticationmanager_p.h b/src/network/access/qnetworkaccessauthenticationmanager_p.h
index ddfc11606d..7e7be8ca8a 100644
--- a/src/network/access/qnetworkaccessauthenticationmanager_p.h
+++ b/src/network/access/qnetworkaccessauthenticationmanager_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -73,7 +73,7 @@ public:
QString user;
QString password;
bool isNull() {
- return domain.isNull();
+ return domain.isNull() && user.isNull() && password.isNull();
}
};
Q_DECLARE_TYPEINFO(QNetworkAuthenticationCredential, Q_MOVABLE_TYPE);
diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp
index 8dfcb33282..6647c58f8d 100644
--- a/src/network/access/qnetworkaccessbackend.cpp
+++ b/src/network/access/qnetworkaccessbackend.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h
index 7f6aff9b79..f9563da4a7 100644
--- a/src/network/access/qnetworkaccessbackend_p.h
+++ b/src/network/access/qnetworkaccessbackend_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkaccesscache.cpp b/src/network/access/qnetworkaccesscache.cpp
index 0458a59e22..2594e53949 100644
--- a/src/network/access/qnetworkaccesscache.cpp
+++ b/src/network/access/qnetworkaccesscache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkaccesscache_p.h b/src/network/access/qnetworkaccesscache_p.h
index b9f468e767..813ba3c35f 100644
--- a/src/network/access/qnetworkaccesscache_p.h
+++ b/src/network/access/qnetworkaccesscache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkaccesscachebackend.cpp b/src/network/access/qnetworkaccesscachebackend.cpp
index 1881dac126..baf6292124 100644
--- a/src/network/access/qnetworkaccesscachebackend.cpp
+++ b/src/network/access/qnetworkaccesscachebackend.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkaccesscachebackend_p.h b/src/network/access/qnetworkaccesscachebackend_p.h
index be0f2fb84a..5444703793 100644
--- a/src/network/access/qnetworkaccesscachebackend_p.h
+++ b/src/network/access/qnetworkaccesscachebackend_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkaccessdebugpipebackend.cpp b/src/network/access/qnetworkaccessdebugpipebackend.cpp
index 6a59bad2bd..678d6e404e 100644
--- a/src/network/access/qnetworkaccessdebugpipebackend.cpp
+++ b/src/network/access/qnetworkaccessdebugpipebackend.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkaccessdebugpipebackend_p.h b/src/network/access/qnetworkaccessdebugpipebackend_p.h
index d22acf7c9f..411c38b3ba 100644
--- a/src/network/access/qnetworkaccessdebugpipebackend_p.h
+++ b/src/network/access/qnetworkaccessdebugpipebackend_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp
index 6a8f0993a0..0080e23a8f 100644
--- a/src/network/access/qnetworkaccessfilebackend.cpp
+++ b/src/network/access/qnetworkaccessfilebackend.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkaccessfilebackend_p.h b/src/network/access/qnetworkaccessfilebackend_p.h
index 795d4b9d25..2fbf806851 100644
--- a/src/network/access/qnetworkaccessfilebackend_p.h
+++ b/src/network/access/qnetworkaccessfilebackend_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp
index 0461da284b..7b7ebb5e46 100644
--- a/src/network/access/qnetworkaccessftpbackend.cpp
+++ b/src/network/access/qnetworkaccessftpbackend.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkaccessftpbackend_p.h b/src/network/access/qnetworkaccessftpbackend_p.h
index 2dc3c1becf..7338121493 100644
--- a/src/network/access/qnetworkaccessftpbackend_p.h
+++ b/src/network/access/qnetworkaccessftpbackend_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -57,7 +57,7 @@
#include "qnetworkaccesscache_p.h"
#include "qnetworkrequest.h"
#include "qnetworkreply.h"
-#include "QtNetwork/qftp.h"
+#include "private/qftp_p.h"
#include "QtCore/qpointer.h"
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 3978bd6c85..3a80b9ed92 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -45,6 +45,7 @@
#include "qnetworkreply.h"
#include "qnetworkreply_p.h"
#include "qnetworkcookie.h"
+#include "qnetworkcookiejar.h"
#include "qabstractnetworkcache.h"
#include "QtNetwork/qnetworksession.h"
@@ -60,7 +61,7 @@
#include "QtCore/qbuffer.h"
#include "QtCore/qurl.h"
#include "QtCore/qvector.h"
-#include "QtNetwork/qauthenticator.h"
+#include "QtNetwork/private/qauthenticator_p.h"
#include "QtNetwork/qsslconfiguration.h"
#include "QtNetwork/qnetworkconfigmanager.h"
#include "QtNetwork/qhttpmultipart.h"
@@ -285,11 +286,16 @@ static void ensureInitialized()
again, without emitting the authenticationRequired() signal. If it
rejects the credentials, this signal will be emitted again.
+ \note To have the request not send credentials you must not call
+ setUser() or setPassword() on the \a authenticator object. This
+ will result in the the \l finished() signal being emitted with a
+ \l QNetworkReply with error \l AuthenticationRequiredError.
+
\note It is not possible to use a QueuedConnection to connect to
this signal, as the connection will fail if the authenticator has
not been filled in with new information when the signal returns.
- \sa proxyAuthenticationRequired()
+ \sa proxyAuthenticationRequired(), QAuthenticator::setUser(), QAuthenticator::setPassword()
*/
/*!
@@ -1115,14 +1121,8 @@ void QNetworkAccessManagerPrivate::proxyAuthenticationRequired(const QNetworkPro
QNetworkProxy *lastProxyAuthentication)
{
Q_Q(QNetworkAccessManager);
- // ### FIXME Tracking of successful authentications
- // This code is a bit broken right now for SOCKS authentication
- // first request: proxyAuthenticationRequired gets emitted, credentials gets saved
- // second request: (proxy != backend->reply->lastProxyAuthentication) does not evaluate to true,
- // proxyAuthenticationRequired gets emitted again
- // possible solution: some tracking inside the authenticator
- // or a new function proxyAuthenticationSucceeded(true|false)
- if (proxy != *lastProxyAuthentication) {
+ QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(*authenticator);
+ if (proxy != *lastProxyAuthentication && (!priv || !priv->hasFailed)) {
QNetworkAuthenticationCredential cred = authenticationManager->fetchCachedProxyCredentials(proxy);
if (!cred.isNull()) {
authenticator->setUser(cred.user);
diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h
index c707243ec6..72fd86c5a5 100644
--- a/src/network/access/qnetworkaccessmanager.h
+++ b/src/network/access/qnetworkaccessmanager.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h
index 39a9874acc..bc8df575a0 100644
--- a/src/network/access/qnetworkaccessmanager_p.h
+++ b/src/network/access/qnetworkaccessmanager_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp
index 06707385fb..a5c4fb516c 100644
--- a/src/network/access/qnetworkcookie.cpp
+++ b/src/network/access/qnetworkcookie.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkcookie.h b/src/network/access/qnetworkcookie.h
index 0f7690c174..fd9c825ddc 100644
--- a/src/network/access/qnetworkcookie.h
+++ b/src/network/access/qnetworkcookie.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -113,9 +113,6 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug, const QNetworkCookie &);
QT_END_NAMESPACE
-// ### Qt5 remove this include
-#include <QtNetwork/QNetworkCookieJar>
-
Q_DECLARE_METATYPE(QNetworkCookie)
Q_DECLARE_METATYPE(QList<QNetworkCookie>)
diff --git a/src/network/access/qnetworkcookie_p.h b/src/network/access/qnetworkcookie_p.h
index a059a7abbd..7e45219fce 100644
--- a/src/network/access/qnetworkcookie_p.h
+++ b/src/network/access/qnetworkcookie_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp
index a2fa689256..54c2ccfaba 100644
--- a/src/network/access/qnetworkcookiejar.cpp
+++ b/src/network/access/qnetworkcookiejar.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkcookiejar.h b/src/network/access/qnetworkcookiejar.h
index 006d58eafe..4ff27d8cf0 100644
--- a/src/network/access/qnetworkcookiejar.h
+++ b/src/network/access/qnetworkcookiejar.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -45,15 +45,14 @@
#include <QtCore/QObject>
#include <QtCore/QUrl>
-// ### Qt5 remove this include
-#include <QtNetwork/QNetworkCookie>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Network)
+class QNetworkCookie;
+
class QNetworkCookieJarPrivate;
class Q_NETWORK_EXPORT QNetworkCookieJar: public QObject
{
diff --git a/src/network/access/qnetworkcookiejar_p.h b/src/network/access/qnetworkcookiejar_p.h
index 34858d9c92..32fdecdb50 100644
--- a/src/network/access/qnetworkcookiejar_p.h
+++ b/src/network/access/qnetworkcookiejar_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp
index 1c515c2ac7..8dd2033a35 100644
--- a/src/network/access/qnetworkdiskcache.cpp
+++ b/src/network/access/qnetworkdiskcache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkdiskcache.h b/src/network/access/qnetworkdiskcache.h
index 5492a02d29..b8f1de5930 100644
--- a/src/network/access/qnetworkdiskcache.h
+++ b/src/network/access/qnetworkdiskcache.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkdiskcache_p.h b/src/network/access/qnetworkdiskcache_p.h
index ceb300d08c..d8f386e9eb 100644
--- a/src/network/access/qnetworkdiskcache_p.h
+++ b/src/network/access/qnetworkdiskcache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp
index 1ce7e8fce5..db62f2935a 100644
--- a/src/network/access/qnetworkreply.cpp
+++ b/src/network/access/qnetworkreply.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -586,13 +586,7 @@ QVariant QNetworkReply::attribute(QNetworkRequest::Attribute code) const
QSslConfiguration QNetworkReply::sslConfiguration() const
{
QSslConfiguration config;
-
- // determine if we support this extension
- int id = metaObject()->indexOfMethod("sslConfigurationImplementation()");
- if (id != -1) {
- void *arr[] = { &config, 0 };
- const_cast<QNetworkReply *>(this)->qt_metacall(QMetaObject::InvokeMetaMethod, id, arr);
- }
+ sslConfigurationImplementation(config);
return config;
}
@@ -602,15 +596,7 @@ QSslConfiguration QNetworkReply::sslConfiguration() const
*/
void QNetworkReply::setSslConfiguration(const QSslConfiguration &config)
{
- if (config.isNull())
- return;
-
- int id = metaObject()->indexOfMethod("setSslConfigurationImplementation(QSslConfiguration)");
- if (id != -1) {
- QSslConfiguration copy(config);
- void *arr[] = { 0, &copy };
- qt_metacall(QMetaObject::InvokeMetaMethod, id, arr);
- }
+ setSslConfigurationImplementation(config);
}
/*!
@@ -635,18 +621,53 @@ void QNetworkReply::setSslConfiguration(const QSslConfiguration &config)
*/
void QNetworkReply::ignoreSslErrors(const QList<QSslError> &errors)
{
- // do this cryptic trick, because we could not add a virtual method to this class later on
- // since that breaks binary compatibility
- int id = metaObject()->indexOfMethod("ignoreSslErrorsImplementation(QList<QSslError>)");
- if (id != -1) {
- QList<QSslError> copy(errors);
- void *arr[] = { 0, &copy };
- qt_metacall(QMetaObject::InvokeMetaMethod, id, arr);
- }
+ ignoreSslErrorsImplementation(errors);
}
#endif
/*!
+ \fn void QNetworkReply::sslConfigurationImplementation(QSslConfiguration &configuration) const
+ \since 5.0
+
+ This virtual method is provided to enable overriding the behavior of
+ sslConfiguration(). sslConfiguration() is a public wrapper for this method.
+ The configuration will be returned in \a configuration.
+
+ \sa sslConfiguration()
+*/
+void QNetworkReply::sslConfigurationImplementation(QSslConfiguration &) const
+{
+}
+
+/*!
+ \fn void QNetworkReply::setSslConfigurationImplementation(const QSslConfiguration &configuration)
+ \since 5.0
+
+ This virtual method is provided to enable overriding the behavior of
+ setSslConfiguration(). setSslConfiguration() is a public wrapper for this method.
+ If you override this method use \a configuration to set the SSL configuration.
+
+ \sa sslConfigurationImplementation(), setSslConfiguration()
+*/
+void QNetworkReply::setSslConfigurationImplementation(const QSslConfiguration &)
+{
+}
+
+/*!
+ \fn void QNetworkReply::ignoreSslErrorsImplementation(const QList<QSslError> &errors)
+ \since 5.0
+
+ This virtual method is provided to enable overriding the behavior of
+ ignoreSslErrors(). ignoreSslErrors() is a public wrapper for this method.
+ \a errors contains the errors the user wishes ignored.
+
+ \sa ignoreSslErrors()
+*/
+void QNetworkReply::ignoreSslErrorsImplementation(const QList<QSslError> &)
+{
+}
+
+/*!
If this function is called, SSL errors related to network
connection will be ignored, including certificate validation
errors.
diff --git a/src/network/access/qnetworkreply.h b/src/network/access/qnetworkreply.h
index f8352a2dfe..492336bbf6 100644
--- a/src/network/access/qnetworkreply.h
+++ b/src/network/access/qnetworkreply.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -169,6 +169,10 @@ protected:
void setRawHeader(const QByteArray &headerName, const QByteArray &value);
void setAttribute(QNetworkRequest::Attribute code, const QVariant &value);
+ virtual void sslConfigurationImplementation(QSslConfiguration &) const;
+ virtual void setSslConfigurationImplementation(const QSslConfiguration &);
+ virtual void ignoreSslErrorsImplementation(const QList<QSslError> &);
+
private:
Q_DECLARE_PRIVATE(QNetworkReply)
};
diff --git a/src/network/access/qnetworkreply_p.h b/src/network/access/qnetworkreply_p.h
index 687e65252e..b725a11520 100644
--- a/src/network/access/qnetworkreply_p.h
+++ b/src/network/access/qnetworkreply_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkreplydataimpl.cpp b/src/network/access/qnetworkreplydataimpl.cpp
index 0cd10ce13b..22f40b2420 100644
--- a/src/network/access/qnetworkreplydataimpl.cpp
+++ b/src/network/access/qnetworkreplydataimpl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -70,19 +70,15 @@ QNetworkReplyDataImpl::QNetworkReplyDataImpl(QObject *parent, const QNetworkRequ
QNetworkReply::open(QIODevice::ReadOnly);
QUrl url = req.url();
-
- // FIXME qDecodeDataUrl should instead be rewritten to have the QByteArray
- // and the mime type as an output parameter and return a bool instead
- d->decodeDataUrlResult = qDecodeDataUrl(url);
-
- if (! d->decodeDataUrlResult.first.isNull()) {
- QString &mimeType = d->decodeDataUrlResult.first;
- qint64 size = d->decodeDataUrlResult.second.size();
+ QString mimeType;
+ QByteArray payload;
+ if (qDecodeDataUrl(url, mimeType, payload)) {
+ qint64 size = payload.size();
setHeader(QNetworkRequest::ContentTypeHeader, mimeType);
setHeader(QNetworkRequest::ContentLengthHeader, size);
QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection);
- d->decodedData.setBuffer(&d->decodeDataUrlResult.second);
+ d->decodedData.setData(payload);
d->decodedData.open(QIODevice::ReadOnly);
QMetaObject::invokeMethod(this, "downloadProgress", Qt::QueuedConnection,
diff --git a/src/network/access/qnetworkreplydataimpl_p.h b/src/network/access/qnetworkreplydataimpl_p.h
index a63c4b1eec..0b47bbbb34 100644
--- a/src/network/access/qnetworkreplydataimpl_p.h
+++ b/src/network/access/qnetworkreplydataimpl_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -87,7 +87,6 @@ public:
QNetworkReplyDataImplPrivate();
~QNetworkReplyDataImplPrivate();
- QPair<QString, QByteArray> decodeDataUrlResult;
QBuffer decodedData;
Q_DECLARE_PUBLIC(QNetworkReplyDataImpl)
diff --git a/src/network/access/qnetworkreplyfileimpl.cpp b/src/network/access/qnetworkreplyfileimpl.cpp
index 7a0c5c7fcc..0b4c89987c 100644
--- a/src/network/access/qnetworkreplyfileimpl.cpp
+++ b/src/network/access/qnetworkreplyfileimpl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkreplyfileimpl_p.h b/src/network/access/qnetworkreplyfileimpl_p.h
index c9f5def12a..c097fedb68 100644
--- a/src/network/access/qnetworkreplyfileimpl_p.h
+++ b/src/network/access/qnetworkreplyfileimpl_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index 2df18b24d9..2c1ad95ea8 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -48,6 +48,7 @@
#include "qnetworkrequest.h"
#include "qnetworkreply.h"
#include "qnetworkrequest_p.h"
+#include "qnetworkcookie.h"
#include "qnetworkcookie_p.h"
#include "QtCore/qdatetime.h"
#include "QtCore/qelapsedtimer.h"
@@ -410,10 +411,10 @@ void QNetworkReplyHttpImpl::setSslConfigurationImplementation(const QSslConfigur
Q_UNUSED(newconfig);
}
-QSslConfiguration QNetworkReplyHttpImpl::sslConfigurationImplementation() const
+void QNetworkReplyHttpImpl::sslConfigurationImplementation(QSslConfiguration &configuration) const
{
Q_D(const QNetworkReplyHttpImpl);
- return d->sslConfiguration;
+ configuration = d->sslConfiguration;
}
#endif
@@ -1496,10 +1497,12 @@ void QNetworkReplyHttpImplPrivate::setResumeOffset(quint64 offset)
*/
bool QNetworkReplyHttpImplPrivate::start()
{
+#ifndef QT_NO_BEARERMANAGEMENT
if (!managerPrivate->networkSession) {
postRequest();
return true;
}
+#endif
// This is not ideal.
const QString host = url.host();
@@ -1510,11 +1513,13 @@ bool QNetworkReplyHttpImplPrivate::start()
return true;
}
+#ifndef QT_NO_BEARERMANAGEMENT
if (managerPrivate->networkSession->isOpen() &&
managerPrivate->networkSession->state() == QNetworkSession::Connected) {
postRequest();
return true;
}
+#endif
return false;
}
@@ -1846,7 +1851,7 @@ void QNetworkReplyHttpImplPrivate::error(QNetworkReplyImpl::NetworkError code, c
Q_Q(QNetworkReplyHttpImpl);
// Can't set and emit multiple errors.
if (errorCode != QNetworkReply::NoError) {
- qWarning() << "QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.";
+ qWarning("QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.");
return;
}
@@ -1959,7 +1964,7 @@ void QNetworkReplyHttpImplPrivate::setCachingEnabled(bool enable)
if (enable) {
if (bytesDownloaded) {
- qDebug() << "x" << bytesDownloaded;
+ qDebug("setCachingEnabled: %d bytesDownloaded", bytesDownloaded);
// refuse to enable in this case
qCritical("QNetworkReplyImpl: backend error: caching was enabled after some bytes had been written");
return;
diff --git a/src/network/access/qnetworkreplyhttpimpl_p.h b/src/network/access/qnetworkreplyhttpimpl_p.h
index 0c6721b646..432b769add 100644
--- a/src/network/access/qnetworkreplyhttpimpl_p.h
+++ b/src/network/access/qnetworkreplyhttpimpl_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -94,16 +94,6 @@ public:
void setReadBufferSize(qint64 size);
bool canReadLine () const;
-#ifndef QT_NO_OPENSSL
- void ignoreSslErrors();
- // ### Qt5 Add proper virtual
- Q_INVOKABLE void ignoreSslErrorsImplementation(const QList<QSslError> &errors);
- // ### Qt5 Add proper virtual
- Q_INVOKABLE void setSslConfigurationImplementation(const QSslConfiguration &configuration);
- // ### Qt5 Add proper virtual
- Q_INVOKABLE QSslConfiguration sslConfigurationImplementation() const;
-#endif
-
Q_DECLARE_PRIVATE(QNetworkReplyHttpImpl)
Q_PRIVATE_SLOT(d_func(), void _q_startOperation())
Q_PRIVATE_SLOT(d_func(), void _q_cacheLoadReadyRead())
@@ -135,6 +125,13 @@ public:
Q_PRIVATE_SLOT(d_func(), void emitReplyUploadProgress(qint64, qint64))
+#ifndef QT_NO_OPENSSL
+protected:
+ void ignoreSslErrors();
+ void ignoreSslErrorsImplementation(const QList<QSslError> &errors);
+ void setSslConfigurationImplementation(const QSslConfiguration &configuration);
+ void sslConfigurationImplementation(QSslConfiguration &configuration) const;
+#endif
signals:
// To HTTP thread:
@@ -193,8 +190,6 @@ public:
// incoming from user
QNetworkAccessManager *manager;
QNetworkAccessManagerPrivate *managerPrivate;
- QNetworkRequest request;
- QNetworkAccessManager::Operation operation; // FIXME already in replyprivate?
QHttpNetworkRequest httpRequest; // There is also a copy in the HTTP thread
bool synchronous;
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index 46cc364172..1f9efa6ed9 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,6 +42,7 @@
#include "qnetworkreplyimpl_p.h"
#include "qnetworkaccessbackend_p.h"
#include "qnetworkcookie.h"
+#include "qnetworkcookiejar.h"
#include "qabstractnetworkcache.h"
#include "QtCore/qcoreapplication.h"
#include "QtCore/qdatetime.h"
@@ -780,7 +781,7 @@ void QNetworkReplyImplPrivate::error(QNetworkReplyImpl::NetworkError code, const
Q_Q(QNetworkReplyImpl);
// Can't set and emit multiple errors.
if (errorCode != QNetworkReply::NoError) {
- qWarning() << "QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.";
+ qWarning( "QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.");
return;
}
@@ -930,13 +931,11 @@ void QNetworkReplyImpl::setReadBufferSize(qint64 size)
}
#ifndef QT_NO_OPENSSL
-QSslConfiguration QNetworkReplyImpl::sslConfigurationImplementation() const
+void QNetworkReplyImpl::sslConfigurationImplementation(QSslConfiguration &configuration) const
{
Q_D(const QNetworkReplyImpl);
- QSslConfiguration config;
if (d->backend)
- d->backend->fetchSslConfiguration(config);
- return config;
+ d->backend->fetchSslConfiguration(configuration);
}
void QNetworkReplyImpl::setSslConfigurationImplementation(const QSslConfiguration &config)
diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h
index 089c87e693..0b7664acc6 100644
--- a/src/network/access/qnetworkreplyimpl_p.h
+++ b/src/network/access/qnetworkreplyimpl_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -87,13 +87,6 @@ public:
virtual qint64 readData(char *data, qint64 maxlen);
virtual bool event(QEvent *);
-#ifndef QT_NO_OPENSSL
- Q_INVOKABLE QSslConfiguration sslConfigurationImplementation() const;
- Q_INVOKABLE void setSslConfigurationImplementation(const QSslConfiguration &configuration);
- virtual void ignoreSslErrors();
- Q_INVOKABLE virtual void ignoreSslErrorsImplementation(const QList<QSslError> &errors);
-#endif
-
Q_DECLARE_PRIVATE(QNetworkReplyImpl)
Q_PRIVATE_SLOT(d_func(), void _q_startOperation())
Q_PRIVATE_SLOT(d_func(), void _q_copyReadyRead())
@@ -104,6 +97,14 @@ public:
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected())
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed())
#endif
+
+#ifndef QT_NO_OPENSSL
+protected:
+ void sslConfigurationImplementation(QSslConfiguration &configuration) const;
+ void setSslConfigurationImplementation(const QSslConfiguration &configuration);
+ virtual void ignoreSslErrors();
+ virtual void ignoreSslErrorsImplementation(const QList<QSslError> &errors);
+#endif
};
class QNetworkReplyImplPrivate: public QNetworkReplyPrivate
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index 608aaa5eec..c909ce2fea 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h
index aa86007127..66bfcf5942 100644
--- a/src/network/access/qnetworkrequest.h
+++ b/src/network/access/qnetworkrequest.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/access/qnetworkrequest_p.h b/src/network/access/qnetworkrequest_p.h
index 54251c82a7..eb61f092f1 100644
--- a/src/network/access/qnetworkrequest_p.h
+++ b/src/network/access/qnetworkrequest_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/bearer/qbearerengine.cpp b/src/network/bearer/qbearerengine.cpp
index b761eb2e9b..5cf52af744 100644
--- a/src/network/bearer/qbearerengine.cpp
+++ b/src/network/bearer/qbearerengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/bearer/qbearerengine_p.h b/src/network/bearer/qbearerengine_p.h
index 64af68a520..42481fcd15 100644
--- a/src/network/bearer/qbearerengine_p.h
+++ b/src/network/bearer/qbearerengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/bearer/qbearerplugin.cpp b/src/network/bearer/qbearerplugin.cpp
index bea7116451..02f6e36807 100644
--- a/src/network/bearer/qbearerplugin.cpp
+++ b/src/network/bearer/qbearerplugin.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/bearer/qbearerplugin_p.h b/src/network/bearer/qbearerplugin_p.h
index 424dfe1edd..6533cebf4f 100644
--- a/src/network/bearer/qbearerplugin_p.h
+++ b/src/network/bearer/qbearerplugin_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp
index 28bbafab36..1a96ba77a9 100644
--- a/src/network/bearer/qnetworkconfigmanager.cpp
+++ b/src/network/bearer/qnetworkconfigmanager.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h
index e317cdfb44..5f4e64b957 100644
--- a/src/network/bearer/qnetworkconfigmanager.h
+++ b/src/network/bearer/qnetworkconfigmanager.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp
index 54cd898c67..5f8f0dff53 100644
--- a/src/network/bearer/qnetworkconfigmanager_p.cpp
+++ b/src/network/bearer/qnetworkconfigmanager_p.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h
index e73e9bb399..dcd736cc6e 100644
--- a/src/network/bearer/qnetworkconfigmanager_p.h
+++ b/src/network/bearer/qnetworkconfigmanager_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp
index e207feb97c..150e1cf715 100644
--- a/src/network/bearer/qnetworkconfiguration.cpp
+++ b/src/network/bearer/qnetworkconfiguration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h
index 4839b7b809..5b650d0303 100644
--- a/src/network/bearer/qnetworkconfiguration.h
+++ b/src/network/bearer/qnetworkconfiguration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h
index edb7105e6e..9acda9210b 100644
--- a/src/network/bearer/qnetworkconfiguration_p.h
+++ b/src/network/bearer/qnetworkconfiguration_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp
index f63298dba1..7f76fde4f0 100644
--- a/src/network/bearer/qnetworksession.cpp
+++ b/src/network/bearer/qnetworksession.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h
index 1eeea02ae1..5321875078 100644
--- a/src/network/bearer/qnetworksession.h
+++ b/src/network/bearer/qnetworksession.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h
index ddf0428b52..c43762136d 100644
--- a/src/network/bearer/qnetworksession_p.h
+++ b/src/network/bearer/qnetworksession_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/bearer/qsharednetworksession.cpp b/src/network/bearer/qsharednetworksession.cpp
index f10eaaa489..358bc95377 100644
--- a/src/network/bearer/qsharednetworksession.cpp
+++ b/src/network/bearer/qsharednetworksession.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/bearer/qsharednetworksession_p.h b/src/network/bearer/qsharednetworksession_p.h
index 31b61b53ec..86946955a1 100644
--- a/src/network/bearer/qsharednetworksession_p.h
+++ b/src/network/bearer/qsharednetworksession_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index 8e64968346..0a3dddbe28 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -45,7 +45,7 @@
#include <qhash.h>
#include <qbytearray.h>
#include <qcryptographichash.h>
-#include <qhttp.h>
+#include <private/qhttpheader_p.h>
#include <qiodevice.h>
#include <qdatastream.h>
#include <qendian.h>
@@ -206,6 +206,8 @@ QString QAuthenticator::user() const
/*!
Sets the \a user used for authentication.
+
+ \sa QNetworkAccessManager::authenticationRequired()
*/
void QAuthenticator::setUser(const QString &user)
{
@@ -220,12 +222,6 @@ void QAuthenticator::setUser(const QString &user)
d->userDomain = user.left(separatorPosn);
d->extractedUser = user.mid(separatorPosn + 1);
d->user = user;
- } else if((separatorPosn = user.indexOf(QLatin1String("@"))) != -1) {
- //domain name is present
- d->realm.clear();
- d->userDomain = user.mid(separatorPosn + 1);
- d->extractedUser = user.left(separatorPosn);
- d->user = user;
} else {
d->extractedUser = user;
d->user = user;
@@ -250,6 +246,8 @@ QString QAuthenticator::password() const
/*!
Sets the \a password used for authentication.
+
+ \sa QNetworkAccessManager::authenticationRequired()
*/
void QAuthenticator::setPassword(const QString &password)
{
@@ -332,6 +330,7 @@ bool QAuthenticator::isNull() const
QAuthenticatorPrivate::QAuthenticatorPrivate()
: ref(0)
, method(None)
+ , hasFailed(false)
, phase(Start)
, nonceCount(0)
{
@@ -393,8 +392,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QList<QPair<QByteArray, QByt
switch(method) {
case Basic:
- if(realm.isEmpty())
- this->options[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm"));
+ this->options[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm"));
if (user.isEmpty() && password.isEmpty())
phase = Done;
break;
@@ -402,8 +400,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QList<QPair<QByteArray, QByt
// #### extract from header
break;
case DigestMd5: {
- if(realm.isEmpty())
- this->options[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm"));
+ this->options[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm"));
if (options.value("stale").toLower() == "true")
phase = Start;
if (user.isEmpty() && password.isEmpty())
@@ -1381,8 +1378,9 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas
int offset = QNtlmPhase3BlockBase::Size;
Q_ASSERT(QNtlmPhase3BlockBase::Size == sizeof(QNtlmPhase3BlockBase));
-
- if(ctx->userDomain.isEmpty()) {
+
+ // for kerberos style user@domain logins, NTLM domain string should be left empty
+ if (ctx->userDomain.isEmpty() && !ctx->extractedUser.contains(QLatin1Char('@'))) {
offset = qEncodeNtlmString(pb.domain, offset, ch.targetNameStr, unicode);
pb.domainStr = ch.targetNameStr;
} else {
diff --git a/src/network/kernel/qauthenticator.h b/src/network/kernel/qauthenticator.h
index 37649e905b..958532e9dc 100644
--- a/src/network/kernel/qauthenticator.h
+++ b/src/network/kernel/qauthenticator.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/kernel/qauthenticator_p.h b/src/network/kernel/qauthenticator_p.h
index 88a30511b1..4b79202d92 100644
--- a/src/network/kernel/qauthenticator_p.h
+++ b/src/network/kernel/qauthenticator_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -77,6 +77,7 @@ public:
Method method;
QString realm;
QByteArray challenge;
+ bool hasFailed; //credentials have been tried but rejected by server.
enum Phase {
Start,
diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp
index b662a1d610..3bda5410d0 100644
--- a/src/network/kernel/qhostaddress.cpp
+++ b/src/network/kernel/qhostaddress.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/kernel/qhostaddress.h b/src/network/kernel/qhostaddress.h
index 83e8a7ce3c..4747499e38 100644
--- a/src/network/kernel/qhostaddress.h
+++ b/src/network/kernel/qhostaddress.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/kernel/qhostaddress_p.h b/src/network/kernel/qhostaddress_p.h
index 255d706858..bc863a8562 100644
--- a/src/network/kernel/qhostaddress_p.h
+++ b/src/network/kernel/qhostaddress_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp
index 465345c085..45073f6ad1 100644
--- a/src/network/kernel/qhostinfo.cpp
+++ b/src/network/kernel/qhostinfo.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -248,10 +248,12 @@ QHostInfo QHostInfoPrivate::fromName(const QString &name, QSharedPointer<QNetwor
}
#endif
+#ifndef QT_NO_BEARERMANAGEMENT
QHostInfo QHostInfoAgent::fromName(const QString &hostName, QSharedPointer<QNetworkSession>)
{
return QHostInfoAgent::fromName(hostName);
}
+#endif
/*!
diff --git a/src/network/kernel/qhostinfo.h b/src/network/kernel/qhostinfo.h
index 80e39573ed..d84d6d72fa 100644
--- a/src/network/kernel/qhostinfo.h
+++ b/src/network/kernel/qhostinfo.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h
index fb7ae37c53..35de89c1e9 100644
--- a/src/network/kernel/qhostinfo_p.h
+++ b/src/network/kernel/qhostinfo_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -95,7 +95,9 @@ class QHostInfoAgent : public QObject
Q_OBJECT
public:
static QHostInfo fromName(const QString &hostName);
+#ifndef QT_NO_BEARERMANAGEMENT
static QHostInfo fromName(const QString &hostName, QSharedPointer<QNetworkSession> networkSession);
+#endif
};
class QHostInfoPrivate
diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp
index 37444ae2d9..73882dd54f 100644
--- a/src/network/kernel/qhostinfo_unix.cpp
+++ b/src/network/kernel/qhostinfo_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -329,7 +329,7 @@ QString QHostInfo::localDomainName()
resolveLibrary();
if (local_res_ninit) {
// using thread-safe version
- res_state_ptr state = res_state_ptr(qMalloc(sizeof(*state)));
+ res_state_ptr state = res_state_ptr(malloc(sizeof(*state)));
Q_CHECK_PTR(state);
memset(state, 0, sizeof(*state));
local_res_ninit(state);
@@ -337,7 +337,7 @@ QString QHostInfo::localDomainName()
if (domainName.isEmpty())
domainName = QUrl::fromAce(state->dnsrch[0]);
local_res_nclose(state);
- qFree(state);
+ free(state);
return domainName;
}
diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp
index 10528634db..fc3724f879 100644
--- a/src/network/kernel/qhostinfo_win.cpp
+++ b/src/network/kernel/qhostinfo_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp
index ed479b2b3f..1f69d9fa1b 100644
--- a/src/network/kernel/qnetworkinterface.cpp
+++ b/src/network/kernel/qnetworkinterface.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/kernel/qnetworkinterface.h b/src/network/kernel/qnetworkinterface.h
index a749e53250..17a8e09cee 100644
--- a/src/network/kernel/qnetworkinterface.h
+++ b/src/network/kernel/qnetworkinterface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/kernel/qnetworkinterface_p.h b/src/network/kernel/qnetworkinterface_p.h
index d58909eb6a..a964f9bc54 100644
--- a/src/network/kernel/qnetworkinterface_p.h
+++ b/src/network/kernel/qnetworkinterface_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/kernel/qnetworkinterface_unix.cpp b/src/network/kernel/qnetworkinterface_unix.cpp
index 528e195ef6..8bd7e32766 100644
--- a/src/network/kernel/qnetworkinterface_unix.cpp
+++ b/src/network/kernel/qnetworkinterface_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/kernel/qnetworkinterface_win.cpp b/src/network/kernel/qnetworkinterface_win.cpp
index e8b96f6c47..da9fa80efc 100644
--- a/src/network/kernel/qnetworkinterface_win.cpp
+++ b/src/network/kernel/qnetworkinterface_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -110,12 +110,12 @@ static QHash<QHostAddress, QHostAddress> ipv4Netmasks()
DWORD retval = ptrGetAdaptersInfo(pAdapter, &bufSize);
if (retval == ERROR_BUFFER_OVERFLOW) {
// need more memory
- pAdapter = (IP_ADAPTER_INFO *)qMalloc(bufSize);
+ pAdapter = (IP_ADAPTER_INFO *)malloc(bufSize);
if (!pAdapter)
return ipv4netmasks;
// try again
if (ptrGetAdaptersInfo(pAdapter, &bufSize) != ERROR_SUCCESS) {
- qFree(pAdapter);
+ free(pAdapter);
return ipv4netmasks;
}
} else if (retval != ERROR_SUCCESS) {
@@ -132,7 +132,7 @@ static QHash<QHostAddress, QHostAddress> ipv4Netmasks()
}
}
if (pAdapter != staticBuf)
- qFree(pAdapter);
+ free(pAdapter);
return ipv4netmasks;
@@ -153,12 +153,12 @@ static QList<QNetworkInterfacePrivate *> interfaceListingWinXP()
ULONG retval = ptrGetAdaptersAddresses(AF_UNSPEC, flags, NULL, pAdapter, &bufSize);
if (retval == ERROR_BUFFER_OVERFLOW) {
// need more memory
- pAdapter = (IP_ADAPTER_ADDRESSES *)qMalloc(bufSize);
+ pAdapter = (IP_ADAPTER_ADDRESSES *)malloc(bufSize);
if (!pAdapter)
return interfaces;
// try again
if (ptrGetAdaptersAddresses(AF_UNSPEC, flags, NULL, pAdapter, &bufSize) != ERROR_SUCCESS) {
- qFree(pAdapter);
+ free(pAdapter);
return interfaces;
}
} else if (retval != ERROR_SUCCESS) {
@@ -219,7 +219,7 @@ static QList<QNetworkInterfacePrivate *> interfaceListingWinXP()
}
if (pAdapter != staticBuf)
- qFree(pAdapter);
+ free(pAdapter);
return interfaces;
}
@@ -234,12 +234,12 @@ static QList<QNetworkInterfacePrivate *> interfaceListingWin2k()
DWORD retval = ptrGetAdaptersInfo(pAdapter, &bufSize);
if (retval == ERROR_BUFFER_OVERFLOW) {
// need more memory
- pAdapter = (IP_ADAPTER_INFO *)qMalloc(bufSize);
+ pAdapter = (IP_ADAPTER_INFO *)malloc(bufSize);
if (!pAdapter)
return interfaces;
// try again
if (ptrGetAdaptersInfo(pAdapter, &bufSize) != ERROR_SUCCESS) {
- qFree(pAdapter);
+ free(pAdapter);
return interfaces;
}
} else if (retval != ERROR_SUCCESS) {
@@ -273,7 +273,7 @@ static QList<QNetworkInterfacePrivate *> interfaceListingWin2k()
}
if (pAdapter != staticBuf)
- qFree(pAdapter);
+ free(pAdapter);
return interfaces;
}
@@ -305,12 +305,12 @@ QString QHostInfo::localDomainName()
ULONG bufSize = sizeof info;
pinfo = &info;
if (ptrGetNetworkParams(pinfo, &bufSize) == ERROR_BUFFER_OVERFLOW) {
- pinfo = (FIXED_INFO *)qMalloc(bufSize);
+ pinfo = (FIXED_INFO *)malloc(bufSize);
if (!pinfo)
return QString();
// try again
if (ptrGetNetworkParams(pinfo, &bufSize) != ERROR_SUCCESS) {
- qFree(pinfo);
+ free(pinfo);
return QString(); // error
}
}
@@ -318,7 +318,7 @@ QString QHostInfo::localDomainName()
QString domainName = QUrl::fromAce(pinfo->DomainName);
if (pinfo != &info)
- qFree(pinfo);
+ free(pinfo);
return domainName;
}
diff --git a/src/network/kernel/qnetworkinterface_win_p.h b/src/network/kernel/qnetworkinterface_win_p.h
index f56d103a5f..0445e512d2 100644
--- a/src/network/kernel/qnetworkinterface_win_p.h
+++ b/src/network/kernel/qnetworkinterface_win_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp
index 19cf67feec..a8873d3be9 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -53,8 +53,8 @@
QNetworkProxy provides the method for configuring network layer
proxy support to the Qt network classes. The currently supported
- classes are QAbstractSocket, QTcpSocket, QUdpSocket, QTcpServer,
- QNetworkAccessManager and QFtp. The proxy support is designed to
+ classes are QAbstractSocket, QTcpSocket, QUdpSocket, QTcpServer
+ and QNetworkAccessManager. The proxy support is designed to
be as transparent as possible. This means that existing
network-enabled applications that you have written should
automatically support network proxy using the following code.
@@ -166,8 +166,7 @@
\row
\o Caching FTP
\o Implemented using an FTP proxy, it is useful only in the
- context of FTP requests (see QFtp,
- QNetworkAccessManager)
+ context of FTP requests (see QNetworkAccessManager)
\o CachingCapability, HostNameLookupCapability
\endtable
diff --git a/src/network/kernel/qnetworkproxy.h b/src/network/kernel/qnetworkproxy.h
index 07da51e5ec..472c220e62 100644
--- a/src/network/kernel/qnetworkproxy.h
+++ b/src/network/kernel/qnetworkproxy.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/kernel/qnetworkproxy_generic.cpp b/src/network/kernel/qnetworkproxy_generic.cpp
index f78f63d561..9328eb379a 100644
--- a/src/network/kernel/qnetworkproxy_generic.cpp
+++ b/src/network/kernel/qnetworkproxy_generic.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp
index 56c25d66f5..a994976860 100644
--- a/src/network/kernel/qnetworkproxy_mac.cpp
+++ b/src/network/kernel/qnetworkproxy_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp
index 84112867e0..84b2b79c11 100644
--- a/src/network/kernel/qnetworkproxy_win.cpp
+++ b/src/network/kernel/qnetworkproxy_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/kernel/qurlinfo.cpp b/src/network/kernel/qurlinfo.cpp
index fed954d30a..8b320a9e03 100644
--- a/src/network/kernel/qurlinfo.cpp
+++ b/src/network/kernel/qurlinfo.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/kernel/qurlinfo.h b/src/network/kernel/qurlinfo.h
index bd460867be..3bcdff6a9c 100644
--- a/src/network/kernel/qurlinfo.h
+++ b/src/network/kernel/qurlinfo.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index d74a717d93..e1a2449593 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -163,7 +163,7 @@
issue to be aware of, though: You must make sure that enough data
is available before attempting to read it using operator>>().
- \sa QFtp, QNetworkAccessManager, QTcpServer
+ \sa QNetworkAccessManager, QTcpServer
*/
/*!
@@ -315,6 +315,8 @@
proxy) was not found.
\value ProxyProtocolError The connection negotiation with the proxy server
because the response from the proxy server could not be understood.
+ \value OperationError An operation was attempted while the socket was in a state that
+ did not permit it.
\value UnknownSocketError An unidentified error occurred.
\sa QAbstractSocket::error()
@@ -347,18 +349,40 @@
\enum QAbstractSocket::SocketOption
\since 4.6
- This enum represents the options that can be set on a socket.
- If desired, they can be set after having received the connected() signal from
- the socket or after having received a new socket from a QTcpServer.
+ This enum represents the options that can be set on a socket. If
+ desired, they can be set after having received the connected()
+ signal from the socket or after having received a new socket from
+ a QTcpServer.
- \value LowDelayOption Try to optimize the socket for low latency. For a QTcpSocket
- this would set the TCP_NODELAY option and disable Nagle's algorithm. Set this to 1
- to enable.
- \value KeepAliveOption Set this to 1 to enable the SO_KEEPALIVE socket option
+ \value LowDelayOption Try to optimize the socket for low
+ latency. For a QTcpSocket this would set the TCP_NODELAY option
+ and disable Nagle's algorithm. Set this to 1 to enable.
- \value MulticastTtlOption Set this to an integer value to set IP_MULTICAST_TTL (TTL for multicast datagrams) socket option.
+ \value KeepAliveOption Set this to 1 to enable the SO_KEEPALIVE
+ socket option
- \value MulticastLoopbackOption Set this to 1 to enable the IP_MULTICAST_LOOP (multicast loopback) socket option.
+ \value MulticastTtlOption Set this to an integer value to set
+ IP_MULTICAST_TTL (TTL for multicast datagrams) socket option.
+
+ \value MulticastLoopbackOption Set this to 1 to enable the
+ IP_MULTICAST_LOOP (multicast loopback) socket option.
+
+ \value TypeOfServiceOption This option is not supported on
+ Windows. This maps to to the IP_TOS socket option.
+
+ Possible values for the \e{TypeOfServiceOption} are:
+
+ \table
+ \header \o Value \o Description
+ \row \o 224 \o Network control
+ \row \o 192 \o Internetwork control
+ \row \o 160 \o CRITIC/ECP
+ \row \o 128 \o Flash override
+ \row \o 96 \o Flash
+ \row \o 64 \o Immediate
+ \row \o 32 \o Priority
+ \row \o 0 \o Routine
+ \endtable
\sa QAbstractSocket::setSocketOption(), QAbstractSocket::socketOption()
*/
@@ -939,7 +963,7 @@ void QAbstractSocketPrivate::_q_startConnecting(const QHostInfo &hostInfo)
if (preferredNetworkLayerProtocol == QAbstractSocket::UnknownNetworkLayerProtocol || preferredNetworkLayerProtocol == QAbstractSocket::AnyIPProtocol) {
addresses = hostInfo.addresses();
} else {
- foreach (QHostAddress address, hostInfo.addresses())
+ foreach (const QHostAddress &address, hostInfo.addresses())
if (address.protocol() == preferredNetworkLayerProtocol)
addresses += address;
}
@@ -1455,27 +1479,6 @@ void QAbstractSocket::connectToHost(const QString &hostName, quint16 port,
NetworkLayerProtocol protocol)
{
Q_D(QAbstractSocket);
- d->preferredNetworkLayerProtocol = protocol;
-
- QMetaObject::invokeMethod(this, "connectToHostImplementation",
- Qt::DirectConnection,
- Q_ARG(QString, hostName),
- Q_ARG(quint16, port),
- Q_ARG(OpenMode, openMode));
-}
-
-/*!
- \since 4.1
-
- Contains the implementation of connectToHost().
-
- Attempts to make a connection to \a hostName on the given \a
- port. The socket is opened in the given \a openMode.
-*/
-void QAbstractSocket::connectToHostImplementation(const QString &hostName, quint16 port,
- OpenMode openMode)
-{
- Q_D(QAbstractSocket);
#if defined(QABSTRACTSOCKET_DEBUG)
qDebug("QAbstractSocket::connectToHost(\"%s\", %i, %i)...", qPrintable(hostName), port,
(int) openMode);
@@ -1484,9 +1487,13 @@ void QAbstractSocket::connectToHostImplementation(const QString &hostName, quint
if (d->state == ConnectedState || d->state == ConnectingState
|| d->state == ClosingState || d->state == HostLookupState) {
qWarning("QAbstractSocket::connectToHost() called when already looking up or connecting/connected to \"%s\"", qPrintable(hostName));
+ d->socketError = QAbstractSocket::OperationError;
+ setErrorString(QAbstractSocket::tr("Trying to connect while connection is in progress"));
+ emit error(d->socketError);
return;
}
+ d->preferredNetworkLayerProtocol = protocol;
d->hostName = hostName;
d->port = port;
d->state = UnconnectedState;
@@ -1705,7 +1712,7 @@ bool QAbstractSocket::canReadLine() const
\sa setSocketDescriptor()
*/
-int QAbstractSocket::socketDescriptor() const
+qintptr QAbstractSocket::socketDescriptor() const
{
Q_D(const QAbstractSocket);
return d->cachedSocketDescriptor;
@@ -1723,7 +1730,7 @@ int QAbstractSocket::socketDescriptor() const
\sa socketDescriptor()
*/
-bool QAbstractSocket::setSocketDescriptor(int socketDescriptor, SocketState socketState,
+bool QAbstractSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState socketState,
OpenMode openMode)
{
Q_D(QAbstractSocket);
@@ -1805,6 +1812,10 @@ void QAbstractSocket::setSocketOption(QAbstractSocket::SocketOption option, cons
case MulticastLoopbackOption:
d_func()->socketEngine->setOption(QAbstractSocketEngine::MulticastLoopbackOption, value.toInt());
break;
+
+ case TypeOfServiceOption:
+ d_func()->socketEngine->setOption(QAbstractSocketEngine::TypeOfServiceOption, value.toInt());
+ break;
}
}
@@ -1841,6 +1852,10 @@ QVariant QAbstractSocket::socketOption(QAbstractSocket::SocketOption option)
case MulticastLoopbackOption:
ret = d_func()->socketEngine->option(QAbstractSocketEngine::MulticastLoopbackOption);
break;
+
+ case TypeOfServiceOption:
+ ret = d_func()->socketEngine->option(QAbstractSocketEngine::TypeOfServiceOption);
+ break;
}
if (ret == -1)
return QVariant();
@@ -2595,17 +2610,6 @@ void QAbstractSocket::close()
*/
void QAbstractSocket::disconnectFromHost()
{
- QMetaObject::invokeMethod(this, "disconnectFromHostImplementation",
- Qt::DirectConnection);
-}
-
-/*!
- \since 4.1
-
- Contains the implementation of disconnectFromHost().
-*/
-void QAbstractSocket::disconnectFromHostImplementation()
-{
Q_D(QAbstractSocket);
#if defined(QABSTRACTSOCKET_DEBUG)
qDebug("QAbstractSocket::disconnectFromHost()");
diff --git a/src/network/socket/qabstractsocket.h b/src/network/socket/qabstractsocket.h
index ee910e3b33..e821f3ddb2 100644
--- a/src/network/socket/qabstractsocket.h
+++ b/src/network/socket/qabstractsocket.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -97,6 +97,7 @@ public:
ProxyConnectionTimeoutError,
ProxyNotFoundError,
ProxyProtocolError,
+ OperationError,
UnknownSocketError = -1
};
@@ -113,7 +114,8 @@ public:
LowDelayOption, // TCP_NODELAY
KeepAliveOption, // SO_KEEPALIVE
MulticastTtlOption, // IP_MULTICAST_TTL
- MulticastLoopbackOption // IP_MULTICAST_LOOPBACK
+ MulticastLoopbackOption, // IP_MULTICAST_LOOPBACK
+ TypeOfServiceOption //IP_TOS
};
enum BindFlag {
DefaultForPlatform = 0x0,
@@ -129,10 +131,9 @@ public:
bool bind(const QHostAddress &address, quint16 port = 0, BindMode mode = DefaultForPlatform);
bool bind(quint16 port = 0, BindMode mode = DefaultForPlatform);
- // ### Qt 5: Make connectToHost() and disconnectFromHost() virtual.
- void connectToHost(const QString &hostName, quint16 port, OpenMode mode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol);
- void connectToHost(const QHostAddress &address, quint16 port, OpenMode mode = ReadWrite);
- void disconnectFromHost();
+ virtual void connectToHost(const QString &hostName, quint16 port, OpenMode mode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol);
+ virtual void connectToHost(const QHostAddress &address, quint16 port, OpenMode mode = ReadWrite);
+ virtual void disconnectFromHost();
bool isValid() const;
@@ -154,8 +155,8 @@ public:
void abort();
// ### Qt 5: Make socketDescriptor() and setSocketDescriptor() virtual.
- int socketDescriptor() const;
- bool setSocketDescriptor(int socketDescriptor, SocketState state = ConnectedState,
+ qintptr socketDescriptor() const;
+ bool setSocketDescriptor(qintptr socketDescriptor, SocketState state = ConnectedState,
OpenMode openMode = ReadWrite);
// ### Qt 5: Make virtual?
@@ -194,10 +195,6 @@ Q_SIGNALS:
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator);
#endif
-protected Q_SLOTS:
- void connectToHostImplementation(const QString &hostName, quint16 port, OpenMode mode = ReadWrite);
- void disconnectFromHostImplementation();
-
protected:
qint64 readData(char *data, qint64 maxlen);
qint64 readLineData(char *data, qint64 maxlen);
diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h
index 978fb1433a..49e7c82e21 100644
--- a/src/network/socket/qabstractsocket_p.h
+++ b/src/network/socket/qabstractsocket_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -118,7 +118,7 @@ public:
QString peerName;
QAbstractSocketEngine *socketEngine;
- int cachedSocketDescriptor;
+ qintptr cachedSocketDescriptor;
#ifndef QT_NO_NETWORKPROXY
QNetworkProxy proxy;
diff --git a/src/network/socket/qabstractsocketengine.cpp b/src/network/socket/qabstractsocketengine.cpp
index 7fc0ea3993..8c1ee88ce1 100644
--- a/src/network/socket/qabstractsocketengine.cpp
+++ b/src/network/socket/qabstractsocketengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -118,7 +118,7 @@ QAbstractSocketEngine *QAbstractSocketEngine::createSocketEngine(QAbstractSocket
return new QNativeSocketEngine(parent);
}
-QAbstractSocketEngine *QAbstractSocketEngine::createSocketEngine(int socketDescripter, QObject *parent)
+QAbstractSocketEngine *QAbstractSocketEngine::createSocketEngine(qintptr socketDescripter, QObject *parent)
{
QMutexLocker locker(&socketHandlers()->mutex);
for (int i = 0; i < socketHandlers()->size(); i++) {
diff --git a/src/network/socket/qabstractsocketengine_p.h b/src/network/socket/qabstractsocketengine_p.h
index a8be98a0cf..e365eb8b5e 100644
--- a/src/network/socket/qabstractsocketengine_p.h
+++ b/src/network/socket/qabstractsocketengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -84,7 +84,7 @@ class Q_AUTOTEST_EXPORT QAbstractSocketEngine : public QObject
public:
static QAbstractSocketEngine *createSocketEngine(QAbstractSocket::SocketType socketType, const QNetworkProxy &, QObject *parent);
- static QAbstractSocketEngine *createSocketEngine(int socketDescripter, QObject *parent);
+ static QAbstractSocketEngine *createSocketEngine(qintptr socketDescriptor, QObject *parent);
QAbstractSocketEngine(QObject *parent = 0);
@@ -99,14 +99,15 @@ public:
LowDelayOption,
KeepAliveOption,
MulticastTtlOption,
- MulticastLoopbackOption
+ MulticastLoopbackOption,
+ TypeOfServiceOption
};
virtual bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol) = 0;
- virtual bool initialize(int socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState) = 0;
+ virtual bool initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState) = 0;
- virtual int socketDescriptor() const = 0;
+ virtual qintptr socketDescriptor() const = 0;
virtual bool isValid() const = 0;
@@ -224,7 +225,7 @@ protected:
virtual ~QSocketEngineHandler();
virtual QAbstractSocketEngine *createSocketEngine(QAbstractSocket::SocketType socketType,
const QNetworkProxy &, QObject *parent) = 0;
- virtual QAbstractSocketEngine *createSocketEngine(int socketDescripter, QObject *parent) = 0;
+ virtual QAbstractSocketEngine *createSocketEngine(qintptr socketDescriptor, QObject *parent) = 0;
private:
friend class QAbstractSocketEngine;
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index fd0119b8fd..e882f77dcd 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -43,7 +43,7 @@
#include "qtcpsocket.h"
#include "qhostaddress.h"
#include "qurl.h"
-#include "qhttp.h"
+#include "private/qhttpheader_p.h"
#include "qelapsedtimer.h"
#include "qnetworkinterface.h"
@@ -103,7 +103,7 @@ bool QHttpSocketEngine::initialize(QAbstractSocket::SocketType type, QAbstractSo
return true;
}
-bool QHttpSocketEngine::initialize(int, QAbstractSocket::SocketState)
+bool QHttpSocketEngine::initialize(qintptr, QAbstractSocket::SocketState)
{
return false;
}
@@ -120,7 +120,7 @@ void QHttpSocketEngine::setProxy(const QNetworkProxy &proxy)
d->authenticator.setPassword(password);
}
-int QHttpSocketEngine::socketDescriptor() const
+qintptr QHttpSocketEngine::socketDescriptor() const
{
Q_D(const QHttpSocketEngine);
return d->socket ? d->socket->socketDescriptor() : 0;
@@ -136,6 +136,8 @@ bool QHttpSocketEngine::connectInternal()
{
Q_D(QHttpSocketEngine);
+ d->credentialsSent = false;
+
// If the handshake is done, enter ConnectedState state and return true.
if (d->state == Connected) {
qWarning("QHttpSocketEngine::connectToHost: called when already connected");
@@ -512,6 +514,7 @@ void QHttpSocketEngine::slotSocketConnected()
QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(d->authenticator);
//qDebug() << "slotSocketConnected: priv=" << priv << (priv ? (int)priv->method : -1);
if (priv && priv->method != QAuthenticatorPrivate::None) {
+ d->credentialsSent = true;
data += "Proxy-Authorization: " + priv->calculateResponse(method, path);
data += "\r\n";
}
@@ -589,15 +592,26 @@ void QHttpSocketEngine::slotSocketReadNotification()
d->readBuffer.clear(); // we parsed the proxy protocol response. from now on direct socket reading will be done
int statusCode = responseHeader.statusCode();
+ QAuthenticatorPrivate *priv = 0;
if (statusCode == 200) {
d->state = Connected;
setLocalAddress(d->socket->localAddress());
setLocalPort(d->socket->localPort());
setState(QAbstractSocket::ConnectedState);
+ d->authenticator.detach();
+ priv = QAuthenticatorPrivate::getPrivate(d->authenticator);
+ priv->hasFailed = false;
} else if (statusCode == 407) {
- if (d->authenticator.isNull())
+ if (d->credentialsSent) {
+ //407 response again means the provided username/password were invalid.
+ d->authenticator = QAuthenticator(); //this is needed otherwise parseHttpResponse won't set the state, and then signal isn't emitted.
+ d->authenticator.detach();
+ priv = QAuthenticatorPrivate::getPrivate(d->authenticator);
+ priv->hasFailed = true;
+ }
+ else if (d->authenticator.isNull())
d->authenticator.detach();
- QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(d->authenticator);
+ priv = QAuthenticatorPrivate::getPrivate(d->authenticator);
priv->parseHttpResponse(responseHeader, true);
@@ -637,7 +651,6 @@ void QHttpSocketEngine::slotSocketReadNotification()
if (priv->phase == QAuthenticatorPrivate::Done)
emit proxyAuthenticationRequired(d->proxy, &d->authenticator);
-
// priv->phase will get reset to QAuthenticatorPrivate::Start if the authenticator got modified in the signal above.
if (priv->phase == QAuthenticatorPrivate::Done) {
setError(QAbstractSocket::ProxyAuthenticationRequiredError, tr("Authentication required"));
@@ -794,6 +807,7 @@ QHttpSocketEnginePrivate::QHttpSocketEnginePrivate()
, readNotificationPending(false)
, writeNotificationPending(false)
, connectionNotificationPending(false)
+ , credentialsSent(false)
, pendingResponseData(0)
{
socket = 0;
@@ -824,7 +838,7 @@ QAbstractSocketEngine *QHttpSocketEngineHandler::createSocketEngine(QAbstractSoc
return engine;
}
-QAbstractSocketEngine *QHttpSocketEngineHandler::createSocketEngine(int, QObject *)
+QAbstractSocketEngine *QHttpSocketEngineHandler::createSocketEngine(qintptr, QObject *)
{
return 0;
}
diff --git a/src/network/socket/qhttpsocketengine_p.h b/src/network/socket/qhttpsocketengine_p.h
index d7cc7c1604..1a93956bd2 100644
--- a/src/network/socket/qhttpsocketengine_p.h
+++ b/src/network/socket/qhttpsocketengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -80,11 +80,11 @@ public:
~QHttpSocketEngine();
bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol);
- bool initialize(int socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState);
+ bool initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState);
void setProxy(const QNetworkProxy &networkProxy);
- int socketDescriptor() const;
+ qintptr socketDescriptor() const;
bool isValid() const;
@@ -182,6 +182,7 @@ public:
bool readNotificationPending;
bool writeNotificationPending;
bool connectionNotificationPending;
+ bool credentialsSent;
uint pendingResponseData;
};
@@ -190,7 +191,7 @@ class Q_AUTOTEST_EXPORT QHttpSocketEngineHandler : public QSocketEngineHandler
public:
virtual QAbstractSocketEngine *createSocketEngine(QAbstractSocket::SocketType socketType,
const QNetworkProxy &, QObject *parent);
- virtual QAbstractSocketEngine *createSocketEngine(int socketDescripter, QObject *parent);
+ virtual QAbstractSocketEngine *createSocketEngine(qintptr socketDescripter, QObject *parent);
};
#endif
diff --git a/src/network/socket/qlocalserver.cpp b/src/network/socket/qlocalserver.cpp
index ffd87aa946..fc5fe3443e 100644
--- a/src/network/socket/qlocalserver.cpp
+++ b/src/network/socket/qlocalserver.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/socket/qlocalserver.h b/src/network/socket/qlocalserver.h
index 4468bf90e3..6887c16056 100644
--- a/src/network/socket/qlocalserver.h
+++ b/src/network/socket/qlocalserver.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/socket/qlocalserver_p.h b/src/network/socket/qlocalserver_p.h
index ed699fc1d5..d762818692 100644
--- a/src/network/socket/qlocalserver_p.h
+++ b/src/network/socket/qlocalserver_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/socket/qlocalserver_tcp.cpp b/src/network/socket/qlocalserver_tcp.cpp
index 47c4204802..cb4ee53f6a 100644
--- a/src/network/socket/qlocalserver_tcp.cpp
+++ b/src/network/socket/qlocalserver_tcp.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp
index e0115de8d2..5859ab0080 100644
--- a/src/network/socket/qlocalserver_unix.cpp
+++ b/src/network/socket/qlocalserver_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/socket/qlocalserver_win.cpp b/src/network/socket/qlocalserver_win.cpp
index 8e6bbc6deb..bdbe4d74f1 100644
--- a/src/network/socket/qlocalserver_win.cpp
+++ b/src/network/socket/qlocalserver_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp
index 219d2aa8ad..e311f6a060 100644
--- a/src/network/socket/qlocalsocket.cpp
+++ b/src/network/socket/qlocalsocket.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -94,7 +94,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn bool QLocalSocket::setSocketDescriptor(quintptr socketDescriptor,
+ \fn bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor,
LocalSocketState socketState, OpenMode openMode)
Initializes QLocalSocket with the native socket descriptor
@@ -110,7 +110,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn quintptr QLocalSocket::socketDescriptor() const
+ \fn qintptr QLocalSocket::socketDescriptor() const
Returns the native socket descriptor of the QLocalSocket object if
this is available; otherwise returns -1.
@@ -419,6 +419,8 @@ bool QLocalSocket::isSequential() const
\value ConnectionError An error occurred with the connection.
\value UnsupportedSocketOperationError The requested socket operation
is not supported by the local operating system.
+ \value OperationError An operation was attempted while the socket was in a state that
+ did not permit it.
\value UnknownSocketError An unidentified error occurred.
*/
diff --git a/src/network/socket/qlocalsocket.h b/src/network/socket/qlocalsocket.h
index 698c06377b..bb39b0f4c8 100644
--- a/src/network/socket/qlocalsocket.h
+++ b/src/network/socket/qlocalsocket.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -72,7 +72,8 @@ public:
DatagramTooLargeError = QAbstractSocket::DatagramTooLargeError,
ConnectionError = QAbstractSocket::NetworkError,
UnsupportedSocketOperationError = QAbstractSocket::UnsupportedSocketOperationError,
- UnknownSocketError = QAbstractSocket::UnknownSocketError
+ UnknownSocketError = QAbstractSocket::UnknownSocketError,
+ OperationError = QAbstractSocket::OperationError
};
enum LocalSocketState
@@ -104,10 +105,10 @@ public:
qint64 readBufferSize() const;
void setReadBufferSize(qint64 size);
- bool setSocketDescriptor(quintptr socketDescriptor,
+ bool setSocketDescriptor(qintptr socketDescriptor,
LocalSocketState socketState = ConnectedState,
OpenMode openMode = ReadWrite);
- quintptr socketDescriptor() const;
+ qintptr socketDescriptor() const;
LocalSocketState state() const;
bool waitForBytesWritten(int msecs = 30000);
@@ -131,10 +132,9 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_stateChanged(QAbstractSocket::SocketState))
Q_PRIVATE_SLOT(d_func(), void _q_error(QAbstractSocket::SocketError))
#elif defined(Q_OS_WIN)
- Q_PRIVATE_SLOT(d_func(), void _q_notified())
Q_PRIVATE_SLOT(d_func(), void _q_canWrite())
Q_PRIVATE_SLOT(d_func(), void _q_pipeClosed())
- Q_PRIVATE_SLOT(d_func(), void _q_emitReadyRead())
+ Q_PRIVATE_SLOT(d_func(), void _q_winError(ulong, const QString &))
#else
Q_PRIVATE_SLOT(d_func(), void _q_stateChanged(QAbstractSocket::SocketState))
Q_PRIVATE_SLOT(d_func(), void _q_error(QAbstractSocket::SocketError))
diff --git a/src/network/socket/qlocalsocket_p.h b/src/network/socket/qlocalsocket_p.h
index a0749fd35f..3541d950e8 100644
--- a/src/network/socket/qlocalsocket_p.h
+++ b/src/network/socket/qlocalsocket_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -63,8 +63,8 @@
#if defined(QT_LOCALSOCKET_TCP)
# include "qtcpsocket.h"
#elif defined(Q_OS_WIN)
+# include "private/qwindowspipereader_p.h"
# include "private/qwindowspipewriter_p.h"
-# include "private/qringbuffer_p.h"
# include <qwineventnotifier.h>
#else
# include "private/qabstractsocketengine_p.h"
@@ -131,26 +131,13 @@ public:
~QLocalSocketPrivate();
void destroyPipeHandles();
void setErrorString(const QString &function);
- void _q_notified();
void _q_canWrite();
void _q_pipeClosed();
- void _q_emitReadyRead();
- DWORD checkPipeState();
- void startAsyncRead();
- bool completeAsyncRead();
- void checkReadyRead();
+ void _q_winError(ulong windowsError, const QString &function);
HANDLE handle;
- OVERLAPPED overlapped;
QWindowsPipeWriter *pipeWriter;
- qint64 readBufferMaxSize;
- QRingBuffer readBuffer;
- int actualReadBufferSize;
- QWinEventNotifier *dataReadNotifier;
+ QWindowsPipeReader *pipeReader;
QLocalSocket::LocalSocketError error;
- bool readSequenceStarted;
- bool pendingReadyRead;
- bool pipeClosed;
- static const qint64 initialReadBufferSize = 4096;
#else
QLocalUnixSocket unixSocket;
QString generateErrorString(QLocalSocket::LocalSocketError, const QString &function) const;
diff --git a/src/network/socket/qlocalsocket_tcp.cpp b/src/network/socket/qlocalsocket_tcp.cpp
index 38d2b627b1..3b83d0ee01 100644
--- a/src/network/socket/qlocalsocket_tcp.cpp
+++ b/src/network/socket/qlocalsocket_tcp.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -155,6 +155,9 @@ QString QLocalSocketPrivate::generateErrorString(QLocalSocket::LocalSocketError
case QLocalSocket::UnsupportedSocketOperationError:
errorString = QLocalSocket::tr("%1: The socket operation is not supported").arg(function);
break;
+ case QLocalSocket::OperationError:
+ errorString = QLocalSocket::tr("%1: Operation not permitted when socket is in this state").arg(function);
+ break;
case QLocalSocket::UnknownSocketError:
default:
errorString = QLocalSocket::tr("%1: Unknown error").arg(function);
@@ -247,7 +250,7 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode)
QIODevice::open(openMode);
}
-bool QLocalSocket::setSocketDescriptor(quintptr socketDescriptor,
+bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor,
LocalSocketState socketState, OpenMode openMode)
{
Q_D(QLocalSocket);
@@ -287,7 +290,7 @@ bool QLocalSocket::setSocketDescriptor(quintptr socketDescriptor,
newSocketState, openMode);
}
-quintptr QLocalSocket::socketDescriptor() const
+qintptr QLocalSocket::socketDescriptor() const
{
Q_D(const QLocalSocket);
return d->tcpSocket->socketDescriptor();
diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp
index 1bdf604eb1..5bd929d477 100644
--- a/src/network/socket/qlocalsocket_unix.cpp
+++ b/src/network/socket/qlocalsocket_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -162,6 +162,9 @@ QString QLocalSocketPrivate::generateErrorString(QLocalSocket::LocalSocketError
case QLocalSocket::UnsupportedSocketOperationError:
errorString = QLocalSocket::tr("%1: The socket operation is not supported").arg(function);
break;
+ case QLocalSocket::OperationError:
+ errorString = QLocalSocket::tr("%1: Operation not permitted when socket is in this state").arg(function);
+ break;
case QLocalSocket::UnknownSocketError:
default:
errorString = QLocalSocket::tr("%1: Unknown error %2").arg(function).arg(errno);
@@ -221,9 +224,12 @@ void QLocalSocketPrivate::errorOccurred(QLocalSocket::LocalSocketError error, co
void QLocalSocket::connectToServer(const QString &name, OpenMode openMode)
{
Q_D(QLocalSocket);
- if (state() == ConnectedState
- || state() == ConnectingState)
+ if (state() == ConnectedState || state() == ConnectingState) {
+ QString errorString = d->generateErrorString(QLocalSocket::OperationError, QLatin1String("QLocalSocket::connectToserver"));
+ setErrorString(errorString);
+ emit error(QLocalSocket::OperationError);
return;
+ }
d->errorString.clear();
d->unixSocket.setSocketState(QAbstractSocket::ConnectingState);
@@ -343,7 +349,7 @@ void QLocalSocketPrivate::_q_connectToSocket()
connectingOpenMode = 0;
}
-bool QLocalSocket::setSocketDescriptor(quintptr socketDescriptor,
+bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor,
LocalSocketState socketState, OpenMode openMode)
{
Q_D(QLocalSocket);
@@ -386,7 +392,7 @@ void QLocalSocketPrivate::cancelDelayedConnect()
}
}
-quintptr QLocalSocket::socketDescriptor() const
+qintptr QLocalSocket::socketDescriptor() const
{
Q_D(const QLocalSocket);
return d->unixSocket.socketDescriptor();
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp
index f595ba72ae..99942a6138 100644
--- a/src/network/socket/qlocalsocket_win.cpp
+++ b/src/network/socket/qlocalsocket_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -50,16 +50,21 @@ QT_BEGIN_NAMESPACE
void QLocalSocketPrivate::init()
{
Q_Q(QLocalSocket);
- memset(&overlapped, 0, sizeof(overlapped));
- overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- dataReadNotifier = new QWinEventNotifier(overlapped.hEvent, q);
- q->connect(dataReadNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_notified()));
+ pipeReader = new QWindowsPipeReader(q);
+ q->connect(pipeReader, SIGNAL(readyRead()), SIGNAL(readyRead()));
+ q->connect(pipeReader, SIGNAL(pipeClosed()), SLOT(_q_pipeClosed()), Qt::QueuedConnection);
+ q->connect(pipeReader, SIGNAL(winError(ulong, const QString &)), SLOT(_q_winError(ulong, const QString &)));
}
void QLocalSocketPrivate::setErrorString(const QString &function)
{
+ DWORD windowsError = GetLastError();
+ _q_winError(windowsError, function);
+}
+
+void QLocalSocketPrivate::_q_winError(ulong windowsError, const QString &function)
+{
Q_Q(QLocalSocket);
- BOOL windowsError = GetLastError();
QLocalSocket::LocalSocketState currentState = state;
// If the connectToServer fails due to WaitNamedPipe() time-out, assume ConnectionError
@@ -95,7 +100,7 @@ void QLocalSocketPrivate::setErrorString(const QString &function)
if (currentState != state) {
q->emit stateChanged(state);
- if (state == QLocalSocket::UnconnectedState)
+ if (state == QLocalSocket::UnconnectedState && currentState != QLocalSocket::ConnectingState)
q->emit disconnected();
}
emit q->error(error);
@@ -103,13 +108,9 @@ void QLocalSocketPrivate::setErrorString(const QString &function)
QLocalSocketPrivate::QLocalSocketPrivate() : QIODevicePrivate(),
handle(INVALID_HANDLE_VALUE),
+ pipeReader(0),
pipeWriter(0),
- readBufferMaxSize(0),
- actualReadBufferSize(0),
error(QLocalSocket::UnknownSocketError),
- readSequenceStarted(false),
- pendingReadyRead(false),
- pipeClosed(false),
state(QLocalSocket::UnconnectedState)
{
}
@@ -117,7 +118,6 @@ QLocalSocketPrivate::QLocalSocketPrivate() : QIODevicePrivate(),
QLocalSocketPrivate::~QLocalSocketPrivate()
{
destroyPipeHandles();
- CloseHandle(overlapped.hEvent);
}
void QLocalSocketPrivate::destroyPipeHandles()
@@ -131,8 +131,11 @@ void QLocalSocketPrivate::destroyPipeHandles()
void QLocalSocket::connectToServer(const QString &name, OpenMode openMode)
{
Q_D(QLocalSocket);
- if (state() == ConnectedState || state() == ConnectingState)
+ if (state() == ConnectedState || state() == ConnectingState) {
+ setErrorString(tr("Trying to connect while connection is in progress"));
+ emit error(QLocalSocket::OperationError);
return;
+ }
d->error = QLocalSocket::UnknownSocketError;
d->errorString = QString();
@@ -186,7 +189,7 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode)
// we have a valid handle
d->serverName = name;
- if (setSocketDescriptor((quintptr)localSocket, ConnectedState, openMode)) {
+ if (setSocketDescriptor((qintptr)localSocket, ConnectedState, openMode)) {
d->handle = localSocket;
emit connected();
}
@@ -197,146 +200,7 @@ qint64 QLocalSocket::readData(char *data, qint64 maxSize)
{
Q_D(QLocalSocket);
- if (d->pipeClosed && d->actualReadBufferSize == 0)
- return -1; // signal EOF
-
- qint64 readSoFar;
- // If startAsyncRead() read data, copy it to its destination.
- if (maxSize == 1 && d->actualReadBufferSize > 0) {
- *data = d->readBuffer.getChar();
- d->actualReadBufferSize--;
- readSoFar = 1;
- } else {
- qint64 bytesToRead = qMin(qint64(d->actualReadBufferSize), maxSize);
- readSoFar = 0;
- while (readSoFar < bytesToRead) {
- const char *ptr = d->readBuffer.readPointer();
- int bytesToReadFromThisBlock = qMin(bytesToRead - readSoFar,
- qint64(d->readBuffer.nextDataBlockSize()));
- memcpy(data + readSoFar, ptr, bytesToReadFromThisBlock);
- readSoFar += bytesToReadFromThisBlock;
- d->readBuffer.free(bytesToReadFromThisBlock);
- d->actualReadBufferSize -= bytesToReadFromThisBlock;
- }
- }
-
- if (d->pipeClosed) {
- if (d->actualReadBufferSize == 0)
- QTimer::singleShot(0, this, SLOT(_q_pipeClosed()));
- } else {
- if (!d->readSequenceStarted)
- d->startAsyncRead();
- d->checkReadyRead();
- }
-
- return readSoFar;
-}
-
-/*!
- \internal
- Schedules or cancels a readyRead() emission depending on actual data availability
- */
-void QLocalSocketPrivate::checkReadyRead()
-{
- if (actualReadBufferSize > 0) {
- if (!pendingReadyRead) {
- Q_Q(QLocalSocket);
- QTimer::singleShot(0, q, SLOT(_q_emitReadyRead()));
- pendingReadyRead = true;
- }
- } else {
- pendingReadyRead = false;
- }
-}
-
-/*!
- \internal
- Reads data from the socket into the readbuffer
- */
-void QLocalSocketPrivate::startAsyncRead()
-{
- do {
- DWORD bytesToRead = checkPipeState();
- if (pipeClosed)
- return;
-
- if (bytesToRead == 0) {
- // There are no bytes in the pipe but we need to
- // start the overlapped read with some buffer size.
- bytesToRead = initialReadBufferSize;
- }
-
- if (readBufferMaxSize && bytesToRead > (readBufferMaxSize - readBuffer.size())) {
- bytesToRead = readBufferMaxSize - readBuffer.size();
- if (bytesToRead == 0) {
- // Buffer is full. User must read data from the buffer
- // before we can read more from the pipe.
- return;
- }
- }
-
- char *ptr = readBuffer.reserve(bytesToRead);
-
- readSequenceStarted = true;
- if (ReadFile(handle, ptr, bytesToRead, NULL, &overlapped)) {
- completeAsyncRead();
- } else {
- switch (GetLastError()) {
- case ERROR_IO_PENDING:
- // This is not an error. We're getting notified, when data arrives.
- return;
- case ERROR_MORE_DATA:
- // This is not an error. The synchronous read succeeded.
- // We're connected to a message mode pipe and the message
- // didn't fit into the pipe's system buffer.
- completeAsyncRead();
- break;
- case ERROR_PIPE_NOT_CONNECTED:
- {
- // It may happen, that the other side closes the connection directly
- // after writing data. Then we must set the appropriate socket state.
- pipeClosed = true;
- Q_Q(QLocalSocket);
- emit q->readChannelFinished();
- return;
- }
- default:
- setErrorString(QLatin1String("QLocalSocketPrivate::startAsyncRead"));
- return;
- }
- }
- } while (!readSequenceStarted);
-}
-
-/*!
- \internal
- Sets the correct size of the read buffer after a read operation.
- Returns false, if an error occurred or the connection dropped.
- */
-bool QLocalSocketPrivate::completeAsyncRead()
-{
- ResetEvent(overlapped.hEvent);
- readSequenceStarted = false;
-
- DWORD bytesRead;
- if (!GetOverlappedResult(handle, &overlapped, &bytesRead, TRUE)) {
- switch (GetLastError()) {
- case ERROR_MORE_DATA:
- // This is not an error. We're connected to a message mode
- // pipe and the message didn't fit into the pipe's system
- // buffer. We will read the remaining data in the next call.
- break;
- case ERROR_PIPE_NOT_CONNECTED:
- return false;
- default:
- setErrorString(QLatin1String("QLocalSocketPrivate::completeAsyncRead"));
- return false;
- }
- }
-
- actualReadBufferSize += bytesRead;
- readBuffer.truncate(actualReadBufferSize);
- return true;
+ return d->pipeReader->read(data, maxSize);
}
qint64 QLocalSocket::writeData(const char *data, qint64 maxSize)
@@ -361,39 +225,38 @@ void QLocalSocket::abort()
close();
}
-/*!
- \internal
- Returns the number of available bytes in the pipe.
- Sets QLocalSocketPrivate::pipeClosed to true if the connection is broken.
- */
-DWORD QLocalSocketPrivate::checkPipeState()
+void QLocalSocketPrivate::_q_pipeClosed()
{
Q_Q(QLocalSocket);
- DWORD bytes;
- if (PeekNamedPipe(handle, NULL, 0, NULL, &bytes, NULL)) {
- return bytes;
- } else {
- if (!pipeClosed) {
- pipeClosed = true;
- emit q->readChannelFinished();
- if (actualReadBufferSize == 0)
- QTimer::singleShot(0, q, SLOT(_q_pipeClosed()));
- }
+ if (state == QLocalSocket::UnconnectedState)
+ return;
+
+ emit q->readChannelFinished();
+ if (state != QLocalSocket::ClosingState) {
+ state = QLocalSocket::ClosingState;
+ emit q->stateChanged(state);
+ if (state != QLocalSocket::ClosingState)
+ return;
}
- return 0;
-}
+ state = QLocalSocket::UnconnectedState;
+ emit q->stateChanged(state);
+ emit q->disconnected();
-void QLocalSocketPrivate::_q_pipeClosed()
-{
- Q_Q(QLocalSocket);
- q->close();
+ pipeReader->stop();
+ destroyPipeHandles();
+ handle = INVALID_HANDLE_VALUE;
+
+ if (pipeWriter) {
+ delete pipeWriter;
+ pipeWriter = 0;
+ }
}
qint64 QLocalSocket::bytesAvailable() const
{
Q_D(const QLocalSocket);
qint64 available = QIODevice::bytesAvailable();
- available += (qint64) d->actualReadBufferSize;
+ available += d->pipeReader->bytesAvailable();
return available;
}
@@ -406,42 +269,26 @@ qint64 QLocalSocket::bytesToWrite() const
bool QLocalSocket::canReadLine() const
{
Q_D(const QLocalSocket);
- if (state() != ConnectedState)
- return false;
- return (QIODevice::canReadLine()
- || d->readBuffer.indexOf('\n', d->actualReadBufferSize) != -1);
+ return QIODevice::canReadLine() || d->pipeReader->canReadLine();
}
void QLocalSocket::close()
{
Q_D(QLocalSocket);
- if (state() == UnconnectedState)
+ if (openMode() == NotOpen)
return;
QIODevice::close();
- d->state = ClosingState;
- emit stateChanged(d->state);
- if (!d->pipeClosed)
- emit readChannelFinished();
d->serverName = QString();
d->fullServerName = QString();
- if (state() != UnconnectedState && bytesToWrite() > 0) {
- disconnectFromServer();
- return;
- }
- d->readSequenceStarted = false;
- d->pendingReadyRead = false;
- d->pipeClosed = false;
- d->destroyPipeHandles();
- d->handle = INVALID_HANDLE_VALUE;
- ResetEvent(d->overlapped.hEvent);
- d->state = UnconnectedState;
- emit stateChanged(d->state);
- emit disconnected();
- if (d->pipeWriter) {
- delete d->pipeWriter;
- d->pipeWriter = 0;
+ if (state() != UnconnectedState) {
+ if (bytesToWrite() > 0) {
+ disconnectFromServer();
+ return;
+ }
+
+ d->_q_pipeClosed();
}
}
@@ -480,20 +327,18 @@ QLocalSocket::LocalSocketError QLocalSocket::error() const
return d->error;
}
-bool QLocalSocket::setSocketDescriptor(quintptr socketDescriptor,
+bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor,
LocalSocketState socketState, OpenMode openMode)
{
Q_D(QLocalSocket);
- d->readBuffer.clear();
- d->actualReadBufferSize = 0;
- QIODevice::open(openMode);
- d->handle = (int*)socketDescriptor;
+ d->pipeReader->stop();
+ d->handle = reinterpret_cast<HANDLE>(socketDescriptor);
d->state = socketState;
+ d->pipeReader->setHandle(d->handle);
+ QIODevice::open(openMode);
emit stateChanged(d->state);
- if (d->state == ConnectedState && openMode.testFlag(QIODevice::ReadOnly)) {
- d->startAsyncRead();
- d->checkReadyRead();
- }
+ if (d->state == ConnectedState && openMode.testFlag(QIODevice::ReadOnly))
+ d->pipeReader->startAsyncRead();
return true;
}
@@ -504,46 +349,22 @@ void QLocalSocketPrivate::_q_canWrite()
q->close();
}
-void QLocalSocketPrivate::_q_notified()
-{
- Q_Q(QLocalSocket);
- if (!completeAsyncRead()) {
- pipeClosed = true;
- emit q->readChannelFinished();
- if (actualReadBufferSize == 0)
- QTimer::singleShot(0, q, SLOT(_q_pipeClosed()));
- return;
- }
- startAsyncRead();
- pendingReadyRead = false;
- emit q->readyRead();
-}
-
-void QLocalSocketPrivate::_q_emitReadyRead()
-{
- if (pendingReadyRead) {
- Q_Q(QLocalSocket);
- pendingReadyRead = false;
- emit q->readyRead();
- }
-}
-
-quintptr QLocalSocket::socketDescriptor() const
+qintptr QLocalSocket::socketDescriptor() const
{
Q_D(const QLocalSocket);
- return (quintptr)d->handle;
+ return (qintptr)d->handle;
}
qint64 QLocalSocket::readBufferSize() const
{
Q_D(const QLocalSocket);
- return d->readBufferMaxSize;
+ return d->pipeReader->maxReadBufferSize();
}
void QLocalSocket::setReadBufferSize(qint64 size)
{
Q_D(QLocalSocket);
- d->readBufferMaxSize = size;
+ d->pipeReader->setMaxReadBufferSize(size);
}
bool QLocalSocket::waitForConnected(int msecs)
@@ -561,18 +382,10 @@ bool QLocalSocket::waitForDisconnected(int msecs)
qWarning("QLocalSocket::waitForDisconnected isn't supported for write only pipes.");
return false;
}
- QIncrementalSleepTimer timer(msecs);
- forever {
- d->checkPipeState();
- if (d->pipeClosed)
- close();
- if (state() == UnconnectedState)
- return true;
- Sleep(timer.nextSleepTime());
- if (timer.hasTimedOut())
- break;
+ if (d->pipeReader->waitForPipeClosed(msecs)) {
+ d->_q_pipeClosed();
+ return true;
}
-
return false;
}
@@ -593,28 +406,18 @@ bool QLocalSocket::waitForReadyRead(int msecs)
return false;
// We already know that the pipe is gone, but did not enter the event loop yet.
- if (d->pipeClosed) {
- close();
+ if (d->pipeReader->isPipeClosed()) {
+ d->_q_pipeClosed();
return false;
}
- Q_ASSERT(d->readSequenceStarted);
- DWORD result = WaitForSingleObject(d->overlapped.hEvent, msecs == -1 ? INFINITE : msecs);
- switch (result) {
- case WAIT_OBJECT_0:
- d->_q_notified();
- // We just noticed that the pipe is gone.
- if (d->pipeClosed) {
- close();
- return false;
- }
- return true;
- case WAIT_TIMEOUT:
- return false;
- }
+ bool result = d->pipeReader->waitForReadyRead(msecs);
- qWarning("QLocalSocket::waitForReadyRead WaitForSingleObject failed with error code %d.", int(GetLastError()));
- return false;
+ // We just noticed that the pipe is gone.
+ if (d->pipeReader->isPipeClosed())
+ d->_q_pipeClosed();
+
+ return result;
}
bool QLocalSocket::waitForBytesWritten(int msecs)
diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp
index 5e3e22a23e..cae2469328 100644
--- a/src/network/socket/qnativesocketengine.cpp
+++ b/src/network/socket/qnativesocketengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -414,7 +414,7 @@ bool QNativeSocketEngine::initialize(QAbstractSocket::SocketType socketType, QAb
If the socket type is either TCP or UDP, it is made non-blocking.
UDP sockets are also broadcast enabled.
*/
-bool QNativeSocketEngine::initialize(int socketDescriptor, QAbstractSocket::SocketState socketState)
+bool QNativeSocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState)
{
Q_D(QNativeSocketEngine);
@@ -471,7 +471,7 @@ bool QNativeSocketEngine::isValid() const
Returns the native socket descriptor. Any use of this descriptor
stands the risk of being non-portable.
*/
-int QNativeSocketEngine::socketDescriptor() const
+qintptr QNativeSocketEngine::socketDescriptor() const
{
Q_D(const QNativeSocketEngine);
return d->socketDescriptor;
@@ -1114,7 +1114,7 @@ bool QNativeSocketEngine::isReadNotificationEnabled() const
class QReadNotifier : public QSocketNotifier
{
public:
- QReadNotifier(int fd, QNativeSocketEngine *parent)
+ QReadNotifier(qintptr fd, QNativeSocketEngine *parent)
: QSocketNotifier(fd, QSocketNotifier::Read, parent)
{ engine = parent; }
diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h
index a024cd42d1..60c13c1258 100644
--- a/src/network/socket/qnativesocketengine_p.h
+++ b/src/network/socket/qnativesocketengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -113,9 +113,9 @@ public:
~QNativeSocketEngine();
bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol);
- bool initialize(int socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState);
+ bool initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState);
- int socketDescriptor() const;
+ qintptr socketDescriptor() const;
bool isValid() const;
@@ -199,7 +199,7 @@ public:
QNativeSocketEnginePrivate();
~QNativeSocketEnginePrivate();
- int socketDescriptor;
+ qintptr socketDescriptor;
QSocketNotifier *readNotifier, *writeNotifier, *exceptNotifier;
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index 09aed255d6..324705d998 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -251,6 +251,12 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co
n = IP_MULTICAST_LOOP;
}
break;
+ case QNativeSocketEngine::TypeOfServiceOption:
+ if (socketProtocol == QAbstractSocket::IPv4Protocol) {
+ level = IPPROTO_IP;
+ n = IP_TOS;
+ }
+ break;
}
int v = -1;
@@ -352,6 +358,12 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
n = IP_MULTICAST_LOOP;
}
break;
+ case QNativeSocketEngine::TypeOfServiceOption:
+ if (socketProtocol == QAbstractSocket::IPv4Protocol) {
+ level = IPPROTO_IP;
+ n = IP_TOS;
+ }
+ break;
}
return ::setsockopt(socketDescriptor, level, n, (char *) &v, sizeof(v)) == 0;
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp
index 247de01072..ee15702b76 100644
--- a/src/network/socket/qnativesocketengine_win.cpp
+++ b/src/network/socket/qnativesocketengine_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -229,7 +229,7 @@ void QNativeSocketEnginePrivate::setPortAndAddress(sockaddr_in * sockAddrIPv4, q
/*! \internal
*/
-static inline QAbstractSocket::SocketType qt_socket_getType(int socketDescriptor)
+static inline QAbstractSocket::SocketType qt_socket_getType(qintptr socketDescriptor)
{
int value = 0;
QT_SOCKLEN_T valueSize = sizeof(value);
@@ -247,7 +247,7 @@ static inline QAbstractSocket::SocketType qt_socket_getType(int socketDescriptor
/*! \internal
*/
-static inline int qt_socket_getMaxMsgSize(int socketDescriptor)
+static inline int qt_socket_getMaxMsgSize(qintptr socketDescriptor)
{
int value = 0;
QT_SOCKLEN_T valueSize = sizeof(value);
@@ -422,6 +422,9 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co
n = IP_MULTICAST_LOOP;
}
break;
+ case QNativeSocketEngine::TypeOfServiceOption:
+ return -1;
+ break;
}
int v = -1;
@@ -502,6 +505,9 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
n = IP_MULTICAST_LOOP;
}
break;
+ case QNativeSocketEngine::TypeOfServiceOption:
+ return false;
+ break;
}
if (::setsockopt(socketDescriptor, level, n, (char*)&v, sizeof(v)) != 0) {
diff --git a/src/network/socket/qnet_unix_p.h b/src/network/socket/qnet_unix_p.h
index fe22c329e4..7b2ba54648 100644
--- a/src/network/socket/qnet_unix_p.h
+++ b/src/network/socket/qnet_unix_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp
index 5f510fa84b..919bdea2e0 100644
--- a/src/network/socket/qsocks5socketengine.cpp
+++ b/src/network/socket/qsocks5socketengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -332,9 +332,9 @@ public:
QSocks5BindStore();
~QSocks5BindStore();
- void add(int socketDescriptor, QSocks5BindData *bindData);
- bool contains(int socketDescriptor);
- QSocks5BindData *retrieve(int socketDescriptor);
+ void add(qintptr socketDescriptor, QSocks5BindData *bindData);
+ bool contains(qintptr socketDescriptor);
+ QSocks5BindData *retrieve(qintptr socketDescriptor);
protected:
void timerEvent(QTimerEvent * event);
@@ -360,7 +360,7 @@ QSocks5BindStore::~QSocks5BindStore()
{
}
-void QSocks5BindStore::add(int socketDescriptor, QSocks5BindData *bindData)
+void QSocks5BindStore::add(qintptr socketDescriptor, QSocks5BindData *bindData)
{
QMutexLocker lock(&mutex);
if (store.contains(socketDescriptor)) {
@@ -373,13 +373,13 @@ void QSocks5BindStore::add(int socketDescriptor, QSocks5BindData *bindData)
sweepTimerId = startTimer(60000);
}
-bool QSocks5BindStore::contains(int socketDescriptor)
+bool QSocks5BindStore::contains(qintptr socketDescriptor)
{
QMutexLocker lock(&mutex);
return store.contains(socketDescriptor);
}
-QSocks5BindData *QSocks5BindStore::retrieve(int socketDescriptor)
+QSocks5BindData *QSocks5BindStore::retrieve(qintptr socketDescriptor)
{
QMutexLocker lock(&mutex);
if (!store.contains(socketDescriptor))
@@ -1018,7 +1018,7 @@ bool QSocks5SocketEngine::initialize(QAbstractSocket::SocketType type, QAbstract
return true;
}
-bool QSocks5SocketEngine::initialize(int socketDescriptor, QAbstractSocket::SocketState socketState)
+bool QSocks5SocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState)
{
Q_D(QSocks5SocketEngine);
@@ -1080,7 +1080,7 @@ void QSocks5SocketEngine::setProxy(const QNetworkProxy &networkProxy)
d->proxyInfo = networkProxy;
}
-int QSocks5SocketEngine::socketDescriptor() const
+qintptr QSocks5SocketEngine::socketDescriptor() const
{
Q_D(const QSocks5SocketEngine);
return d->socketDescriptor;
@@ -1448,7 +1448,7 @@ int QSocks5SocketEngine::accept()
d->data->controlSocket->setParent(0);
d->bindData->localAddress = d->localAddress;
d->bindData->localPort = d->localPort;
- int sd = d->socketDescriptor;
+ qintptr sd = d->socketDescriptor;
socks5BindStore()->add(sd, d->bindData);
d->data = 0;
d->bindData = 0;
@@ -1917,7 +1917,7 @@ QSocks5SocketEngineHandler::createSocketEngine(QAbstractSocket::SocketType socke
return engine.take();
}
-QAbstractSocketEngine *QSocks5SocketEngineHandler::createSocketEngine(int socketDescriptor, QObject *parent)
+QAbstractSocketEngine *QSocks5SocketEngineHandler::createSocketEngine(qintptr socketDescriptor, QObject *parent)
{
QSOCKS5_DEBUG << "createSocketEngine" << socketDescriptor;
if (socks5BindStore()->contains(socketDescriptor)) {
diff --git a/src/network/socket/qsocks5socketengine_p.h b/src/network/socket/qsocks5socketengine_p.h
index 9b2f6e3ade..386e4856a1 100644
--- a/src/network/socket/qsocks5socketengine_p.h
+++ b/src/network/socket/qsocks5socketengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -70,11 +70,11 @@ public:
~QSocks5SocketEngine();
bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol);
- bool initialize(int socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState);
+ bool initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState);
void setProxy(const QNetworkProxy &networkProxy);
- int socketDescriptor() const;
+ qintptr socketDescriptor() const;
bool isValid() const;
@@ -261,7 +261,7 @@ public:
bool readNotificationEnabled, writeNotificationEnabled, exceptNotificationEnabled;
- int socketDescriptor;
+ qintptr socketDescriptor;
QSocks5Data *data;
QSocks5ConnectData *connectData;
@@ -290,7 +290,7 @@ class Q_AUTOTEST_EXPORT QSocks5SocketEngineHandler : public QSocketEngineHandler
public:
virtual QAbstractSocketEngine *createSocketEngine(QAbstractSocket::SocketType socketType,
const QNetworkProxy &, QObject *parent);
- virtual QAbstractSocketEngine *createSocketEngine(int socketDescripter, QObject *parent);
+ virtual QAbstractSocketEngine *createSocketEngine(qintptr socketDescriptor, QObject *parent);
};
diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp
index 500d383e0f..857827facc 100644
--- a/src/network/socket/qtcpserver.cpp
+++ b/src/network/socket/qtcpserver.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -378,7 +378,7 @@ void QTcpServer::close()
\sa setSocketDescriptor(), isListening()
*/
-int QTcpServer::socketDescriptor() const
+qintptr QTcpServer::socketDescriptor() const
{
Q_D(const QTcpServer);
Q_CHECK_SOCKETENGINE(-1);
@@ -394,7 +394,7 @@ int QTcpServer::socketDescriptor() const
\sa socketDescriptor(), isListening()
*/
-bool QTcpServer::setSocketDescriptor(int socketDescriptor)
+bool QTcpServer::setSocketDescriptor(qintptr socketDescriptor)
{
Q_D(QTcpServer);
if (isListening()) {
@@ -566,7 +566,7 @@ QTcpSocket *QTcpServer::nextPendingConnection()
\sa newConnection(), nextPendingConnection(), addPendingConnection()
*/
-void QTcpServer::incomingConnection(int socketDescriptor)
+void QTcpServer::incomingConnection(qintptr socketDescriptor)
{
#if defined (QTCPSERVER_DEBUG)
qDebug("QTcpServer::incomingConnection(%i)", socketDescriptor);
diff --git a/src/network/socket/qtcpserver.h b/src/network/socket/qtcpserver.h
index 2fe090af32..a322294f58 100644
--- a/src/network/socket/qtcpserver.h
+++ b/src/network/socket/qtcpserver.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -76,8 +76,8 @@ public:
quint16 serverPort() const;
QHostAddress serverAddress() const;
- int socketDescriptor() const;
- bool setSocketDescriptor(int socketDescriptor);
+ qintptr socketDescriptor() const;
+ bool setSocketDescriptor(qintptr socketDescriptor);
bool waitForNewConnection(int msec = 0, bool *timedOut = 0);
virtual bool hasPendingConnections() const;
@@ -92,7 +92,7 @@ public:
#endif
protected:
- virtual void incomingConnection(int handle);
+ virtual void incomingConnection(qintptr handle);
void addPendingConnection(QTcpSocket* socket);
Q_SIGNALS:
diff --git a/src/network/socket/qtcpsocket.cpp b/src/network/socket/qtcpsocket.cpp
index 78fb4cd050..f900ca752c 100644
--- a/src/network/socket/qtcpsocket.cpp
+++ b/src/network/socket/qtcpsocket.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -60,7 +60,7 @@
\bold{Note:} TCP sockets cannot be opened in QIODevice::Unbuffered mode.
- \sa QTcpServer, QUdpSocket, QFtp, QNetworkAccessManager,
+ \sa QTcpServer, QUdpSocket, QNetworkAccessManager,
{Fortune Server Example}, {Fortune Client Example},
{Threaded Fortune Server Example}, {Blocking Fortune Client Example},
{Loopback Example}, {Torrent Example}
diff --git a/src/network/socket/qtcpsocket.h b/src/network/socket/qtcpsocket.h
index 8323836a54..aa2e89d840 100644
--- a/src/network/socket/qtcpsocket.h
+++ b/src/network/socket/qtcpsocket.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/socket/qtcpsocket_p.h b/src/network/socket/qtcpsocket_p.h
index 1ecc274fcd..33672539cc 100644
--- a/src/network/socket/qtcpsocket_p.h
+++ b/src/network/socket/qtcpsocket_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/socket/qudpsocket.cpp b/src/network/socket/qudpsocket.cpp
index e12034d86b..f378fea7b9 100644
--- a/src/network/socket/qudpsocket.cpp
+++ b/src/network/socket/qudpsocket.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/socket/qudpsocket.h b/src/network/socket/qudpsocket.h
index 068c20b9c4..ed5f539732 100644
--- a/src/network/socket/qudpsocket.h
+++ b/src/network/socket/qudpsocket.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/ssl/qssl.cpp b/src/network/ssl/qssl.cpp
index d0d7584ff1..7bb68956ee 100644
--- a/src/network/ssl/qssl.cpp
+++ b/src/network/ssl/qssl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/ssl/qssl.h b/src/network/ssl/qssl.h
index 0793a84671..7da5a78c56 100644
--- a/src/network/ssl/qssl.h
+++ b/src/network/ssl/qssl.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index d1624faaea..5a4702d992 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1177,7 +1177,7 @@ QDebug operator<<(QDebug debug, const QSslCertificate &certificate)
<< ',' << certificate.issuerInfo(QSslCertificate::Organization)
<< ',' << certificate.subjectInfo(QSslCertificate::Organization)
<< ',' << certificate.subjectAlternativeNames()
-#ifndef QT_NO_TEXTSTREAM
+#ifndef QT_NO_DATESTRING
<< ',' << certificate.effectiveDate()
<< ',' << certificate.expiryDate()
#endif
diff --git a/src/network/ssl/qsslcertificate.h b/src/network/ssl/qsslcertificate.h
index dcc7f64aa4..3aa7075eb3 100644
--- a/src/network/ssl/qsslcertificate.h
+++ b/src/network/ssl/qsslcertificate.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Network)
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
class QDateTime;
class QIODevice;
@@ -152,7 +152,7 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslCertificate &certific
Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, QSslCertificate::SubjectInfo info);
#endif
-#endif // QT_NO_OPENSSL
+#endif // QT_NO_SSL
QT_END_NAMESPACE
diff --git a/src/network/ssl/qsslcertificate_p.h b/src/network/ssl/qsslcertificate_p.h
index c4a833460a..031165b267 100644
--- a/src/network/ssl/qsslcertificate_p.h
+++ b/src/network/ssl/qsslcertificate_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/ssl/qsslcertificateextension.h b/src/network/ssl/qsslcertificateextension.h
index 200ae3e091..6c1d219a3b 100644
--- a/src/network/ssl/qsslcertificateextension.h
+++ b/src/network/ssl/qsslcertificateextension.h
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Network)
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
class QSslCertificateExtensionPrivate;
@@ -78,7 +78,7 @@ private:
QSharedDataPointer<QSslCertificateExtensionPrivate> d;
};
-#endif // QT_NO_OPENSSL
+#endif // QT_NO_SSL
QT_END_NAMESPACE
diff --git a/src/network/ssl/qsslcipher.cpp b/src/network/ssl/qsslcipher.cpp
index a583257a88..3c59a8ebf9 100644
--- a/src/network/ssl/qsslcipher.cpp
+++ b/src/network/ssl/qsslcipher.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/ssl/qsslcipher.h b/src/network/ssl/qsslcipher.h
index d9d3b9b31e..8d58fa50ba 100644
--- a/src/network/ssl/qsslcipher.h
+++ b/src/network/ssl/qsslcipher.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Network)
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
class QSslCipherPrivate;
class Q_NETWORK_EXPORT QSslCipher
@@ -88,7 +88,7 @@ class QDebug;
Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslCipher &cipher);
#endif
-#endif // QT_NO_OPENSSL
+#endif // QT_NO_SSL
QT_END_NAMESPACE
diff --git a/src/network/ssl/qsslcipher_p.h b/src/network/ssl/qsslcipher_p.h
index a47c159ade..d4117abe3a 100644
--- a/src/network/ssl/qsslcipher_p.h
+++ b/src/network/ssl/qsslcipher_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp
index 0e9eb5db62..f29bb02813 100644
--- a/src/network/ssl/qsslconfiguration.cpp
+++ b/src/network/ssl/qsslconfiguration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/ssl/qsslconfiguration.h b/src/network/ssl/qsslconfiguration.h
index ff8c8fc4b4..37df073ae9 100644
--- a/src/network/ssl/qsslconfiguration.h
+++ b/src/network/ssl/qsslconfiguration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Network)
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
template<typename T> class QList;
class QSslCertificate;
@@ -132,7 +132,7 @@ private:
QSharedDataPointer<QSslConfigurationPrivate> d;
};
-#endif // QT_NO_OPENSSL
+#endif // QT_NO_SSL
QT_END_NAMESPACE
diff --git a/src/network/ssl/qsslconfiguration_p.h b/src/network/ssl/qsslconfiguration_p.h
index 59078ae7cc..d9f41d6351 100644
--- a/src/network/ssl/qsslconfiguration_p.h
+++ b/src/network/ssl/qsslconfiguration_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/ssl/qsslerror.cpp b/src/network/ssl/qsslerror.cpp
index 5091ed27a4..39e6d6114e 100644
--- a/src/network/ssl/qsslerror.cpp
+++ b/src/network/ssl/qsslerror.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/ssl/qsslerror.h b/src/network/ssl/qsslerror.h
index 451c95f180..0bdc230b2e 100644
--- a/src/network/ssl/qsslerror.h
+++ b/src/network/ssl/qsslerror.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Network)
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
class QSslErrorPrivate;
class Q_NETWORK_EXPORT QSslError
@@ -115,7 +115,7 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslError &error);
Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslError::SslError &error);
#endif
-#endif // QT_NO_OPENSSL
+#endif // QT_NO_SSL
QT_END_NAMESPACE
diff --git a/src/network/ssl/qsslkey.cpp b/src/network/ssl/qsslkey.cpp
index 580b71bca9..cb038d726f 100644
--- a/src/network/ssl/qsslkey.cpp
+++ b/src/network/ssl/qsslkey.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/ssl/qsslkey.h b/src/network/ssl/qsslkey.h
index 7064d22eb4..d7d52fa992 100644
--- a/src/network/ssl/qsslkey.h
+++ b/src/network/ssl/qsslkey.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Network)
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
template <typename A, typename B> struct QPair;
@@ -103,7 +103,7 @@ class QDebug;
Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslKey &key);
#endif
-#endif // QT_NO_OPENSSL
+#endif // QT_NO_SSL
QT_END_NAMESPACE
diff --git a/src/network/ssl/qsslkey_p.h b/src/network/ssl/qsslkey_p.h
index 14075ecad0..1beb2a608a 100644
--- a/src/network/ssl/qsslkey_p.h
+++ b/src/network/ssl/qsslkey_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index e3dd6ae0c5..b428316a77 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -455,7 +455,7 @@ void QSslSocket::connectToHostEncrypted(const QString &hostName, quint16 port,
\sa socketDescriptor()
*/
-bool QSslSocket::setSocketDescriptor(int socketDescriptor, SocketState state, OpenMode openMode)
+bool QSslSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState state, OpenMode openMode)
{
Q_D(QSslSocket);
#ifdef QSSLSOCKET_DEBUG
@@ -1733,16 +1733,16 @@ void QSslSocket::ignoreSslErrors(const QList<QSslError> &errors)
/*!
\internal
*/
-void QSslSocket::connectToHostImplementation(const QString &hostName, quint16 port,
- OpenMode openMode)
+void QSslSocket::connectToHost(const QString &hostName, quint16 port, OpenMode openMode, NetworkLayerProtocol protocol)
{
Q_D(QSslSocket);
+ d->preferredNetworkLayerProtocol = protocol;
if (!d->initialized)
d->init();
d->initialized = false;
#ifdef QSSLSOCKET_DEBUG
- qDebug() << "QSslSocket::connectToHostImplementation("
+ qDebug() << "QSslSocket::connectToHost("
<< hostName << ',' << port << ',' << openMode << ')';
#endif
if (!d->plainSocket) {
@@ -1762,11 +1762,11 @@ void QSslSocket::connectToHostImplementation(const QString &hostName, quint16 po
/*!
\internal
*/
-void QSslSocket::disconnectFromHostImplementation()
+void QSslSocket::disconnectFromHost()
{
Q_D(QSslSocket);
#ifdef QSSLSOCKET_DEBUG
- qDebug() << "QSslSocket::disconnectFromHostImplementation()";
+ qDebug() << "QSslSocket::disconnectFromHost()";
#endif
if (!d->plainSocket)
return;
diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h
index 803e79e0c4..936f27905a 100644
--- a/src/network/ssl/qsslsocket.h
+++ b/src/network/ssl/qsslsocket.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -45,7 +45,7 @@
#include <QtCore/qlist.h>
#include <QtCore/qregexp.h>
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
# include <QtNetwork/qtcpsocket.h>
# include <QtNetwork/qsslerror.h>
#endif
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Network)
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
class QDir;
class QSslCipher;
@@ -87,9 +87,12 @@ public:
// Autostarting the SSL client handshake.
void connectToHostEncrypted(const QString &hostName, quint16 port, OpenMode mode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol);
void connectToHostEncrypted(const QString &hostName, quint16 port, const QString &sslPeerName, OpenMode mode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol);
- bool setSocketDescriptor(int socketDescriptor, SocketState state = ConnectedState,
+ bool setSocketDescriptor(qintptr socketDescriptor, SocketState state = ConnectedState,
OpenMode openMode = ReadWrite);
+ void connectToHost(const QString &hostName, quint16 port, OpenMode openMode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol);
+ void disconnectFromHost();
+
// ### Qt 5: Make virtual
void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value);
QVariant socketOption(QAbstractSocket::SocketOption option);
@@ -193,11 +196,6 @@ Q_SIGNALS:
void modeChanged(QSslSocket::SslMode newMode);
void encryptedBytesWritten(qint64 totalBytes);
-protected Q_SLOTS:
- void connectToHostImplementation(const QString &hostName, quint16 port,
- OpenMode openMode);
- void disconnectFromHostImplementation();
-
protected:
qint64 readData(char *data, qint64 maxlen);
qint64 writeData(const char *data, qint64 len);
@@ -217,7 +215,7 @@ private:
friend class QSslSocketBackendPrivate;
};
-#endif // QT_NO_OPENSSL
+#endif // QT_NO_SSL
QT_END_NAMESPACE
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index f70b4217bd..96b2c8170b 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -225,6 +225,27 @@ static int q_X509Callback(int ok, X509_STORE_CTX *ctx)
if (!ok) {
// Store the error and at which depth the error was detected.
_q_sslErrorList()->errors << qMakePair<int, int>(ctx->error, ctx->error_depth);
+#ifdef QSSLSOCKET_DEBUG
+ qDebug() << "verification error: dumping bad certificate";
+ qDebug() << QSslCertificatePrivate::QSslCertificate_from_X509(ctx->current_cert).toPem();
+ qDebug() << "dumping chain";
+ foreach (QSslCertificate cert, QSslSocketBackendPrivate::STACKOFX509_to_QSslCertificates(ctx->chain)) {
+ QString certFormat(QStringLiteral("O=%1 CN=%2 L=%3 OU=%4 C=%5 ST=%6"));
+ qDebug() << "Issuer:" << "O=" << cert.issuerInfo(QSslCertificate::Organization)
+ << "CN=" << cert.issuerInfo(QSslCertificate::CommonName)
+ << "L=" << cert.issuerInfo(QSslCertificate::LocalityName)
+ << "OU=" << cert.issuerInfo(QSslCertificate::OrganizationalUnitName)
+ << "C=" << cert.issuerInfo(QSslCertificate::CountryName)
+ << "ST=" << cert.issuerInfo(QSslCertificate::StateOrProvinceName);
+ qDebug() << "Subject:" << "O=" << cert.subjectInfo(QSslCertificate::Organization)
+ << "CN=" << cert.subjectInfo(QSslCertificate::CommonName)
+ << "L=" << cert.subjectInfo(QSslCertificate::LocalityName)
+ << "OU=" << cert.subjectInfo(QSslCertificate::OrganizationalUnitName)
+ << "C=" << cert.subjectInfo(QSslCertificate::CountryName)
+ << "ST=" << cert.subjectInfo(QSslCertificate::StateOrProvinceName);
+ qDebug() << "Valid:" << cert.effectiveDate() << "-" << cert.expiryDate();
+ }
+#endif
}
// Always return OK to allow verification to continue. We're handle the
// errors gracefully after collecting all errors, after verification has
@@ -343,7 +364,7 @@ init_context:
foreach (const QSslCertificate &caCertificate, q->caCertificates()) {
// add expired certs later, so that the
// valid ones are used before the expired ones
- if (caCertificate.expiryDate() > QDateTime::currentDateTime()) {
+ if (caCertificate.expiryDate() < QDateTime::currentDateTime()) {
expiredCerts.append(caCertificate);
} else {
q_X509_STORE_add_cert(ctx->cert_store, reinterpret_cast<X509 *>(caCertificate.handle()));
@@ -453,11 +474,7 @@ init_context:
if (!ace.isEmpty()
&& !QHostAddress().setAddress(tlsHostName)
&& !(configuration.sslOptions & QSsl::SslOptionDisableServerNameIndication)) {
-#if OPENSSL_VERSION_NUMBER >= 0x10000000L
if (!q_SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_HOSTNAME, TLSEXT_NAMETYPE_host_name, ace.data()))
-#else
- if (!q_SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_HOSTNAME, TLSEXT_NAMETYPE_host_name, ace.constData()))
-#endif
qWarning("could not set SSL_CTRL_SET_TLSEXT_HOSTNAME, Server Name Indication disabled");
}
}
@@ -874,10 +891,17 @@ void QSslSocketBackendPrivate::transmit()
int encryptedBytesRead = q_BIO_read(writeBio, data.data(), pendingBytes);
// Write encrypted data from the buffer to the socket.
- plainSocket->write(data.constData(), encryptedBytesRead);
+ qint64 actualWritten = plainSocket->write(data.constData(), encryptedBytesRead);
#ifdef QSSLSOCKET_DEBUG
- qDebug() << "QSslSocketBackendPrivate::transmit: wrote" << encryptedBytesRead << "encrypted bytes to the socket";
+ qDebug() << "QSslSocketBackendPrivate::transmit: wrote" << encryptedBytesRead << "encrypted bytes to the socket" << actualWritten << "actual.";
#endif
+ if (actualWritten < 0) {
+ //plain socket write fails if it was in the pending close state.
+ q->setErrorString(plainSocket->errorString());
+ q->setSocketError(plainSocket->error());
+ emit q->error(plainSocket->error());
+ return;
+ }
transmitting = true;
}
@@ -1351,7 +1375,7 @@ QList<QSslError> QSslSocketBackendPrivate::verify(QList<QSslCertificate> certifi
foreach (const QSslCertificate &caCertificate, QSslSocket::defaultCaCertificates()) {
// add expired certs later, so that the
// valid ones are used before the expired ones
- if (caCertificate.expiryDate() > QDateTime::currentDateTime()) {
+ if (caCertificate.expiryDate() < QDateTime::currentDateTime()) {
expiredCerts.append(caCertificate);
} else {
q_X509_STORE_add_cert(certStore, reinterpret_cast<X509 *>(caCertificate.handle()));
diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h
index ef00b0998d..4d1ed9e681 100644
--- a/src/network/ssl/qsslsocket_openssl_p.h
+++ b/src/network/ssl/qsslsocket_openssl_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -105,8 +105,6 @@ public:
BIO *readBio;
BIO *writeBio;
SSL_SESSION *session;
- X509_STORE *certificateStore;
- X509_STORE_CTX *certificateStoreCtx;
QList<QPair<int, int> > errorList;
// Platform specific functions
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index cd27c31456..c3bee3edd2 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -218,11 +218,7 @@ DEFINEFUNC(int, SSL_library_init, void, DUMMYARG, return -1, return)
DEFINEFUNC(void, SSL_load_error_strings, void, DUMMYARG, return, DUMMYARG)
DEFINEFUNC(SSL *, SSL_new, SSL_CTX *a, a, return 0, return)
#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT)
-#if OPENSSL_VERSION_NUMBER >= 0x10000000L
DEFINEFUNC4(long, SSL_ctrl, SSL *a, a, int cmd, cmd, long larg, larg, void *parg, parg, return -1, return)
-#else
-DEFINEFUNC4(long, SSL_ctrl, SSL *a, a, int cmd, cmd, long larg, larg, const void *parg, parg, return -1, return)
-#endif
#endif
DEFINEFUNC3(int, SSL_read, SSL *a, a, void *b, b, int c, c, return -1, return)
DEFINEFUNC3(void, SSL_set_bio, SSL *a, a, BIO *b, b, BIO *c, c, return, DUMMYARG)
diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h
index ad7a0a7557..1f1e842c13 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols_p.h
+++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -325,11 +325,7 @@ int q_SSL_library_init();
void q_SSL_load_error_strings();
SSL *q_SSL_new(SSL_CTX *a);
#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT)
-#if OPENSSL_VERSION_NUMBER >= 0x10000000L
long q_SSL_ctrl(SSL *ssl,int cmd, long larg, void *parg);
-#else
-long q_SSL_ctrl(SSL *ssl,int cmd, long larg, const void *parg);
-#endif
#endif
int q_SSL_read(SSL *a, void *b, int c);
void q_SSL_set_bio(SSL *a, BIO *b, BIO *c);
@@ -431,11 +427,7 @@ DSA *q_d2i_DSAPrivateKey(DSA **a, unsigned char **pp, long length);
(char *)(rsa))
#define q_EVP_PKEY_assign_DSA(pkey,dsa) q_EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\
(char *)(dsa))
-#ifdef OPENSSL_LOAD_CONF
#define q_OpenSSL_add_all_algorithms() q_OPENSSL_add_all_algorithms_conf()
-#else
-#define q_OpenSSL_add_all_algorithms() q_OPENSSL_add_all_algorithms_noconf()
-#endif
void q_OPENSSL_add_all_algorithms_noconf();
void q_OPENSSL_add_all_algorithms_conf();
int q_SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, const char *CApath);
diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h
index b1dc656e88..6fa443d0c7 100644
--- a/src/network/ssl/qsslsocket_p.h
+++ b/src/network/ssl/qsslsocket_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp b/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp
index 4374f80d35..50444ecc86 100644
--- a/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp
+++ b/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h
index 904d20bdbb..8324bab28e 100644
--- a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h
+++ b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp
index 550b65237b..9f1cd3cf32 100644
--- a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp
+++ b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h
index 392c7775f8..166779cd75 100644
--- a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h
+++ b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
index aebdce6e01..4daed7ebfa 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -246,8 +246,7 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context)
if (!inCache)
simpleShaderCache.store(simpleShaderProg, context);
} else {
- qCritical() << "Errors linking simple shader:"
- << simpleShaderProg->log();
+ qCritical("Errors linking simple shader: %s", qPrintable(simpleShaderProg->log()));
}
// Compile the blit shader:
@@ -288,8 +287,7 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context)
if (!inCache)
blitShaderCache.store(blitShaderProg, context);
} else {
- qCritical() << "Errors linking blit shader:"
- << blitShaderProg->log();
+ qCritical("Errors linking blit shader: %s", qPrintable(blitShaderProg->log()));
}
#ifdef QT_GL_SHARED_SHADER_DEBUG
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
index 58c761df43..fc922928cd 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
index 1d35124bc8..8a6bce0d8c 100644
--- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/gl2paintengineex/qglgradientcache.cpp b/src/opengl/gl2paintengineex/qglgradientcache.cpp
index 6ca09ba140..96a8a4c33a 100644
--- a/src/opengl/gl2paintengineex/qglgradientcache.cpp
+++ b/src/opengl/gl2paintengineex/qglgradientcache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/gl2paintengineex/qglgradientcache_p.h b/src/opengl/gl2paintengineex/qglgradientcache_p.h
index 600085a75f..105afb157e 100644
--- a/src/opengl/gl2paintengineex/qglgradientcache_p.h
+++ b/src/opengl/gl2paintengineex/qglgradientcache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/gl2paintengineex/qglshadercache_meego_p.h b/src/opengl/gl2paintengineex/qglshadercache_meego_p.h
index 5f239a698d..2d013ae77a 100644
--- a/src/opengl/gl2paintengineex/qglshadercache_meego_p.h
+++ b/src/opengl/gl2paintengineex/qglshadercache_meego_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/gl2paintengineex/qglshadercache_p.h b/src/opengl/gl2paintengineex/qglshadercache_p.h
index 9fd16fcff9..26f5076a5a 100644
--- a/src/opengl/gl2paintengineex/qglshadercache_p.h
+++ b/src/opengl/gl2paintengineex/qglshadercache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 45ac639286..85773fa3cc 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -674,8 +674,8 @@ void QGL2PaintEngineExPrivate::cleanupVectorPath(QPaintEngineEx *engine, void *d
d->unusedIBOSToClean << c->ibo;
#else
Q_UNUSED(engine);
- qFree(c->vertices);
- qFree(c->indices);
+ free(c->vertices);
+ free(c->indices);
#endif
delete c;
}
@@ -720,7 +720,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
cache->vbo = 0;
Q_ASSERT(cache->ibo == 0);
#else
- qFree(cache->vertices);
+ free(cache->vertices);
Q_ASSERT(cache->indices == 0);
#endif
updateCache = true;
@@ -748,7 +748,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
glBufferData(GL_ARRAY_BUFFER, floatSizeInBytes, vertexCoordinateArray.data(), GL_STATIC_DRAW);
cache->ibo = 0;
#else
- cache->vertices = (float *) qMalloc(floatSizeInBytes);
+ cache->vertices = (float *) malloc(floatSizeInBytes);
memcpy(cache->vertices, vertexCoordinateArray.data(), floatSizeInBytes);
cache->indices = 0;
#endif
@@ -800,8 +800,8 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
glDeleteBuffers(1, &cache->vbo);
glDeleteBuffers(1, &cache->ibo);
#else
- qFree(cache->vertices);
- qFree(cache->indices);
+ free(cache->vertices);
+ free(cache->indices);
#endif
updateCache = true;
}
@@ -836,12 +836,12 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
vertices[i] = float(inverseScale * polys.vertices.at(i));
glBufferData(GL_ARRAY_BUFFER, sizeof(float) * vertices.size(), vertices.data(), GL_STATIC_DRAW);
#else
- cache->vertices = (float *) qMalloc(sizeof(float) * polys.vertices.size());
+ cache->vertices = (float *) malloc(sizeof(float) * polys.vertices.size());
if (polys.indices.type() == QVertexIndexVector::UnsignedInt) {
- cache->indices = (quint32 *) qMalloc(sizeof(quint32) * polys.indices.size());
+ cache->indices = (quint32 *) malloc(sizeof(quint32) * polys.indices.size());
memcpy(cache->indices, polys.indices.data(), sizeof(quint32) * polys.indices.size());
} else {
- cache->indices = (quint16 *) qMalloc(sizeof(quint16) * polys.indices.size());
+ cache->indices = (quint16 *) malloc(sizeof(quint16) * polys.indices.size());
memcpy(cache->indices, polys.indices.data(), sizeof(quint16) * polys.indices.size());
}
for (int i = 0; i < polys.vertices.size(); ++i)
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index dbf760929c..629a0f3ddb 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
index 3a3abb19d4..c3f0257100 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
index 7b7da9d8e8..ca5832ca4a 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
index 29e660fbc7..7cad66e6ec 100644
--- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
+++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h
index 2985a6e550..3dbadaadde 100644
--- a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h
+++ b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 42235bca18..7afbaa9343 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -3582,7 +3582,7 @@ QGLWidget::~QGLWidget()
*/
/*!
- \fn void *QGLContext::getProcAddress(const QString &proc) const
+ \fn QFunctionPointer QGLContext::getProcAddress() const
Returns a function pointer to the GL extension function passed in
\a proc. 0 is returned if a pointer to the function could not be
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h
index 5f164440be..85c4eb9dbc 100644
--- a/src/opengl/qgl.h
+++ b/src/opengl/qgl.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -322,7 +322,7 @@ public:
static void setTextureCacheLimit(int size);
static int textureCacheLimit();
- void *getProcAddress(const QString &proc) const;
+ QFunctionPointer getProcAddress(const QString &proc) const;
QPaintDevice* device() const;
QColor overlayTransparentColor() const;
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 2f8b677b7c..78eb2d5d6b 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp
index afa2772a6f..009b43d297 100644
--- a/src/opengl/qgl_qpa.cpp
+++ b/src/opengl/qgl_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -231,10 +231,10 @@ void QGLContext::swapBuffers() const
d->guiGlContext->swapBuffers(widget->windowHandle());
}
-void *QGLContext::getProcAddress(const QString &procName) const
+QFunctionPointer QGLContext::getProcAddress(const QString &procName) const
{
Q_D(const QGLContext);
- return (void *)d->guiGlContext->getProcAddress(procName.toAscii());
+ return d->guiGlContext->getProcAddress(procName.toAscii());
}
void QGLWidget::setContext(QGLContext *context,
diff --git a/src/opengl/qglbuffer.cpp b/src/opengl/qglbuffer.cpp
index c1128a0ebd..baeac676e7 100644
--- a/src/opengl/qglbuffer.cpp
+++ b/src/opengl/qglbuffer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qglbuffer.h b/src/opengl/qglbuffer.h
index 0acf0c32ed..3dece18ab3 100644
--- a/src/opengl/qglbuffer.h
+++ b/src/opengl/qglbuffer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qglcolormap.cpp b/src/opengl/qglcolormap.cpp
index 8ff2f9fa0a..8a3c9d7b86 100644
--- a/src/opengl/qglcolormap.cpp
+++ b/src/opengl/qglcolormap.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qglcolormap.h b/src/opengl/qglcolormap.h
index cc8519173b..5774aea1d0 100644
--- a/src/opengl/qglcolormap.h
+++ b/src/opengl/qglcolormap.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qglextensions.cpp b/src/opengl/qglextensions.cpp
index 42f1ea59dd..34196b6181 100644
--- a/src/opengl/qglextensions.cpp
+++ b/src/opengl/qglextensions.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -43,13 +43,11 @@
QT_BEGIN_NAMESPACE
-static void *qt_gl_getProcAddress_search
+static QFunctionPointer qt_gl_getProcAddress_search
(QGLContext *ctx, const char *name1, const char *name2,
const char *name3, const char *name4)
{
- void *addr;
-
- addr = ctx->getProcAddress(QLatin1String(name1));
+ QFunctionPointer addr = ctx->getProcAddress(QLatin1String(name1));
if (addr)
return addr;
diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h
index d391a99643..f8eff5a8bc 100644
--- a/src/opengl/qglextensions_p.h
+++ b/src/opengl/qglextensions_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index d0d2b2773f..dc62bf0426 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qglframebufferobject.h b/src/opengl/qglframebufferobject.h
index 817aecd9b7..a3211ebdfd 100644
--- a/src/opengl/qglframebufferobject.h
+++ b/src/opengl/qglframebufferobject.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h
index 61d39c6a07..461d13bbcc 100644
--- a/src/opengl/qglframebufferobject_p.h
+++ b/src/opengl/qglframebufferobject_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qglfunctions.cpp b/src/opengl/qglfunctions.cpp
index 227e6cc176..9c84fe637e 100644
--- a/src/opengl/qglfunctions.cpp
+++ b/src/opengl/qglfunctions.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qglfunctions.h b/src/opengl/qglfunctions.h
index 3b50a1cd66..725fc22bc5 100644
--- a/src/opengl/qglfunctions.h
+++ b/src/opengl/qglfunctions.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp
index 08807bdd49..1ef13259c5 100644
--- a/src/opengl/qglpaintdevice.cpp
+++ b/src/opengl/qglpaintdevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qglpaintdevice_p.h b/src/opengl/qglpaintdevice_p.h
index 32ae85dc90..c630009171 100644
--- a/src/opengl/qglpaintdevice_p.h
+++ b/src/opengl/qglpaintdevice_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp
index ddabbef0b2..39f589cbab 100644
--- a/src/opengl/qglpixelbuffer.cpp
+++ b/src/opengl/qglpixelbuffer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qglpixelbuffer.h b/src/opengl/qglpixelbuffer.h
index 0c7ad38237..09a7eeec7c 100644
--- a/src/opengl/qglpixelbuffer.h
+++ b/src/opengl/qglpixelbuffer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qglpixelbuffer_p.h b/src/opengl/qglpixelbuffer_p.h
index 05e161b7ef..559af5d63e 100644
--- a/src/opengl/qglpixelbuffer_p.h
+++ b/src/opengl/qglpixelbuffer_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qglpixelbuffer_stub.cpp b/src/opengl/qglpixelbuffer_stub.cpp
index 0d1d8d6d21..8d8cd93975 100644
--- a/src/opengl/qglpixelbuffer_stub.cpp
+++ b/src/opengl/qglpixelbuffer_stub.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index af093bc9b4..6ffba78b7c 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h
index 591aab27cd..3af47e5939 100644
--- a/src/opengl/qglshaderprogram.h
+++ b/src/opengl/qglshaderprogram.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qgraphicsshadereffect.cpp b/src/opengl/qgraphicsshadereffect.cpp
index c785fb29ad..b0c46a96cd 100644
--- a/src/opengl/qgraphicsshadereffect.cpp
+++ b/src/opengl/qgraphicsshadereffect.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/opengl/qgraphicsshadereffect_p.h b/src/opengl/qgraphicsshadereffect_p.h
index 7ae5f53d7e..de6048acbf 100644
--- a/src/opengl/qgraphicsshadereffect_p.h
+++ b/src/opengl/qgraphicsshadereffect_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/cglconvenience/cglconvenience.mm b/src/platformsupport/cglconvenience/cglconvenience.mm
index 280baf48a5..a1a7f8bd89 100644
--- a/src/platformsupport/cglconvenience/cglconvenience.mm
+++ b/src/platformsupport/cglconvenience/cglconvenience.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/cglconvenience/cglconvenience_p.h b/src/platformsupport/cglconvenience/cglconvenience_p.h
index facf8c9b7f..8ac5039bf3 100644
--- a/src/platformsupport/cglconvenience/cglconvenience_p.h
+++ b/src/platformsupport/cglconvenience/cglconvenience_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/dnd/qsimpledrag.cpp b/src/platformsupport/dnd/qsimpledrag.cpp
index 72da29c063..857bc0356a 100644
--- a/src/platformsupport/dnd/qsimpledrag.cpp
+++ b/src/platformsupport/dnd/qsimpledrag.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/dnd/qsimpledrag_p.h b/src/platformsupport/dnd/qsimpledrag_p.h
index 82668a68c9..980be04ff8 100644
--- a/src/platformsupport/dnd/qsimpledrag_p.h
+++ b/src/platformsupport/dnd/qsimpledrag_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp
index ea4b5566c5..5a01e5a03c 100644
--- a/src/platformsupport/eglconvenience/qeglconvenience.cpp
+++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/eglconvenience/qeglconvenience_p.h b/src/platformsupport/eglconvenience/qeglconvenience_p.h
index 7b5b970415..1384f11b5e 100644
--- a/src/platformsupport/eglconvenience/qeglconvenience_p.h
+++ b/src/platformsupport/eglconvenience/qeglconvenience_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
index 1f1f215494..cab551fe51 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
index 7002c8b9c2..a0e984b390 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/eglconvenience/qxlibeglintegration.cpp b/src/platformsupport/eglconvenience/qxlibeglintegration.cpp
index aeebd35d21..a0a758fc51 100644
--- a/src/platformsupport/eglconvenience/qxlibeglintegration.cpp
+++ b/src/platformsupport/eglconvenience/qxlibeglintegration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/eglconvenience/qxlibeglintegration_p.h b/src/platformsupport/eglconvenience/qxlibeglintegration_p.h
index ad77754eee..3a2de0d780 100644
--- a/src/platformsupport/eglconvenience/qxlibeglintegration_p.h
+++ b/src/platformsupport/eglconvenience/qxlibeglintegration_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/eventdispatchers/eventdispatchers.pri b/src/platformsupport/eventdispatchers/eventdispatchers.pri
index 38aca26b42..9e6ff282ce 100644
--- a/src/platformsupport/eventdispatchers/eventdispatchers.pri
+++ b/src/platformsupport/eventdispatchers/eventdispatchers.pri
@@ -1,10 +1,10 @@
unix {
SOURCES +=\
- $$PWD/qeventdispatcher_qpa.cpp\
+ $$PWD/qunixeventdispatcher_qpa.cpp\
$$PWD/qgenericunixeventdispatcher.cpp\
HEADERS +=\
- $$PWD/qeventdispatcher_qpa_p.h\
+ $$PWD/qunixeventdispatcher_qpa_p.h\
$$PWD/qgenericunixeventdispatcher_p.h\
}
diff --git a/src/platformsupport/eventdispatchers/qeventdispatcher_glib.cpp b/src/platformsupport/eventdispatchers/qeventdispatcher_glib.cpp
index 005c44a034..75ce257aac 100644
--- a/src/platformsupport/eventdispatchers/qeventdispatcher_glib.cpp
+++ b/src/platformsupport/eventdispatchers/qeventdispatcher_glib.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h b/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h
index 8a34e78357..e329dfb0b2 100644
--- a/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h
+++ b/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher.cpp b/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher.cpp
index ba783c547a..01e6866158 100644
--- a/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher.cpp
+++ b/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -40,7 +40,7 @@
****************************************************************************/
#include "qgenericunixeventdispatcher_p.h"
-#include "qeventdispatcher_qpa_p.h"
+#include "qunixeventdispatcher_qpa_p.h"
#include "qeventdispatcher_glib_p.h"
QT_BEGIN_NAMESPACE
@@ -52,7 +52,7 @@ class QAbstractEventDispatcher *createUnixEventDispatcher()
return new QPAEventDispatcherGlib();
else
#endif
- return new QEventDispatcherQPA();
+ return new QUnixEventDispatcherQPA();
}
QT_END_NAMESPACE
diff --git a/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher_p.h b/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher_p.h
index e50f57d9a8..453fa06e13 100644
--- a/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher_p.h
+++ b/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/eventdispatchers/qeventdispatcher_qpa.cpp b/src/platformsupport/eventdispatchers/qunixeventdispatcher_qpa.cpp
index 8ccb181365..838c59174d 100644
--- a/src/platformsupport/eventdispatchers/qeventdispatcher_qpa.cpp
+++ b/src/platformsupport/eventdispatchers/qunixeventdispatcher_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -41,7 +41,7 @@
#include "qplatformdefs.h"
#include "qcoreapplication.h"
-#include "qeventdispatcher_qpa_p.h"
+#include "qunixeventdispatcher_qpa_p.h"
#include "private/qguiapplication_p.h"
#include <QWindowSystemInterface>
@@ -58,14 +58,14 @@ QT_BEGIN_NAMESPACE
QT_USE_NAMESPACE
-QEventDispatcherQPA::QEventDispatcherQPA(QObject *parent)
+QUnixEventDispatcherQPA::QUnixEventDispatcherQPA(QObject *parent)
: QEventDispatcherUNIX(parent)
{ }
-QEventDispatcherQPA::~QEventDispatcherQPA()
+QUnixEventDispatcherQPA::~QUnixEventDispatcherQPA()
{ }
-bool QEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags)
+bool QUnixEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags)
{
bool didSendEvents = QWindowSystemInterface::sendWindowSystemEvents(this, flags);
@@ -76,13 +76,13 @@ bool QEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags)
return didSendEvents;
}
-bool QEventDispatcherQPA::hasPendingEvents()
+bool QUnixEventDispatcherQPA::hasPendingEvents()
{
extern uint qGlobalPostedEventsCount(); // from qapplication.cpp
return qGlobalPostedEventsCount() || QWindowSystemInterface::windowSystemEventsQueued();
}
-void QEventDispatcherQPA::flush()
+void QUnixEventDispatcherQPA::flush()
{
if(qApp)
qApp->sendPostedEvents();
diff --git a/src/platformsupport/eventdispatchers/qeventdispatcher_qpa_p.h b/src/platformsupport/eventdispatchers/qunixeventdispatcher_qpa_p.h
index 7aeb795742..b242f6350b 100644
--- a/src/platformsupport/eventdispatchers/qeventdispatcher_qpa_p.h
+++ b/src/platformsupport/eventdispatchers/qunixeventdispatcher_qpa_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QEVENTDISPATCHER_QPA_H
-#define QEVENTDISPATCHER_QPA_H
+#ifndef QUNIXEVENTDISPATCHER_QPA_H
+#define QUNIXEVENTDISPATCHER_QPA_H
//
// W A R N I N G
@@ -58,16 +58,16 @@
QT_BEGIN_NAMESPACE
-class QEventDispatcherQPAPrivate;
+class QUnixEventDispatcherQPAPrivate;
-class Q_PLATFORMSUPPORT_EXPORT QEventDispatcherQPA : public QEventDispatcherUNIX
+class Q_PLATFORMSUPPORT_EXPORT QUnixEventDispatcherQPA : public QEventDispatcherUNIX
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QEventDispatcherQPA)
+ Q_DECLARE_PRIVATE(QUnixEventDispatcherQPA)
public:
- explicit QEventDispatcherQPA(QObject *parent = 0);
- ~QEventDispatcherQPA();
+ explicit QUnixEventDispatcherQPA(QObject *parent = 0);
+ ~QUnixEventDispatcherQPA();
bool processEvents(QEventLoop::ProcessEventsFlags flags);
bool hasPendingEvents();
@@ -77,4 +77,4 @@ public:
QT_END_NAMESPACE
-#endif // QEVENTDISPATCHER_QPA_H
+#endif // QUNIXEVENTDISPATCHER_QPA_H
diff --git a/src/platformsupport/fb_base/fb_base.cpp b/src/platformsupport/fb_base/fb_base.cpp
index aa395fec29..37b20752c2 100644
--- a/src/platformsupport/fb_base/fb_base.cpp
+++ b/src/platformsupport/fb_base/fb_base.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/fb_base/fb_base_p.h b/src/platformsupport/fb_base/fb_base_p.h
index 6b0b152482..d5c825092d 100644
--- a/src/platformsupport/fb_base/fb_base_p.h
+++ b/src/platformsupport/fb_base/fb_base_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp
index 9c5d3be637..eb951cad41 100644
--- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp
+++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h
index 3816ec5862..e7ccce445c 100644
--- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h
+++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index 0f4adca6f7..a859f6c672 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -724,7 +724,7 @@ QString QFontconfigDatabase::resolveFontFamilyAlias(const QString &family) const
FcConfigSubstitute(0, pattern, FcMatchPattern);
FcDefaultSubstitute(pattern);
- FcChar8 *familyAfterSubstitution;
+ FcChar8 *familyAfterSubstitution = 0;
FcPatternGetString(pattern, FC_FAMILY, 0, &familyAfterSubstitution);
QString resolved = QString::fromUtf8((const char *) familyAfterSubstitution);
FcPatternDestroy(pattern);
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h
index ecf2d4da49..389338b911 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/fontdatabases/genericunix/qgenericunixfontdatabase_p.h b/src/platformsupport/fontdatabases/genericunix/qgenericunixfontdatabase_p.h
index ef2414a2d5..55e33fffaa 100644
--- a/src/platformsupport/fontdatabases/genericunix/qgenericunixfontdatabase_p.h
+++ b/src/platformsupport/fontdatabases/genericunix/qgenericunixfontdatabase_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 6c3e403c51..dc54efd67b 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -159,6 +159,8 @@ static QString familyNameFromPostScriptName(QHash<QString, QString> &psNameToFam
void QCoreTextFontDatabase::populateFontDatabase()
{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
QCFType<CTFontCollectionRef> collection = CTFontCollectionCreateFromAvailableFonts(0);
if (! collection)
return;
@@ -243,8 +245,6 @@ void QCoreTextFontDatabase::populateFontDatabase()
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *languages = [defaults stringArrayForKey: @"AppleLanguages"];
- NSAutoreleasePool *pool = [NSAutoreleasePool new];
-
NSDictionary *fallbackDict = [NSDictionary dictionaryWithContentsOfFile: @"/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/Resources/DefaultFontFallbacks.plist"];
for (NSString *style in [fallbackDict allKeys]) {
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
index 63012f4f8d..3e77548de6 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 687ddb2486..fa18de9621 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
index 502cf3819c..543c170cdd 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/glxconvenience/glxconvenience.pri b/src/platformsupport/glxconvenience/glxconvenience.pri
index 5b65e13306..3632f45b54 100644
--- a/src/platformsupport/glxconvenience/glxconvenience.pri
+++ b/src/platformsupport/glxconvenience/glxconvenience.pri
@@ -1,5 +1,6 @@
-contains(QT_CONFIG,xlib) {
+contains(QT_CONFIG,xlib):contains(QT_CONFIG,xrender) {
contains(QT_CONFIG,opengl):!contains(QT_CONFIG,opengles2) {
+ LIBS += $$QMAKE_LIBS_X11 -lXrender
HEADERS += $$PWD/qglxconvenience_p.h
SOURCES += $$PWD/qglxconvenience.cpp
}
diff --git a/src/platformsupport/glxconvenience/qglxconvenience.cpp b/src/platformsupport/glxconvenience/qglxconvenience.cpp
index ce0c49d93f..a857d734c3 100644
--- a/src/platformsupport/glxconvenience/qglxconvenience.cpp
+++ b/src/platformsupport/glxconvenience/qglxconvenience.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/glxconvenience/qglxconvenience_p.h b/src/platformsupport/glxconvenience/qglxconvenience_p.h
index 4892b07729..df6fe99ed8 100644
--- a/src/platformsupport/glxconvenience/qglxconvenience_p.h
+++ b/src/platformsupport/glxconvenience/qglxconvenience_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp
index fa16fea628..aa268ff940 100644
--- a/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp
+++ b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa_p.h b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa_p.h
index 5c42931357..c43658dd4a 100644
--- a/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa_p.h
+++ b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa.cpp b/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa.cpp
index 380ab06d9c..737eab1a66 100644
--- a/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa.cpp
+++ b/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa_p.h b/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa_p.h
index ea9b10f66c..e0ed477acb 100644
--- a/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa_p.h
+++ b/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/printersupport/genericunix/qgenericunixprintersupport.cpp b/src/platformsupport/printersupport/genericunix/qgenericunixprintersupport.cpp
index bac5ba20f0..db4737706e 100644
--- a/src/platformsupport/printersupport/genericunix/qgenericunixprintersupport.cpp
+++ b/src/platformsupport/printersupport/genericunix/qgenericunixprintersupport.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/platformsupport/printersupport/genericunix/qgenericunixprintersupport_p.h b/src/platformsupport/printersupport/genericunix/qgenericunixprintersupport_p.h
index bcfc36799f..95d8280659 100644
--- a/src/platformsupport/printersupport/genericunix/qgenericunixprintersupport_p.h
+++ b/src/platformsupport/printersupport/genericunix/qgenericunixprintersupport_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/accessible/widgets/complexwidgets.cpp b/src/plugins/accessible/widgets/complexwidgets.cpp
index 1ceeb31b16..2c1330f188 100644
--- a/src/plugins/accessible/widgets/complexwidgets.cpp
+++ b/src/plugins/accessible/widgets/complexwidgets.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -68,1378 +68,6 @@ QT_BEGIN_NAMESPACE
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
-#if 0
-#ifndef QT_NO_ITEMVIEWS
-/*
-The MSDN article "Exposing Data Tables through Microsoft Active Accessibility" explains
-how data tables should be exposed. Url: http://msdn2.microsoft.com/en-us/library/ms971325.aspx
-Basically, the model is like this:
-
-ROLE_SYSTEM_TABLE
- |- ROLE_SYSTEM_ROW
- | |- ROLE_SYSTEM_ROWHEADER
- | |- ROLE_SYSTEM_COLUMNHEADER
- | |- ROLE_SYSTEM_COLUMNHEADER
- | |- ROLE_SYSTEM_COLUMNHEADER
- | '- ..
- |- ROLE_SYSTEM_ROW
- | |- ROLE_SYSTEM_ROWHEADER
- | |- ROLE_SYSTEM_CELL
- | |- ROLE_SYSTEM_CELL
- | |- ROLE_SYSTEM_CELL
- | '- ..
- |- ROLE_SYSTEM_ROW
- | |- ROLE_SYSTEM_ROWHEADER
- | |- ROLE_SYSTEM_CELL
- | |- ROLE_SYSTEM_CELL
- | |- ROLE_SYSTEM_CELL
- | '- ..
- '- ..
-
-The headers of QTreeView is also represented like this.
-*/
-QAccessibleItemRow::QAccessibleItemRow(QAbstractItemView *aView, const QModelIndex &index, bool isHeader)
- : row(index), view(aView), m_header(isHeader)
-{
-}
-
-QHeaderView *QAccessibleItemRow::horizontalHeader() const
-{
- QHeaderView *header = 0;
- if (m_header) {
- if (false) {
-#ifndef QT_NO_TABLEVIEW
- } else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
- header = tv->horizontalHeader();
-#endif
-#ifndef QT_NO_TREEVIEW
- } else if (const QTreeView *tv = qobject_cast<const QTreeView*>(view)) {
- header = tv->header();
-#endif
- }
- }
- return header;
-}
-
-QHeaderView *QAccessibleItemRow::verticalHeader() const
-{
- QHeaderView *header = 0;
-#ifndef QT_NO_TABLEVIEW
- if (const QTableView *tv = qobject_cast<const QTableView*>(view))
- header = tv->verticalHeader();
-#endif
- return header;
-}
-
-int QAccessibleItemRow::logicalFromChild(QHeaderView *header, int child) const
-{
- int logical = -1;
- if (header->sectionsHidden()) {
- int kid = 0;
- for (int i = 0; i < header->count(); ++i) {
- if (!header->isSectionHidden(i))
- ++kid;
- if (kid == child) {
- logical = i;
- break;
- }
- }
- } else {
- logical = child - 1;
- }
- return logical;
-}
-
-QRect QAccessibleItemRow::rect(int child) const
-{
- QRect r;
- if (view && view->isVisible()) {
- if (QHeaderView *header = horizontalHeader()) {
- if (!child) {
- r = header->rect();
- } else {
- if (QHeaderView *vheader = verticalHeader()) {
- if (child == 1) {
- int w = vheader->width();
- int h = header->height();
- r.setRect(0, 0, w, h);
- }
- --child;
- }
- if (child) {
- int logical = logicalFromChild(header, child);
- int w = header->sectionSize(logical);
- r.setRect(header->sectionViewportPosition(logical), 0, w, header->height());
- r.translate(header->mapTo(view, QPoint(0, 0)));
- }
- }
- } else if (row.isValid()) {
- if (!child) {
- QModelIndex parent = row.parent();
- const int colCount = row.model()->columnCount(parent);
- for (int i = 0; i < colCount; ++i)
- r |= view->visualRect(row.model()->index(row.row(), i, parent));
- r.translate(view->viewport()->mapTo(view, QPoint(0,0)));
-
- if (const QHeaderView *vheader = verticalHeader()) { // include the section of the vertical header
- QRect re;
- int logicalRow = row.row();
- int h = vheader->sectionSize(logicalRow);
- re.setRect(0, vheader->sectionViewportPosition(logicalRow), vheader->width(), h);
- re.translate(vheader->mapTo(view, QPoint(0, 0)));
- r |= re;
- }
- } else {
- if (QHeaderView *vheader = verticalHeader()) {
- if (child == 1) {
- int logicalRow = row.row();
- int h = vheader->sectionSize(logicalRow);
- r.setRect(0, vheader->sectionViewportPosition(logicalRow), vheader->width(), h);
- r.translate(vheader->mapTo(view, QPoint(0, 0)));
- }
- --child;
- }
- if (child) {
- r = view->visualRect(childIndex(child));
- r.translate(view->viewport()->mapTo(view, QPoint(0,0)));
- }
- }
- }
- }
- if (!r.isNull())
- r.translate(view->mapToGlobal(QPoint(0, 0)));
-
- return r;
-}
-
-int QAccessibleItemRow::treeLevel() const
-{
- int level = 0;
- QModelIndex idx = row;
- while (idx.isValid()) {
- idx = idx.parent();
- ++level;
- }
- return level;
-}
-
-QString QAccessibleItemRow::text_helper(int child) const
-{
- QString value;
- if (m_header) {
- if (!child)
- return QString();
- if (verticalHeader()) {
- if (child == 1)
- return QString();
- --child;
- }
- QHeaderView *header = horizontalHeader();
- int logical = logicalFromChild(header, child);
- value = view->model()->headerData(logical, Qt::Horizontal, Qt::AccessibleTextRole).toString();
- if (value.isEmpty())
- value = view->model()->headerData(logical, Qt::Horizontal).toString();
- return value;
- } else {
- if (!child) { // for one-column views (i.e. QListView)
- if (children().count() >= 1)
- child = 1;
- else
- return QString();
- }
- if (verticalHeader()) {
- if (child == 1) {
- int logical = row.row();
- value = view->model()->headerData(logical, Qt::Vertical, Qt::AccessibleTextRole).toString();
- if (value.isEmpty())
- value = view->model()->headerData(logical, Qt::Vertical).toString();
- return value;
- } else {
- --child;
- }
- }
- }
- if (value.isEmpty()) {
- QModelIndex idx = childIndex(child);
- if (idx.isValid()) {
- value = idx.model()->data(idx, Qt::AccessibleTextRole).toString();
- if (value.isEmpty())
- value = idx.model()->data(idx, Qt::DisplayRole).toString();
- }
- }
- return value;
-}
-
-QString QAccessibleItemRow::text(QAccessible::Text t, int child) const
-{
- QString value;
- if (t == Name) {
- value = text_helper(child);
- } else if (t == Value) {
-#ifndef QT_NO_TREEVIEW
- if (qobject_cast<const QTreeView*>(view)) {
- if (child == 0)
- value = QString::number(treeLevel());
- } else
-#endif
- {
- value = text_helper(child);
- }
- } else if (t == Description) {
-#ifndef QT_NO_TREEVIEW
- if (child == 0 && qobject_cast<const QTreeView*>(view)) {
- // We store the tree coordinates of the current item in the description.
- // This enables some screen readers to report where the focus is
- // in a tree view. (works in JAWS). Also, Firefox does the same thing.
- // For instance the description "L2, 4 of 25 with 24" means
- // "L2": Tree Level 2
- // "4 of 25": We are item 4 out of in total 25 other siblings
- // "with 24": We have 24 children. (JAWS does not read this number)
-
- // level
- int level = treeLevel();
-
- QAbstractItemModel *m = view->model();
- // totalSiblings and itemIndex
- QModelIndex parent = row.parent();
- int rowCount = m->rowCount(parent);
- int itemIndex = -1;
- int totalSiblings = 0;
- for (int i = 0 ; i < rowCount; ++i) {
- QModelIndex sibling = row.sibling(i, 0);
- if (!view->isIndexHidden(sibling))
- ++totalSiblings;
- if (row == sibling)
- itemIndex = totalSiblings;
- }
- int totalChildren = m->rowCount(row); // JAWS does not report child count, so we do
- // this simple and efficient.
- // (don't check if they are all visible).
- value = QString::fromAscii("L%1, %2 of %3 with %4").arg(level).arg(itemIndex).arg(totalSiblings).arg(totalChildren);
- } else
-#endif // QT_NO_TREEVIEW
- {
- if (!m_header) {
- if (child == 0 && children().count() >= 1)
- child = 1;
- if (verticalHeader()) {
- if (child == 1) {
- value = view->model()->headerData(row.row(), Qt::Vertical).toString();
- }
- --child;
- }
- if (child) {
- QModelIndex idx = childIndex(child);
- value = idx.model()->data(idx, Qt::AccessibleDescriptionRole).toString();
- }
-
- }
- }
- }
- return value;
-}
-
-void QAccessibleItemRow::setText(QAccessible::Text t, int child, const QString &text)
-{
- if (m_header) {
- if (child)
- view->model()->setHeaderData(child - 1, Qt::Horizontal, text);
- // child == 0 means the cell to the left of the horizontal header, which is empty!?
- } else {
- if (!child) {
- if (children().count() == 1)
- child = 1;
- else
- return;
- }
-
- if (verticalHeader()) {
- if (child == 1) {
- view->model()->setHeaderData(row.row(), Qt::Vertical, text);
- return;
- }
- --child;
- }
- QModelIndex idx = childIndex(child);
- if (!idx.isValid())
- return;
-
- switch (t) {
- case Description:
- const_cast<QAbstractItemModel *>(idx.model())->setData(idx, text,
- Qt::AccessibleDescriptionRole);
- break;
- case Value:
- const_cast<QAbstractItemModel *>(idx.model())->setData(idx, text, Qt::EditRole);
- break;
- default:
- break;
- }
- }
-}
-
-QModelIndex QAccessibleItemRow::childIndex(int child) const
-{
- QList<QModelIndex> kids = children();
- Q_ASSERT(child >= 1 && child <= kids.count());
- return kids.at(child - 1);
-}
-
-QList<QModelIndex> QAccessibleItemRow::children() const
-{
- QList<QModelIndex> kids;
- for (int i = 0; i < row.model()->columnCount(row.parent()); ++i) {
- QModelIndex idx = row.model()->index(row.row(), i, row.parent());
- if (!view->isIndexHidden(idx)) {
- kids << idx;
- }
- }
- return kids;
-}
-
-bool QAccessibleItemRow::isValid() const
-{
- return m_header ? true : row.isValid();
-}
-
-QObject *QAccessibleItemRow::object() const
-{
- return 0;
-}
-
-int QAccessibleItemRow::childCount() const
-{
- int count = 0;
- if (QHeaderView *header = horizontalHeader()) {
- count = header->count() - header->hiddenSectionCount();
- } else {
- count = children().count();
- }
-#ifndef QT_NO_TABLEVIEW
- if (qobject_cast<const QTableView*>(view)) {
- if (verticalHeader())
- ++count;
- }
-#endif
- return count;
-}
-
-int QAccessibleItemRow::indexOfChild(const QAccessibleInterface *iface) const
-{
- if (!iface || iface->role() != Row)
- return -1;
-
- //### meaningless code?
- QList<QModelIndex> kids = children();
- QModelIndex idx = static_cast<const QAccessibleItemRow *>(iface)->row;
- if (!idx.isValid())
- return -1;
- return kids.indexOf(idx) + 1;
-}
-
-QAccessible::Relation QAccessibleItemRow::relationTo(int child, const QAccessibleInterface *other,
- int otherChild) const
-{
- if (!child && !otherChild && other->object() == view)
- return Child;
- if (!child && !otherChild && other == this)
- return Self;
- if (!child && otherChild && other == this)
- return Ancestor;
- if (child && otherChild && other == this)
- return Sibling;
- return Unrelated;
-}
-
-int QAccessibleItemRow::childAt(int x, int y) const
-{
- if (!view || !view->isVisible())
- return -1;
-
- for (int i = childCount(); i >= 0; --i) {
- if (rect(i).contains(x, y))
- return i;
- }
- return -1;
-}
-
-QAbstractItemView::CursorAction QAccessibleItemRow::toCursorAction(
- QAccessible::Relation rel)
-{
- switch (rel) {
- case QAccessible::Up:
- return QAbstractItemView::MoveUp;
- case QAccessible::Down:
- return QAbstractItemView::MoveDown;
- case QAccessible::Left:
- return QAbstractItemView::MoveLeft;
- case QAccessible::Right:
- return QAbstractItemView::MoveRight;
- default:
- Q_ASSERT(false);
- }
- // should never be reached.
- return QAbstractItemView::MoveRight;
-}
-
-QAccessibleInterface *QAccessibleItemRow::parent() const
-{
- return new QAccessibleItemView(view->viewport());
-}
-
-QAccessibleInterface *QAccessibleItemRow::child(int) const
-{
- // FIXME? port to IA2 table2.
- return 0;
-}
-
-int QAccessibleItemRow::navigate(RelationFlag relation, int index,
- QAccessibleInterface **iface) const
-{
- *iface = 0;
- if (!view)
- return -1;
-
- switch (relation) {
- case Ancestor:
- *iface = parent();
- return *iface ? 0 : -1;
- case Child: {
- if (!index)
- return -1;
- if (index < 1 && index > childCount())
- return -1;
-
- return index;}
- case Sibling:
- if (index) {
- QAccessibleInterface *ifaceParent = parent();
- if (ifaceParent) {
- *iface = ifaceParent->child(index - 1);
- delete ifaceParent;
- return *iface ? 0 : -1;
- }
- }
- return -1;
- case Up:
- case Down:
- case Left:
- case Right: {
- // This is in the "not so nice" category. In order to find out which item
- // is geometrically around, we have to set the current index, navigate
- // and restore the index as well as the old selection
- view->setUpdatesEnabled(false);
- const QModelIndex oldIdx = view->currentIndex();
- QList<QModelIndex> kids = children();
- const QModelIndex currentIndex = index ? kids.at(index - 1) : QModelIndex(row);
- const QItemSelection oldSelection = view->selectionModel()->selection();
- view->setCurrentIndex(currentIndex);
- const QModelIndex idx = view->moveCursor(toCursorAction(relation), Qt::NoModifier);
- view->setCurrentIndex(oldIdx);
- view->selectionModel()->select(oldSelection, QItemSelectionModel::ClearAndSelect);
- view->setUpdatesEnabled(true);
- if (!idx.isValid())
- return -1;
-
- if (idx.parent() != row.parent() || idx.row() != row.row())
- *iface = new QAccessibleItemRow(view, idx);
- return index ? kids.indexOf(idx) + 1 : 0; }
- default:
- break;
- }
-
- return -1;
-}
-
-QAccessible::Role QAccessibleItemRow::role(int child) const
-{
- if (false) {
-#ifndef QT_NO_TREEVIEW
- } else if (qobject_cast<const QTreeView*>(view)) {
- if (horizontalHeader()) {
- if (!child)
- return Row;
- return ColumnHeader;
- }
- return TreeItem;
-#endif
-#ifndef QT_NO_LISTVIEW
- } else if (qobject_cast<const QListView*>(view)) {
- return ListItem;
-#endif
-#ifndef QT_NO_TABLEVIEW
- } else if (qobject_cast<const QTableView *>(view)) {
- if (!child)
- return Row;
- if (child == 1) {
- if (verticalHeader())
- return RowHeader;
- }
- if (m_header)
- return ColumnHeader;
-#endif
- }
- return Cell;
-}
-
-QAccessible::State QAccessibleItemRow::state(int child) const
-{
- State st = Normal;
-
- if (!view)
- return st;
-
- QAccessibleInterface *parentIface = parent();
- QRect globalRect;
- if (parentIface) {
- globalRect = parentIface->rect(0);
- delete parentIface;
- }
- if (!globalRect.intersects(rect(child)))
- st |= Invisible;
-
- if (!horizontalHeader()) {
- if (!(st & Invisible)) {
- if (child) {
- if (QHeaderView *vheader = verticalHeader() ) {
- if (child == 1) {
- if (!vheader->isVisible())
- st |= Invisible;
- }
- --child;
- }
- if (child) {
- QModelIndex idx = childIndex(child);
- if (!idx.isValid())
- return st;
-
- if (view->selectionModel()->isSelected(idx))
- st |= Selected;
- if (view->selectionModel()->currentIndex() == idx)
- st |= Focused;
- if (idx.model()->data(idx, Qt::CheckStateRole).toInt() == Qt::Checked)
- st |= Checked;
-
- Qt::ItemFlags flags = idx.flags();
- if (flags & Qt::ItemIsSelectable) {
- st |= Selectable;
- if (view->selectionMode() == QAbstractItemView::MultiSelection)
- st |= MultiSelectable;
- if (view->selectionMode() == QAbstractItemView::ExtendedSelection)
- st |= ExtSelectable;
- }
- }
- } else {
- Qt::ItemFlags flags = row.flags();
- if (flags & Qt::ItemIsSelectable) {
- st |= Selectable;
- st |= Focusable;
- }
- if (view->selectionModel()->isRowSelected(row.row(), row.parent()))
- st |= Selected;
- if (view->selectionModel()->currentIndex().row() == row.row())
- st |= Focused;
- }
- }
- }
-
- return st;
-}
-
-int QAccessibleItemRow::userActionCount(int) const
-{
- return 0;
-}
-
-QString QAccessibleItemRow::actionText(int, Text, int) const
-{
- return QString();
-}
-
-static QItemSelection rowAt(const QModelIndex &idx)
-{
- return QItemSelection(idx.sibling(idx.row(), 0),
- idx.sibling(idx.row(), idx.model()->columnCount(idx.parent())));
-}
-
-bool QAccessibleItemRow::doAction(int action, int child, const QVariantList & /*params*/)
-{
- if (!view)
- return false;
-
- if (verticalHeader())
- --child;
-
- QModelIndex idx = child ? childIndex(child) : QModelIndex(row);
- if (!idx.isValid())
- return false;
-
- QItemSelectionModel::SelectionFlags command = QItemSelectionModel::NoUpdate;
-
- switch (action) {
- case SetFocus:
- view->setCurrentIndex(idx);
- return true;
- case ExtendSelection:
- if (!child)
- return false;
- view->selectionModel()->select(QItemSelection(view->currentIndex(), idx),
- QItemSelectionModel::SelectCurrent);
- return true;
- case Select:
- command = QItemSelectionModel::ClearAndSelect;
- break;
- case ClearSelection:
- command = QItemSelectionModel::Clear;
- break;
- case RemoveSelection:
- command = QItemSelectionModel::Deselect;
- break;
- case AddToSelection:
- command = QItemSelectionModel::SelectCurrent;
- break;
- }
- if (command == QItemSelectionModel::NoUpdate)
- return false;
-
- if (child)
- view->selectionModel()->select(idx, command);
- else
- view->selectionModel()->select(rowAt(row), command);
- return true;
-}
-
-class ModelIndexIterator
-{
-public:
- ModelIndexIterator(QAbstractItemView *view, const QModelIndex &start = QModelIndex()) : m_view(view)
- {
-#ifndef QT_NO_LISTVIEW
- list = qobject_cast<QListView*>(m_view);
-#endif
-#ifndef QT_NO_TREEVIEW
- tree = qobject_cast<QTreeView*>(m_view);
-#endif
-#ifndef QT_NO_TABLEVIEW
- table = qobject_cast<QTableView*>(m_view);
-#endif
- if (start.isValid()) {
- m_current = start;
- } else if (m_view && m_view->model()) {
- m_current = view->rootIndex().isValid() ?
- view->rootIndex().child(0,0) : view->model()->index(0, 0);
- }
- }
-
- bool next(int count = 1) {
- for (int i = 0; i < count; ++i) {
- do {
- if (m_current.isValid()) {
- const QAbstractItemModel *m = m_current.model();
-#ifndef QT_NO_TREEVIEW
- if (tree && m_current.model()->hasChildren(m_current) && tree->isExpanded(m_current)) {
- m_current = m_current.child(0, 0);
- } else
-#endif
- {
- int row = m_current.row();
- QModelIndex par = m_current.parent();
-
- // Go up to the parent if we reach the end of the rows
- // If m_curent becomses invalid, stop going up.
- while (row + 1 >= m->rowCount(par)) {
- m_current = par;
- if (m_current.isValid()) {
- row = m_current.row();
- par = m_current.parent();
- } else {
- row = 0;
- par = QModelIndex();
- break;
- }
- }
-
- if (m_current.isValid())
- m_current = m_current.sibling(row + 1, 0);
- }
- }
- } while (isHidden());
- }
- return m_current.isValid();
- }
-
- bool isHidden() const {
- if (false) {
-#ifndef QT_NO_LISTVIEW
- } else if (list) {
- return list->isRowHidden(m_current.row());
-#endif
-#ifndef QT_NO_TREEVIEW
- } else if (tree) {
- return tree->isRowHidden(m_current.row(), m_current.parent());
-#endif
-#ifndef QT_NO_TABLEVIEW
- } else if (table) {
- return table->isRowHidden(m_current.row());
-#endif
- }
- return false;
- }
-
- QModelIndex current() const {
- return m_current;
- }
-
-private:
- QModelIndex m_current;
- QAbstractItemView *m_view;
-
-#ifndef QT_NO_TREEVIEW
- QTreeView *tree;
-#endif
-#ifndef QT_NO_LISTVIEW
- QListView *list;
-#endif
-#ifndef QT_NO_TABLEVIEW
- QTableView *table;
-#endif
-};
-
-QAccessibleItemView::QAccessibleItemView(QWidget *w)
- : QAccessibleAbstractScrollArea(w->objectName() == QLatin1String("qt_scrollarea_viewport") ? w->parentWidget() : w)
-{
- atVP = w->objectName() == QLatin1String("qt_scrollarea_viewport");
-
-}
-
-
-QHeaderView *QAccessibleItemView::horizontalHeader() const
-{
- QHeaderView *header = 0;
- if (false) {
-#ifndef QT_NO_TABLEVIEW
- } else if (const QTableView *tv = qobject_cast<const QTableView*>(itemView())) {
- header = tv->horizontalHeader();
-#endif
-#ifndef QT_NO_TREEVIEW
- } else if (const QTreeView *tv = qobject_cast<const QTreeView*>(itemView())) {
- header = tv->header();
-#endif
- }
- return header;
-}
-
-QHeaderView *QAccessibleItemView::verticalHeader() const
-{
- QHeaderView *header = 0;
- if (false) {
-#ifndef QT_NO_TABLEVIEW
- } else if (const QTableView *tv = qobject_cast<const QTableView*>(itemView())) {
- header = tv->verticalHeader();
-#endif
- }
- return header;
-}
-
-
-bool QAccessibleItemView::isValidChildRole(QAccessible::Role role) const
-{
- if (atViewport()) {
- if (false) {
-#ifndef QT_NO_TREEVIEW
- } else if (qobject_cast<const QTreeView*>(itemView())) {
- return (role == TreeItem || role == Row);
-#endif
-#ifndef QT_NO_LISTVIEW
- } else if (qobject_cast<const QListView*>(itemView())) {
- return (role == ListItem);
-#endif
- }
- // TableView
- return role == Row;
- } else {
- if (false) {
-#ifndef QT_NO_TREEVIEW
- } else if (qobject_cast<const QTreeView*>(itemView())) {
- return (role == Tree);
-#endif
-#ifndef QT_NO_LISTVIEW
- } else if (qobject_cast<const QListView*>(itemView())) {
- return (role == List);
-#endif
- }
- // TableView
- return (role == Table);
- }
-}
-
-QObject *QAccessibleItemView::object() const
-{
- QObject *view = QAccessibleAbstractScrollArea::object();
- Q_ASSERT(qobject_cast<const QAbstractItemView *>(view));
- if (atViewport())
- view = qobject_cast<const QAbstractItemView *>(view)->viewport();
- return view;
-}
-
-QAbstractItemView *QAccessibleItemView::itemView() const
-{
- return qobject_cast<QAbstractItemView *>(QAccessibleAbstractScrollArea::object());
-}
-
-int QAccessibleItemView::indexOfChild(const QAccessibleInterface *iface) const
-{
- if (atViewport()) {
- if (!iface || !isValidChildRole(iface->role(0)))
- return -1;
-
- int entry = -1;
- // ### This will fail if a row is hidden.
- const QAccessibleItemRow *ifRow = static_cast<const QAccessibleItemRow *>(iface);
- if (ifRow->horizontalHeader())
- return 1;
-
- QModelIndex idx = ifRow->row;
- if (!idx.isValid())
- return -1;
-
- entry = entryFromIndex(idx);
- if (horizontalHeader())
- ++entry;
-
- return entry;
-
- } else {
- return QAccessibleAbstractScrollArea::indexOfChild(iface);
- }
-}
-
-QModelIndex QAccessibleItemView::childIndex(int child) const
-{
- if (!atViewport())
- return QModelIndex();
- ModelIndexIterator it(itemView());
- it.next(child - 1);
- return it.current();
-}
-
-int QAccessibleItemView::entryFromIndex(const QModelIndex &index) const
-{
- int entry = -1;
- if (false) {
-#ifndef QT_NO_TREEVIEW
- } else if (QTreeView *tree = qobject_cast<QTreeView*>(itemView())) {
- entry = tree->visualIndex(index) + 1;
-#endif
-#ifndef QT_NO_LISTVIEW
- } else if (QListView *list = qobject_cast<QListView*>(itemView())) {
- entry = list->visualIndex(index) + 1;
-#endif
-#ifndef QT_NO_TABLEVIEW
- } else if (QTableView *table = qobject_cast<QTableView*>(itemView())) {
- entry = table->visualIndex(index) + 1;
-#endif
- }
- return entry;
-}
-
-int QAccessibleItemView::childCount() const
-{
- if (atViewport()) {
- if (itemView()->model() == 0)
- return 0;
- QAbstractItemModel *m = itemView()->model();
- QModelIndex idx = m->index(0,0);
- if (!idx.isValid())
- return 0;
- ModelIndexIterator it(itemView());
- int count = 1;
- while (it.next()) {
- ++count;
- }
- if (horizontalHeader())
- ++count;
-
- return count;
- } else {
- return QAccessibleAbstractScrollArea::childCount();
- }
-}
-
-QString QAccessibleItemView::text(QAccessible::Text t, int child) const
-{
- if (atViewport()) {
- if (!child)
- return QAccessibleAbstractScrollArea::text(t, child);
-
- QAccessibleItemRow item(itemView(), childIndex(child));
- if (item.isValid()) {
- return item.text(t, 1);
- } else {
- return QString();
- }
- } else {
- return QAccessibleAbstractScrollArea::text(t, child);
- }
-}
-
-void QAccessibleItemView::setText(QAccessible::Text t, int child, const QString &text)
-{
- if (atViewport()) {
- if (!child) {
- QAccessibleAbstractScrollArea::setText(t, child, text);
- return;
- }
-
- QAccessibleItemRow item(itemView(), childIndex(child));
- item.setText(t, 1, text);
- } else {
- QAccessibleAbstractScrollArea::setText(t, child, text);
- }
-}
-
-QRect QAccessibleItemView::rect(int childIndex) const
-{
- if (atViewport()) {
- QRect r;
- if (!childIndex) {
- // Make sure that the rect *include* the vertical and horizontal headers, while
- // not including the potential vertical and horizontal scrollbars.
- QAbstractItemView *w = itemView();
-
- int vscrollWidth = 0;
- const QScrollBar *sb = w->verticalScrollBar();
- if (sb && sb->isVisible())
- vscrollWidth = sb->width();
-
- int hscrollHeight = 0;
- sb = w->horizontalScrollBar();
- if (sb && sb->isVisible())
- hscrollHeight = sb->height();
-
- QPoint globalPos = w->mapToGlobal(QPoint(0,0));
- r = w->rect().translated(globalPos);
- if (w->isRightToLeft()) {
- r.adjust(vscrollWidth, 0, 0, -hscrollHeight);
- } else {
- r.adjust(0, 0, -vscrollWidth, -hscrollHeight);
- }
- } else {
- QAccessibleInterface *iface = child(childIndex - 1);
- if (iface) {
- r = iface->rect(0);
- delete iface;
- }
- }
- return r;
- } else {
- QRect r = QAccessibleAbstractScrollArea::rect(childIndex);
- if (childIndex == 1) {
- // include the potential vertical and horizontal headers
-
- const QHeaderView *header = verticalHeader();
- int headerWidth = (header && header->isVisible()) ? header->width() : 0;
- header = horizontalHeader();
- int headerHeight= (header && header->isVisible()) ? header->height() : 0;
- if (itemView()->isRightToLeft()) {
- r.adjust(0, -headerHeight, headerWidth, 0);
- } else {
- r.adjust(-headerWidth, -headerHeight, 0, 0);
- }
- }
- return r;
- }
-}
-
-int QAccessibleItemView::childAt(int x, int y) const
-{
- if (atViewport()) {
- QPoint p(x, y);
- for (int i = childCount(); i >= 0; --i) {
- if (rect(i).contains(p))
- return i;
- }
- return -1;
- } else {
- return QAccessibleAbstractScrollArea::childAt(x, y);
- }
-}
-
-QAccessible::Role QAccessibleItemView::role(int child) const
-{
- if ((!atViewport() && child) || (atViewport() && child == 0)) {
- QAbstractItemView *view = itemView();
-#ifndef QT_NO_TABLEVIEW
- if (qobject_cast<QTableView *>(view))
- return Table;
-#endif
-#ifndef QT_NO_LISTVIEW
- if (qobject_cast<QListView *>(view))
- return List;
-#endif
- return Tree;
- }
- if (atViewport()) {
- if (child)
- return Row;
- }
-
- return QAccessibleAbstractScrollArea::role(child);
-}
-
-QAccessible::State QAccessibleItemView::state(int child) const
-{
- State st = Normal;
-
- if (itemView() == 0)
- return State(Unavailable);
-
- bool queryViewPort = (atViewport() && child == 0) || (!atViewport() && child == 1);
- if (queryViewPort) {
- if (itemView()->selectionMode() != QAbstractItemView::NoSelection) {
- st |= Selectable;
- st |= Focusable;
- }
- } else if (atViewport()) { // children of viewport
- if (horizontalHeader())
- --child;
- if (child) {
- QAccessibleItemRow item(itemView(), childIndex(child));
- st |= item.state(0);
- }
- } else if (!atViewport() && child != 1) {
- st = QAccessibleAbstractScrollArea::state(child);
- }
- return st;
-}
-
-bool QAccessibleItemView::isValid() const
-{
- if (atViewport())
- return QAccessibleWidget::isValid();
- else
- return QAccessibleAbstractScrollArea::isValid();
-}
-
-int QAccessibleItemView::navigate(RelationFlag relation, int index,
- QAccessibleInterface **iface) const
-{
- if (atViewport()) {
- if (relation == Ancestor && index == 1) {
- *iface = new QAccessibleItemView(itemView());
- return 0;
- } else if (relation == Child && index >= 1) {
- if (horizontalHeader()) {
- if (index == 1) {
- *iface = new QAccessibleItemRow(itemView(), QModelIndex(), true);
- return 0;
- }
- --index;
- }
-
- //###JAS hidden rows..
- QModelIndex idx = childIndex(index);
- if (idx.isValid()) {
- *iface = new QAccessibleItemRow(itemView(), idx);
- return 0;
- }
- } else if (relation == Sibling && index >= 1) {
- QAccessibleInterface *parent = new QAccessibleItemView(itemView());
- return parent->navigate(Child, index, iface);
- }
- *iface = 0;
- return -1;
- } else {
- return QAccessibleAbstractScrollArea::navigate(relation, index, iface);
- }
-}
-
-/* returns the model index for a given row and column */
-QModelIndex QAccessibleItemView::index(int row, int column) const
-{
- return itemView()->model()->index(row, column);
-}
-
-QAccessibleInterface *QAccessibleItemView::accessibleAt(int row, int column)
-{
- QWidget *indexWidget = itemView()->indexWidget(index(row, column));
- return QAccessible::queryAccessibleInterface(indexWidget);
-}
-
-/* We don't have a concept of a "caption" in Qt's standard widgets */
-QAccessibleInterface *QAccessibleItemView::caption()
-{
- return 0;
-}
-
-/* childIndex is row * columnCount + columnIndex */
-int QAccessibleItemView::childIndex(int rowIndex, int columnIndex)
-{
- return rowIndex * itemView()->model()->columnCount() + columnIndex;
-}
-
-/* Return the header data as column description */
-QString QAccessibleItemView::columnDescription(int column)
-{
- return itemView()->model()->headerData(column, Qt::Horizontal).toString();
-}
-
-/* We don't support column spanning atm */
-int QAccessibleItemView::columnSpan(int /* row */, int /* column */)
-{
- return 1;
-}
-
-/* Return the horizontal header view */
-QAccessibleInterface *QAccessibleItemView::columnHeader()
-{
-#ifndef QT_NO_TREEVIEW
- if (QTreeView *tree = qobject_cast<QTreeView *>(itemView()))
- return QAccessible::queryAccessibleInterface(tree->header());
-#endif
-#ifndef QT_NO_TABLEVIEW
- if (QTableView *table = qobject_cast<QTableView *>(itemView()))
- return QAccessible::queryAccessibleInterface(table->horizontalHeader());
-#endif
- return 0;
-}
-
-int QAccessibleItemView::columnIndex(int childIndex)
-{
- int columnCount = itemView()->model()->columnCount();
- if (!columnCount)
- return 0;
-
- return childIndex % columnCount;
-}
-
-int QAccessibleItemView::columnCount()
-{
- return itemView()->model()->columnCount();
-}
-
-int QAccessibleItemView::rowCount()
-{
- return itemView()->model()->rowCount();
-}
-
-int QAccessibleItemView::selectedColumnCount()
-{
- return itemView()->selectionModel()->selectedColumns().count();
-}
-
-int QAccessibleItemView::selectedRowCount()
-{
- return itemView()->selectionModel()->selectedRows().count();
-}
-
-QString QAccessibleItemView::rowDescription(int row)
-{
- return itemView()->model()->headerData(row, Qt::Vertical).toString();
-}
-
-/* We don't support row spanning */
-int QAccessibleItemView::rowSpan(int /*row*/, int /*column*/)
-{
- return 1;
-}
-
-QAccessibleInterface *QAccessibleItemView::rowHeader()
-{
-#ifndef QT_NO_TABLEVIEW
- if (QTableView *table = qobject_cast<QTableView *>(itemView()))
- return QAccessible::queryAccessibleInterface(table->verticalHeader());
-#endif
- return 0;
-}
-
-int QAccessibleItemView::rowIndex(int childIndex)
-{
- int columnCount = itemView()->model()->columnCount();
- if (!columnCount)
- return 0;
-
- return int(childIndex / columnCount);
-}
-
-int QAccessibleItemView::selectedRows(int maxRows, QList<int> *rows)
-{
- Q_ASSERT(rows);
-
- const QModelIndexList selRows = itemView()->selectionModel()->selectedRows();
- int maxCount = qMin(selRows.count(), maxRows);
-
- for (int i = 0; i < maxCount; ++i)
- rows->append(selRows.at(i).row());
-
- return maxCount;
-}
-
-int QAccessibleItemView::selectedColumns(int maxColumns, QList<int> *columns)
-{
- Q_ASSERT(columns);
-
- const QModelIndexList selColumns = itemView()->selectionModel()->selectedColumns();
- int maxCount = qMin(selColumns.count(), maxColumns);
-
- for (int i = 0; i < maxCount; ++i)
- columns->append(selColumns.at(i).row());
-
- return maxCount;
-}
-
-/* Qt widgets don't have a concept of a summary */
-QAccessibleInterface *QAccessibleItemView::summary()
-{
- return 0;
-}
-
-bool QAccessibleItemView::isColumnSelected(int column)
-{
- return itemView()->selectionModel()->isColumnSelected(column, QModelIndex());
-}
-
-bool QAccessibleItemView::isRowSelected(int row)
-{
- return itemView()->selectionModel()->isRowSelected(row, QModelIndex());
-}
-
-bool QAccessibleItemView::isSelected(int row, int column)
-{
- return itemView()->selectionModel()->isSelected(index(row, column));
-}
-
-void QAccessibleItemView::selectRow(int row)
-{
- QItemSelectionModel *s = itemView()->selectionModel();
- s->select(index(row, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows);
-}
-
-void QAccessibleItemView::selectColumn(int column)
-{
- QItemSelectionModel *s = itemView()->selectionModel();
- s->select(index(0, column), QItemSelectionModel::Select | QItemSelectionModel::Columns);
-}
-
-void QAccessibleItemView::unselectRow(int row)
-{
- QItemSelectionModel *s = itemView()->selectionModel();
- s->select(index(row, 0), QItemSelectionModel::Deselect | QItemSelectionModel::Rows);
-}
-
-void QAccessibleItemView::unselectColumn(int column)
-{
- QItemSelectionModel *s = itemView()->selectionModel();
- s->select(index(0, column), QItemSelectionModel::Deselect | QItemSelectionModel::Columns);
-}
-
-void QAccessibleItemView::cellAtIndex(int index, int *row, int *column, int *rSpan,
- int *cSpan, bool *isSelect)
-{
- *row = rowIndex(index);
- *column = columnIndex(index);
- *rSpan = rowSpan(*row, *column);
- *cSpan = columnSpan(*row, *column);
- *isSelect = isSelected(*row, *column);
-}
-
-/*!
- \class QAccessibleHeader
- \brief The QAccessibleHeader class implements the QAccessibleInterface for header widgets.
- \internal
-
- \ingroup accessibility
-*/
-
-/*!
- Constructs a QAccessibleHeader object for \a w.
-*/
-QAccessibleHeader::QAccessibleHeader(QWidget *w)
-: QAccessibleWidget(w)
-{
- Q_ASSERT(header());
- addControllingSignal(QLatin1String("sectionClicked(int)"));
-}
-
-/*! Returns the QHeaderView. */
-QHeaderView *QAccessibleHeader::header() const
-{
- return qobject_cast<QHeaderView*>(object());
-}
-
-QRect QAccessibleHeader::rect(int child) const
-{
- if (!child)
- return QAccessibleWidget::rect(0);
-
- QHeaderView *h = header();
- QPoint zero = h->mapToGlobal(QPoint(0, 0));
- int sectionSize = h->sectionSize(child - 1);
- int sectionPos = h->sectionPosition(child - 1);
- return h->orientation() == Qt::Horizontal
- ? QRect(zero.x() + sectionPos, zero.y(), sectionSize, h->height())
- : QRect(zero.x(), zero.y() + sectionPos, h->width(), sectionSize);
-}
-
-int QAccessibleHeader::childCount() const
-{
- return header()->count();
-}
-
-QString QAccessibleHeader::text(QAccessible::Text t, int child) const
-{
- QString str;
-
- if (child > 0 && child <= childCount()) {
- switch (t) {
- case Name:
- str = header()->model()->headerData(child - 1, header()->orientation()).toString();
- break;
- case Description: {
- QAccessibleEvent event(QEvent::AccessibilityDescription, child);
- if (QApplication::sendEvent(widget(), &event))
- str = event.value();
- break; }
- case Help: {
- QAccessibleEvent event(QEvent::AccessibilityHelp, child);
- if (QApplication::sendEvent(widget(), &event))
- str = event.value();
- break; }
- default:
- break;
- }
- }
- if (str.isEmpty())
- str = QAccessibleWidget::text(t, child);
- return str;
-}
-
-QAccessible::Role QAccessibleHeader::role(int) const
-{
- return (header()->orientation() == Qt::Horizontal) ? ColumnHeader : RowHeader;
-}
-
-QAccessible::State QAccessibleHeader::state(int child) const
-{
- State state = QAccessibleWidget::state(child);
-
- if (child) {
- int section = child - 1;
- if (header()->isSectionHidden(section))
- state |= Invisible;
- if (header()->resizeMode(section) != QHeaderView::Custom)
- state |= Sizeable;
- } else {
- if (header()->isMovable())
- state |= Movable;
- }
- if (!header()->isClickable())
- state |= Unavailable;
- return state;
-}
-#endif // QT_NO_ITEMVIEWS
-#endif // 0
-
#ifndef QT_NO_TABBAR
/*!
\class QAccessibleTabBar
@@ -1483,7 +111,7 @@ public:
bool isValid() const { return true; }// (!m_parent.isNull()) && m_parent->count() > m_index; }
- int childAt(int, int) const { return 0; }
+ QAccessibleInterface *childAt(int, int) const { return 0; }
int childCount() const { return 0; }
int indexOfChild(const QAccessibleInterface *) const { return -1; }
@@ -1496,17 +124,11 @@ public:
QAccessibleInterface *child(int) const { return 0; }
int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const
{
- if (relation == QAccessible::Ancestor && index == 1) {
- *iface = parent();
- return 0;
- }
+ Q_UNUSED(relation);
+ Q_UNUSED(index);
+ Q_UNUSED(iface);
return -1;
}
- QAccessible::Relation relationTo(const QAccessibleInterface *) const
- {
- return QAccessible::Unrelated;
- }
-
// action interface
QStringList actionNames() const
{
@@ -1544,18 +166,6 @@ QTabBar *QAccessibleTabBar::tabBar() const
return qobject_cast<QTabBar*>(object());
}
-int QAccessibleTabBar::navigate(QAccessible::RelationFlag rel, int entry, QAccessibleInterface **target) const
-{
- if (rel == QAccessible::Child) {
- *target = child(entry - 1);
- if (*target) {
- return 0;
- }
- return -1;
- }
- return QAccessibleWidget::navigate(rel, entry, target);
-}
-
QAccessibleInterface* QAccessibleTabBar::child(int index) const
{
// first the tabs, then 2 buttons
@@ -1577,11 +187,13 @@ QAccessibleInterface* QAccessibleTabBar::child(int index) const
int QAccessibleTabBar::indexOfChild(const QAccessibleInterface *child) const
{
+ // FIXME this looks broken
+
if (child->object() && child->object() == tabBar()->d_func()->leftB)
- return tabBar()->count() + 1; // fixme - one based
+ return tabBar()->count();
if (child->object() && child->object() == tabBar()->d_func()->rightB)
- return tabBar()->count() + 2; // fixme - one based
- return 0;
+ return tabBar()->count() + 1;
+ return -1;
}
int QAccessibleTabBar::childCount() const
@@ -1661,7 +273,7 @@ QComboBox *QAccessibleComboBox::comboBox() const
return qobject_cast<QComboBox*>(object());
}
-QAccessibleInterface* QAccessibleComboBox::child(int index) const
+QAccessibleInterface *QAccessibleComboBox::child(int index) const
{
if (index == 0) {
QAbstractItemView *view = comboBox()->view();
@@ -1679,10 +291,10 @@ int QAccessibleComboBox::childCount() const
return comboBox()->isEditable() ? 2 : 1;
}
-int QAccessibleComboBox::childAt(int x, int y) const
+QAccessibleInterface *QAccessibleComboBox::childAt(int x, int y) const
{
if (comboBox()->isEditable() && comboBox()->lineEdit()->rect().contains(x, y))
- return 1;
+ return child(1);
return 0;
}
@@ -1775,11 +387,6 @@ QAccessibleAbstractScrollArea::QAccessibleAbstractScrollArea(QWidget *widget)
Q_ASSERT(qobject_cast<QAbstractScrollArea *>(widget));
}
-QVariant QAccessibleAbstractScrollArea::invokeMethod(QAccessible::Method, int, const QVariantList &)
-{
- return QVariant();
-}
-
QAccessibleInterface *QAccessibleAbstractScrollArea::child(int index) const
{
return QAccessible::queryAccessibleInterface(accessibleChildren().at(index));
@@ -1794,10 +401,7 @@ int QAccessibleAbstractScrollArea::indexOfChild(const QAccessibleInterface *chil
{
if (!child || !child->object())
return -1;
- int index = accessibleChildren().indexOf(qobject_cast<QWidget *>(child->object()));
- if (index >= 0)
- return ++index;
- return -1;
+ return accessibleChildren().indexOf(qobject_cast<QWidget *>(child->object()));
}
bool QAccessibleAbstractScrollArea::isValid() const
@@ -1805,152 +409,20 @@ bool QAccessibleAbstractScrollArea::isValid() const
return (QAccessibleWidget::isValid() && abstractScrollArea() && abstractScrollArea()->viewport());
}
-int QAccessibleAbstractScrollArea::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
+QAccessibleInterface *QAccessibleAbstractScrollArea::childAt(int x, int y) const
{
- if (!target)
- return -1;
-
- *target = 0;
-
- QWidget *targetWidget = 0;
- QWidget *entryWidget = 0;
-
- if (relation == QAccessible::Child ||
- relation == QAccessible::Left || relation == QAccessible::Up || relation == QAccessible::Right || relation == QAccessible::Down) {
- QWidgetList children = accessibleChildren();
- if (entry < 0 || entry > children.count())
- return -1;
+ if (!abstractScrollArea()->isVisible())
+ return 0;
- if (entry == Self)
- entryWidget = abstractScrollArea();
- else
- entryWidget = children.at(entry - 1);
- AbstractScrollAreaElement entryElement = elementType(entryWidget);
-
- // Not one of the most beautiful switches I've ever seen, but I believe it has
- // to be like this since each case need special handling.
- // It might be possible to make it more general, but I'll leave that as an exercise
- // to the reader. :-)
- switch (relation) {
- case QAccessible::Child:
- if (entry > 0) {
- *target = child(entry - 1);
- return *target ? 0 : -1;
- }
- case QAccessible::Left:
- if (entry < 1)
- break;
- switch (entryElement) {
- case Viewport:
- if (!isLeftToRight())
- targetWidget = abstractScrollArea()->verticalScrollBar();
- break;
- case HorizontalContainer:
- if (!isLeftToRight())
- targetWidget = abstractScrollArea()->cornerWidget();
- break;
- case VerticalContainer:
- if (isLeftToRight())
- targetWidget = abstractScrollArea()->viewport();
- break;
- case CornerWidget:
- if (isLeftToRight())
- targetWidget = abstractScrollArea()->horizontalScrollBar();
- break;
- default:
- break;
- }
- break;
- case QAccessible::Right:
- if (entry < 1)
- break;
- switch (entryElement) {
- case Viewport:
- if (isLeftToRight())
- targetWidget = abstractScrollArea()->verticalScrollBar();
- break;
- case HorizontalContainer:
- targetWidget = abstractScrollArea()->cornerWidget();
- break;
- case VerticalContainer:
- if (!isLeftToRight())
- targetWidget = abstractScrollArea()->viewport();
- break;
- case CornerWidget:
- if (!isLeftToRight())
- targetWidget = abstractScrollArea()->horizontalScrollBar();
- break;
- default:
- break;
- }
- break;
- case QAccessible::Up:
- if (entry < 1)
- break;
- switch (entryElement) {
- case HorizontalContainer:
- targetWidget = abstractScrollArea()->viewport();
- break;
- case CornerWidget:
- targetWidget = abstractScrollArea()->verticalScrollBar();
- break;
- default:
- break;
- }
- break;
- case QAccessible::Down:
- if (entry < 1)
- break;
- switch (entryElement) {
- case Viewport:
- targetWidget = abstractScrollArea()->horizontalScrollBar();
- break;
- case VerticalContainer:
- targetWidget = abstractScrollArea()->cornerWidget();
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- } else {
- return QAccessibleWidget::navigate(relation, entry, target);
+ for (int i = 0; i < childCount(); ++i) {
+ QPoint wpos = accessibleChildren().at(i)->mapToGlobal(QPoint(0, 0));
+ QRect rect = QRect(wpos, accessibleChildren().at(i)->size());
+ if (rect.contains(x, y))
+ return child(i);
}
-
- if (qobject_cast<const QScrollBar *>(targetWidget))
- targetWidget = targetWidget->parentWidget();
- *target = QAccessible::queryAccessibleInterface(targetWidget);
- return *target ? 0: -1;
+ return 0;
}
-//int QAccessibleAbstractScrollArea::childAt(int x, int y) const
-//{
-// if (!abstractScrollArea()->isVisible())
-// return -1;
-//#if 0
-// const QRect globalSelfGeometry = rect(Self);
-// if (!globalSelfGeometry.isValid() || !globalSelfGeometry.contains(QPoint(x, y)))
-// return -1;
-// const QWidgetList children = accessibleChildren();
-// for (int i = 0; i < children.count(); ++i) {
-// const QWidget *child = children.at(i);
-// const QRect globalChildGeometry = QRect(child->mapToGlobal(QPoint(0, 0)), child->size());
-// if (globalChildGeometry.contains(QPoint(x, y))) {
-// return ++i;
-// }
-// }
-// return 0;
-//#else
-// for (int i = childCount(); i >= 0; --i) {
-// if (rect().contains(x, y))
-// return i;
-// }
-// return -1;
-//#endif
-//}
-
QAbstractScrollArea *QAccessibleAbstractScrollArea::abstractScrollArea() const
{
return static_cast<QAbstractScrollArea *>(object());
diff --git a/src/plugins/accessible/widgets/complexwidgets.h b/src/plugins/accessible/widgets/complexwidgets.h
index 2dde422b12..c596e0b348 100644
--- a/src/plugins/accessible/widgets/complexwidgets.h
+++ b/src/plugins/accessible/widgets/complexwidgets.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -75,12 +75,10 @@ public:
};
QAccessibleInterface *child(int index) const;
- QVariant invokeMethod(QAccessible::Method method, int, const QVariantList &params);
int childCount() const;
int indexOfChild(const QAccessibleInterface *child) const;
bool isValid() const;
- int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
-// int childAt(int x, int y) const;
+ QAccessibleInterface *childAt(int x, int y) const;
//protected:
QAbstractScrollArea *abstractScrollArea() const;
@@ -96,137 +94,8 @@ class QAccessibleScrollArea : public QAccessibleAbstractScrollArea
public:
explicit QAccessibleScrollArea(QWidget *widget);
};
-
#endif // QT_NO_SCROLLAREA
-#if 0
-#ifndef QT_NO_ITEMVIEWS
-class QAccessibleHeader : public QAccessibleWidget
-{
-public:
- explicit QAccessibleHeader(QWidget *w);
-
- int childCount() const;
-
- QRect rect(int child) const;
- QString text(QAccessible::Text t, int child) const;
- Role role(int child) const;
- State state(int child) const;
-
-protected:
- QHeaderView *header() const;
-};
-
-class QAccessibleItemRow: public QAccessibleInterface
-{
- friend class QAccessibleItemView;
-public:
- QAccessibleItemRow(QAbstractItemView *view, const QModelIndex &index = QModelIndex(), bool isHeader = false);
- QRect rect(int child) const;
- QString text(QAccessible::Text t, int child) const;
- void setText(QAccessible::Text t, int child, const QString &text);
- bool isValid() const;
- QObject *object() const;
- Role role(int child) const;
- State state(int child) const;
-
- int childCount() const;
- int indexOfChild(const QAccessibleInterface *) const;
- QList<QModelIndex> children() const;
-
- Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
- int childAt(int x, int y) const;
- QAccessibleInterface *parent() const;
- QAccessibleInterface *child(int index) const;
- int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const;
-
- int userActionCount(int child) const;
- QString actionText(int action, Text t, int child) const;
- bool doAction(int action, int child, const QVariantList &params = QVariantList());
-
- QModelIndex childIndex(int child) const;
-
- QHeaderView *horizontalHeader() const; //used by QAccessibleItemView
-private:
- static QAbstractItemView::CursorAction toCursorAction(Relation rel);
- int logicalFromChild(QHeaderView *header, int child) const;
- int treeLevel() const;
- QHeaderView *verticalHeader() const;
- QString text_helper(int child) const;
-
- QPersistentModelIndex row;
- QPointer<QAbstractItemView> view;
- bool m_header;
-};
-
-class QAccessibleItemView: public QAccessibleAbstractScrollArea, public QAccessibleTableInterface
-{
-public:
- explicit QAccessibleItemView(QWidget *w);
-
- QObject *object() const;
- Role role(int child) const;
- State state(int child) const;
- QRect rect(int child) const;
- int childAt(int x, int y) const;
- int childCount() const;
- QString text(QAccessible::Text t, int child) const;
- void setText(QAccessible::Text t, int child, const QString &text);
- int indexOfChild(const QAccessibleInterface *iface) const;
-
- QModelIndex childIndex(int child) const;
- int entryFromIndex(const QModelIndex &index) const;
- bool isValid() const;
- int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const;
-
- QAccessibleInterface *accessibleAt(int row, int column);
- QAccessibleInterface *caption();
- int childIndex(int rowIndex, int columnIndex);
- QString columnDescription(int column);
- int columnSpan(int row, int column);
- QAccessibleInterface *columnHeader();
- int columnIndex(int childIndex);
- int columnCount();
- int rowCount();
- int selectedColumnCount();
- int selectedRowCount();
- QString rowDescription(int row);
- int rowSpan(int row, int column);
- QAccessibleInterface *rowHeader();
- int rowIndex(int childIndex);
- int selectedRows(int maxRows, QList<int> *rows);
- int selectedColumns(int maxColumns, QList<int> *columns);
- QAccessibleInterface *summary();
- bool isColumnSelected(int column);
- bool isRowSelected(int row);
- bool isSelected(int row, int column);
- void selectRow(int row);
- void selectColumn(int column);
- void unselectRow(int row);
- void unselectColumn(int column);
- void cellAtIndex(int index, int *row, int *column, int *rowSpan,
- int *columnSpan, bool *isSelected);
-
- QHeaderView *horizontalHeader() const;
- QHeaderView *verticalHeader() const;
- bool isValidChildRole(QAccessible::Role role) const;
-
-protected:
- QAbstractItemView *itemView() const;
- QModelIndex index(int row, int column) const;
-
-private:
- inline bool atViewport() const {
- return atVP;
- };
- QAccessible::Role expectedRoleOfChildren() const;
-
- bool atVP;
-};
-
-#endif
-#endif
-
#ifndef QT_NO_TABBAR
class QAccessibleTabBar : public QAccessibleWidget
{
@@ -241,7 +110,6 @@ public:
QAccessibleInterface* child(int index) const;
int indexOfChild(const QAccessibleInterface *child) const;
- int navigate(QAccessible::RelationFlag rel, int entry, QAccessibleInterface **target) const;
protected:
QTabBar *tabBar() const;
@@ -255,7 +123,7 @@ public:
explicit QAccessibleComboBox(QWidget *w);
int childCount() const;
- int childAt(int x, int y) const;
+ QAccessibleInterface *childAt(int x, int y) const;
int indexOfChild(const QAccessibleInterface *child) const;
QAccessibleInterface* child(int index) const;
diff --git a/src/plugins/accessible/widgets/itemviews.cpp b/src/plugins/accessible/widgets/itemviews.cpp
index b33260099f..a7989ccd4e 100644
--- a/src/plugins/accessible/widgets/itemviews.cpp
+++ b/src/plugins/accessible/widgets/itemviews.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -363,10 +363,10 @@ QAccessible::Role QAccessibleTable::role() const
QAccessible::State QAccessibleTable::state() const
{
- return QAccessible::Normal;
+ return QAccessible::State();
}
-int QAccessibleTable::childAt(int x, int y) const
+QAccessibleInterface *QAccessibleTable::childAt(int x, int y) const
{
QPoint viewportOffset = view->viewport()->mapTo(view, QPoint(0,0));
QPoint indexPosition = view->mapFromGlobal(QPoint(x, y) - viewportOffset);
@@ -374,9 +374,9 @@ int QAccessibleTable::childAt(int x, int y) const
QModelIndex index = view->indexAt(indexPosition);
if (index.isValid()) {
- return logicalIndex(index);
+ return childFromLogical(logicalIndex(index));
}
- return -1;
+ return 0;
}
int QAccessibleTable::childCount() const
@@ -393,15 +393,15 @@ int QAccessibleTable::indexOfChild(const QAccessibleInterface *iface) const
Q_ASSERT(iface->role() != QAccessible::TreeItem); // should be handled by tree class
if (iface->role() == QAccessible::Cell || iface->role() == QAccessible::ListItem) {
const QAccessibleTableCell* cell = static_cast<const QAccessibleTableCell*>(iface);
- return logicalIndex(cell->m_index);
+ return logicalIndex(cell->m_index) - 1;
} else if (iface->role() == QAccessible::ColumnHeader){
const QAccessibleTableHeaderCell* cell = static_cast<const QAccessibleTableHeaderCell*>(iface);
- return cell->index + (verticalHeader() ? 1 : 0) + 1;
+ return cell->index + (verticalHeader() ? 1 : 0);
} else if (iface->role() == QAccessible::RowHeader){
const QAccessibleTableHeaderCell* cell = static_cast<const QAccessibleTableHeaderCell*>(iface);
- return (cell->index+1) * (view->model()->rowCount()+1) + 1;
+ return (cell->index+1) * (view->model()->rowCount()+1);
} else if (iface->role() == QAccessible::Pane) {
- return 1; // corner button
+ return 0; // corner button
} else {
qWarning() << "WARNING QAccessibleTable::indexOfChild Fix my children..."
<< iface->role() << iface->text(QAccessible::Name);
@@ -444,31 +444,12 @@ QAccessibleInterface *QAccessibleTable::child(int index) const
int QAccessibleTable::navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const
{
+ Q_UNUSED(relation);
+ Q_UNUSED(index);
*iface = 0;
- switch (relation) {
- case QAccessible::Ancestor: {
- *iface = parent();
- return *iface ? 0 : -1;
- }
- case QAccessible::Child: {
- Q_ASSERT(index > 0);
- *iface = child(index - 1);
- if (*iface) {
- return 0;
- }
- break;
- }
- default:
- break;
- }
return -1;
}
-QAccessible::Relation QAccessibleTable::relationTo(const QAccessibleInterface *) const
-{
- return QAccessible::Unrelated;
-}
-
void *QAccessibleTable::interface_cast(QAccessible::InterfaceType t)
{
if (t == QAccessible::TableInterface)
@@ -489,14 +470,14 @@ QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const
return modelIndex;
}
-int QAccessibleTree::childAt(int x, int y) const
+QAccessibleInterface *QAccessibleTree::childAt(int x, int y) const
{
QPoint viewportOffset = view->viewport()->mapTo(view, QPoint(0,0));
QPoint indexPosition = view->mapFromGlobal(QPoint(x, y) - viewportOffset);
QModelIndex index = view->indexAt(indexPosition);
if (!index.isValid())
- return -1;
+ return 0;
const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
int row = treeView->d_func()->viewIndex(index) + (horizontalHeader() ? 1 : 0);
@@ -504,7 +485,7 @@ int QAccessibleTree::childAt(int x, int y) const
int i = row * view->model()->columnCount() + column + 1;
Q_ASSERT(i > view->model()->columnCount());
- return i;
+ return child(i - 1);
}
int QAccessibleTree::childCount() const
@@ -518,6 +499,29 @@ int QAccessibleTree::childCount() const
return (treeView->d_func()->viewItems.count() + hHeader)* view->model()->columnCount();
}
+
+QAccessibleInterface *QAccessibleTree::child(int index) const
+{
+ Q_ASSERT(index >= 0);
+ int hHeader = horizontalHeader() ? 1 : 0;
+
+ if (hHeader) {
+ if (index < view->model()->columnCount()) {
+ return new QAccessibleTableHeaderCell(view, index, Qt::Horizontal);
+ } else {
+ index -= view->model()->columnCount();
+ }
+ }
+
+ int row = index / view->model()->columnCount();
+ int column = index % view->model()->columnCount();
+ QModelIndex modelIndex = indexFromLogical(row, column);
+ if (modelIndex.isValid()) {
+ return cell(modelIndex);
+ }
+ return 0;
+}
+
int QAccessibleTree::rowCount() const
{
const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
@@ -534,14 +538,14 @@ int QAccessibleTree::indexOfChild(const QAccessibleInterface *iface) const
int row = treeView->d_func()->viewIndex(cell->m_index) + (horizontalHeader() ? 1 : 0);
int column = cell->m_index.column();
- int index = row * view->model()->columnCount() + column + 1;
+ int index = row * view->model()->columnCount() + column;
//qDebug() << "QAccessibleTree::indexOfChild r " << row << " c " << column << "index " << index;
- Q_ASSERT(index > treeView->model()->columnCount());
+ Q_ASSERT(index >= treeView->model()->columnCount());
return index;
} else if (iface->role() == QAccessible::ColumnHeader){
const QAccessibleTableHeaderCell* cell = static_cast<const QAccessibleTableHeaderCell*>(iface);
//qDebug() << "QAccessibleTree::indexOfChild header " << cell->index << "is: " << cell->index + 1;
- return cell->index + 1;
+ return cell->index;
} else {
qWarning() << "WARNING QAccessibleTable::indexOfChild invalid child"
<< iface->role() << iface->text(QAccessible::Name);
@@ -550,43 +554,6 @@ int QAccessibleTree::indexOfChild(const QAccessibleInterface *iface) const
return -1;
}
-int QAccessibleTree::navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const
-{
- switch (relation) {
- case QAccessible::Child: {
- Q_ASSERT(index > 0);
- --index;
- int hHeader = horizontalHeader() ? 1 : 0;
-
- if (hHeader) {
- if (index < view->model()->columnCount()) {
- *iface = new QAccessibleTableHeaderCell(view, index, Qt::Horizontal);
- return 0;
- } else {
- index -= view->model()->columnCount();
- }
- }
-
- int row = index / view->model()->columnCount();
- int column = index % view->model()->columnCount();
- QModelIndex modelIndex = indexFromLogical(row, column);
- if (modelIndex.isValid()) {
- *iface = cell(modelIndex);
- return 0;
- }
- return -1;
- }
- default:
- break;
- }
- return QAccessibleTable::navigate(relation, index, iface);
-}
-
-QAccessible::Relation QAccessibleTree::relationTo(const QAccessibleInterface *) const
-{
- return QAccessible::Unrelated;
-}
-
QAccessibleInterface *QAccessibleTree::cellAt(int row, int column) const
{
QModelIndex index = indexFromLogical(row, column);
@@ -724,34 +691,34 @@ QAccessible::Role QAccessibleTableCell::role() const
QAccessible::State QAccessibleTableCell::state() const
{
- QAccessible::State st = QAccessible::Normal;
+ QAccessible::State st;
QRect globalRect = view->rect();
globalRect.translate(view->mapToGlobal(QPoint(0,0)));
if (!globalRect.intersects(rect()))
- st |= QAccessible::Invisible;
+ st.invisible = true;
if (view->selectionModel()->isSelected(m_index))
- st |= QAccessible::Selected;
+ st.selected = true;
if (view->selectionModel()->currentIndex() == m_index)
- st |= QAccessible::Focused;
+ st.focused = true;
if (m_index.model()->data(m_index, Qt::CheckStateRole).toInt() == Qt::Checked)
- st |= QAccessible::Checked;
+ st.checked = true;
Qt::ItemFlags flags = m_index.flags();
if (flags & Qt::ItemIsSelectable) {
- st |= QAccessible::Selectable;
- st |= QAccessible::Focusable;
+ st.selectable = true;
+ st.focusable = true;
if (view->selectionMode() == QAbstractItemView::MultiSelection)
- st |= QAccessible::MultiSelectable;
+ st.multiSelectable = true;
if (view->selectionMode() == QAbstractItemView::ExtendedSelection)
- st |= QAccessible::ExtSelectable;
+ st.extSelectable = true;
}
if (m_role == QAccessible::TreeItem) {
const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
if (treeView->model()->hasChildren(m_index))
- st |= QAccessible::Expandable;
+ st.expandable = true;
if (treeView->isExpanded(m_index))
- st |= QAccessible::Expanded;
+ st.expanded = true;
}
return st;
}
@@ -815,29 +782,10 @@ QAccessibleInterface *QAccessibleTableCell::child(int) const
int QAccessibleTableCell::navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const
{
- if (relation == QAccessible::Ancestor && index == 1) {
- *iface = parent();
- return 0;
- }
-
- *iface = 0;
- if (!view)
- return -1;
-
- switch (relation) {
-
- case QAccessible::Child: {
- return -1;
- }
- case QAccessible::Sibling:
- if (index > 0) {
- QAccessibleInterface *parent = QAccessible::queryAccessibleInterface(view);
- *iface = parent->child(index - 1);
- delete parent;
- return *iface ? 0 : -1;
- }
- return -1;
+ Q_UNUSED(index);
+ Q_UNUSED(relation);
+// switch (relation) {
// From table1 implementation:
// case Up:
// case Down:
@@ -862,28 +810,11 @@ int QAccessibleTableCell::navigate(QAccessible::RelationFlag relation, int index
// if (idx.parent() != row.parent() || idx.row() != row.row())
// *iface = cell(idx);
// return index ? kids.indexOf(idx) + 1 : 0; }
- default:
- break;
- }
-
+// }
+ *iface = 0;
return -1;
}
-QAccessible::Relation QAccessibleTableCell::relationTo(const QAccessibleInterface *other) const
-{
- // we only check for parent-child relationships in trees
- if (m_role == QAccessible::TreeItem && other->role() == QAccessible::TreeItem) {
- QModelIndex otherIndex = static_cast<const QAccessibleTableCell*>(other)->m_index;
- // is the other our parent?
- if (otherIndex.parent() == m_index)
- return QAccessible::Ancestor;
- // are we the other's child?
- if (m_index.parent() == otherIndex)
- return QAccessible::Child;
- }
- return QAccessible::Unrelated;
-}
-
QAccessibleTableHeaderCell::QAccessibleTableHeaderCell(QAbstractItemView *view_, int index_, Qt::Orientation orientation_)
: view(view_), index(index_), orientation(orientation_)
{
@@ -899,7 +830,7 @@ QAccessible::Role QAccessibleTableHeaderCell::role() const
QAccessible::State QAccessibleTableHeaderCell::state() const
{
- return QAccessible::Normal;
+ return QAccessible::State();
}
QRect QAccessibleTableHeaderCell::rect() const
@@ -976,17 +907,11 @@ QAccessibleInterface *QAccessibleTableHeaderCell::child(int) const
int QAccessibleTableHeaderCell::navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const
{
- if (relation == QAccessible::Ancestor && index == 1) {
- *iface = parent();
- return *iface ? 0 : -1;
- }
- *iface = 0;
- return -1;
-}
+ Q_UNUSED(relation);
+ Q_UNUSED(index);
+ Q_UNUSED(iface);
-QAccessible::Relation QAccessibleTableHeaderCell::relationTo(int, const QAccessibleInterface *, int) const
-{
- return QAccessible::Unrelated;
+ return -1;
}
#endif // QT_NO_ITEMVIEWS
diff --git a/src/plugins/accessible/widgets/itemviews.h b/src/plugins/accessible/widgets/itemviews.h
index 08e0bbb487..4b5112350f 100644
--- a/src/plugins/accessible/widgets/itemviews.h
+++ b/src/plugins/accessible/widgets/itemviews.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -71,16 +71,14 @@ public:
QString text(QAccessible::Text t) const;
QRect rect() const;
- int childAt(int x, int y) const;
+ QAccessibleInterface *childAt(int x, int y) const;
int childCount() const;
int indexOfChild(const QAccessibleInterface *) const;
QAccessibleInterface *parent() const;
QAccessibleInterface *child(int index) const;
int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const;
- QAccessible::Relation relationTo(const QAccessibleInterface *other) const;
- QVariant invokeMethod(QAccessible::Method, const QVariantList &) { return QVariant(); }
void *interface_cast(QAccessible::InterfaceType t);
// table interface
@@ -153,15 +151,14 @@ public:
virtual ~QAccessibleTree() {}
- int childAt(int x, int y) const;
+ QAccessibleInterface *childAt(int x, int y) const;
int childCount() const;
+ QAccessibleInterface *child(int index) const;
+
int indexOfChild(const QAccessibleInterface *) const;
int rowCount() const;
- int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const;
- QAccessible::Relation relationTo(const QAccessibleInterface *other) const;
-
// table interface
QAccessibleInterface *cellAt(int row, int column) const;
QString rowDescription(int row) const;
@@ -184,7 +181,7 @@ public:
QRect rect() const;
bool isValid() const;
- int childAt(int, int) const { return 0; }
+ QAccessibleInterface *childAt(int, int) const { return 0; }
int childCount() const { return 0; }
int indexOfChild(const QAccessibleInterface *) const { return -1; }
@@ -194,7 +191,6 @@ public:
QAccessibleInterface *parent() const;
QAccessibleInterface *child(int) const;
int navigate(QAccessible::RelationFlag relation, int m_index, QAccessibleInterface **iface) const;
- QAccessible::Relation relationTo(const QAccessibleInterface *other) const;
// cell interface
virtual int columnExtent() const;
@@ -231,7 +227,7 @@ public:
QRect rect() const;
bool isValid() const;
- int childAt(int, int) const { return 0; }
+ QAccessibleInterface *childAt(int, int) const { return 0; }
int childCount() const { return 0; }
int indexOfChild(const QAccessibleInterface *) const { return -1; }
@@ -241,7 +237,6 @@ public:
QAccessibleInterface *parent() const;
QAccessibleInterface *child(int index) const;
int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const;
- QAccessible::Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
private:
QAbstractItemView *view;
@@ -264,11 +259,11 @@ public:
QObject *object() const { return 0; }
QAccessible::Role role() const { return QAccessible::Pane; }
- QAccessible::State state() const { return QAccessible::Normal; }
+ QAccessible::State state() const { return QAccessible::State(); }
QRect rect() const { return QRect(); }
bool isValid() const { return true; }
- int childAt(int, int) const { return 0; }
+ QAccessibleInterface *childAt(int, int) const { return 0; }
int childCount() const { return 0; }
int indexOfChild(const QAccessibleInterface *) const { return -1; }
@@ -283,16 +278,10 @@ public:
}
int navigate(QAccessible::RelationFlag relation, int, QAccessibleInterface **iface) const
{
- if (relation == QAccessible::Ancestor) {
- *iface = parent();
- return *iface ? 0 : -1;
- }
+ Q_UNUSED(relation);
+ Q_UNUSED(iface);
return -1;
}
- QAccessible::Relation relationTo(int, const QAccessibleInterface *, int) const
- {
- return QAccessible::Unrelated;
- }
private:
QAbstractItemView *view;
diff --git a/src/plugins/accessible/widgets/main.cpp b/src/plugins/accessible/widgets/main.cpp
index 821b219b36..67e1a46703 100644
--- a/src/plugins/accessible/widgets/main.cpp
+++ b/src/plugins/accessible/widgets/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/accessible/widgets/qaccessiblemenu.cpp b/src/plugins/accessible/widgets/qaccessiblemenu.cpp
index 2fe67fedfe..fcd118e745 100644
--- a/src/plugins/accessible/widgets/qaccessiblemenu.cpp
+++ b/src/plugins/accessible/widgets/qaccessiblemenu.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -71,12 +71,12 @@ int QAccessibleMenu::childCount() const
return menu()->actions().count();
}
-int QAccessibleMenu::childAt(int x, int y) const
+QAccessibleInterface *QAccessibleMenu::childAt(int x, int y) const
{
QAction *act = menu()->actionAt(menu()->mapFromGlobal(QPoint(x,y)));
if(act && act->isSeparator())
act = 0;
- return menu()->actions().indexOf(act) + 1;
+ return act ? new QAccessibleMenuItem(menu(), act) : 0;
}
QString QAccessibleMenu::text(QAccessible::Text t) const
@@ -111,31 +111,13 @@ QAccessibleInterface *QAccessibleMenu::parent() const
return QAccessibleWidget::parent();
}
-int QAccessibleMenu::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
-{
- Q_ASSERT(entry >= 0);
- switch (relation) {
- case QAccessible::Child:
- *target = child(entry - 1);
- return *target ? 0 : -1;
- case QAccessible::Ancestor:
- *target = parent();
- return *target ? 0 : -1;
- default:
- return QAccessibleWidget::navigate(relation, entry, target);
- }
-}
-
int QAccessibleMenu::indexOfChild( const QAccessibleInterface *child) const
{
- int index = -1;
QAccessible::Role r = child->role();
if ((r == QAccessible::MenuItem || r == QAccessible::Separator) && menu()) {
- index = menu()->actions().indexOf(qobject_cast<QAction*>(child->object()));
- if (index != -1)
- ++index;
+ return menu()->actions().indexOf(qobject_cast<QAction*>(child->object()));
}
- return index;
+ return -1;
}
#ifndef QT_NO_MENUBAR
@@ -162,25 +144,13 @@ QAccessibleInterface *QAccessibleMenuBar::child(int index) const
return 0;
}
-int QAccessibleMenuBar::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
-{
- if (relation == QAccessible::Child) {
- *target = child(entry - 1);
- return *target ? 0 : -1;
- }
- return QAccessibleWidget::navigate(relation, entry, target);
-}
-
int QAccessibleMenuBar::indexOfChild(const QAccessibleInterface *child) const
{
- int index = -1;
QAccessible::Role r = child->role();
if ((r == QAccessible::MenuItem || r == QAccessible::Separator) && menuBar()) {
- index = menuBar()->actions().indexOf(qobject_cast<QAction*>(child->object()));
- if (index != -1)
- ++index;
+ return menuBar()->actions().indexOf(qobject_cast<QAction*>(child->object()));
}
- return index;
+ return -1;
}
#endif // QT_NO_MENUBAR
@@ -193,17 +163,16 @@ QAccessibleMenuItem::QAccessibleMenuItem(QWidget *owner, QAction *action)
QAccessibleMenuItem::~QAccessibleMenuItem()
{}
-int QAccessibleMenuItem::childAt(int x, int y ) const
+QAccessibleInterface *QAccessibleMenuItem::childAt(int x, int y ) const
{
for (int i = childCount(); i >= 0; --i) {
QAccessibleInterface *childInterface = child(i);
if (childInterface->rect().contains(x,y)) {
- delete childInterface;
- return i;
+ return childInterface;
}
delete childInterface;
}
- return -1;
+ return 0;
}
int QAccessibleMenuItem::childCount() const
@@ -213,10 +182,8 @@ int QAccessibleMenuItem::childCount() const
int QAccessibleMenuItem::indexOfChild(const QAccessibleInterface * child) const
{
- Q_ASSERT(child == 0);
- if (child->role() == QAccessible::PopupMenu && child->object() == m_action->menu())
- return 1;
-
+ if (child && child->role() == QAccessible::PopupMenu && child->object() == m_action->menu())
+ return 0;
return -1;
}
@@ -239,43 +206,10 @@ QAccessibleInterface *QAccessibleMenuItem::child(int index) const
int QAccessibleMenuItem::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
{
+ Q_UNUSED(relation);
+ Q_UNUSED(entry);
*target = 0;
- if (entry < 0) {
- return -1;
- }
-
- switch (relation) {
- case QAccessible::Child:
- *target = child(entry - 1);
- break;
- case QAccessible::Ancestor:
- *target = parent();
- break;
- case QAccessible::Up:
- case QAccessible::Down:{
- QAccessibleInterface *parentIface = parent();
- if (parentIface) {
- int index = parentIface->indexOfChild(this);
- if (index != -1) {
- index += (relation == QAccessible::Down ? +1 : -1);
- *target = parentIface->child(index - 1);
- }
- }
- delete parentIface;
- break;
- }
- case QAccessible::Sibling: {
- QAccessibleInterface *parentIface = parent();
- if (parentIface)
- *target = parentIface->child(entry - 1);
- delete parentIface;
- break;
- }
- default:
- break;
-
- }
- return *target ? 0 : -1;
+ return -1;
}
void *QAccessibleMenuItem::interface_cast(QAccessible::InterfaceType t)
@@ -309,16 +243,6 @@ QRect QAccessibleMenuItem::rect() const
return rect;
}
-QAccessible::Relation QAccessibleMenuItem::relationTo(const QAccessibleInterface *other) const
-{
- if (other->object() == owner()) {
- return QAccessible::Child;
- }
- Q_UNUSED(other)
- // ###
- return QAccessible::Unrelated;
-}
-
QAccessible::Role QAccessibleMenuItem::role() const
{
return m_action->isSeparator() ? QAccessible::Separator : QAccessible::MenuItem;
@@ -330,28 +254,28 @@ void QAccessibleMenuItem::setText(QAccessible::Text /*t*/, const QString & /*tex
QAccessible::State QAccessibleMenuItem::state() const
{
- QAccessible::State s = QAccessible::Normal;
+ QAccessible::State s;
QWidget *own = owner();
if (own->testAttribute(Qt::WA_WState_Visible) == false || m_action->isVisible() == false) {
- s |= QAccessible::Invisible;
+ s.invisible = true;
}
if (QMenu *menu = qobject_cast<QMenu*>(own)) {
if (menu->activeAction() == m_action)
- s |= QAccessible::Focused;
+ s.focused = true;
#ifndef QT_NO_MENUBAR
} else if (QMenuBar *menuBar = qobject_cast<QMenuBar*>(own)) {
if (menuBar->activeAction() == m_action)
- s |= QAccessible::Focused;
+ s.focused = true;
#endif
}
if (own->style()->styleHint(QStyle::SH_Menu_MouseTracking))
- s |= QAccessible::HotTracked;
+ s.hotTracked = true;
if (m_action->isSeparator() || !m_action->isEnabled())
- s |= QAccessible::Unavailable;
+ s.disabled = true;
if (m_action->isChecked())
- s |= QAccessible::Checked;
+ s.checked = true;
return s;
}
diff --git a/src/plugins/accessible/widgets/qaccessiblemenu.h b/src/plugins/accessible/widgets/qaccessiblemenu.h
index cf6a703b0c..873aacd5d4 100644
--- a/src/plugins/accessible/widgets/qaccessiblemenu.h
+++ b/src/plugins/accessible/widgets/qaccessiblemenu.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -59,13 +59,12 @@ public:
explicit QAccessibleMenu(QWidget *w);
int childCount() const;
- int childAt(int x, int y) const;
+ QAccessibleInterface *childAt(int x, int y) const;
QString text(QAccessible::Text t) const;
QAccessible::Role role() const;
QAccessibleInterface *child(int index) const;
QAccessibleInterface *parent() const;
- int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
int indexOfChild( const QAccessibleInterface *child ) const;
protected:
@@ -81,7 +80,6 @@ public:
QAccessibleInterface *child(int index) const;
int childCount() const;
- int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
int indexOfChild(const QAccessibleInterface *child) const;
protected:
@@ -95,20 +93,19 @@ class QAccessibleMenuItem : public QAccessibleInterface, public QAccessibleActio
public:
explicit QAccessibleMenuItem(QWidget *owner, QAction *w);
- virtual ~QAccessibleMenuItem();
-
+ ~QAccessibleMenuItem();
void *interface_cast(QAccessible::InterfaceType t);
- int childAt(int x, int y) const;
+
int childCount() const;
- int indexOfChild(const QAccessibleInterface * child) const;
+ QAccessibleInterface *childAt(int x, int y) const;
bool isValid() const;
+ int indexOfChild(const QAccessibleInterface * child) const;
QAccessibleInterface *parent() const;
QAccessibleInterface *child(int index) const;
int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface ** target) const;
QObject * object() const;
QRect rect() const;
- QAccessible::Relation relationTo(const QAccessibleInterface *other) const;
QAccessible::Role role() const;
void setText(QAccessible::Text t, const QString & text);
QAccessible::State state() const;
diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
index c1cdd7c45d..70d1a7bf48 100644
--- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
+++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -98,121 +98,6 @@ QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel)
return widgets;
}
-static inline int distance(QWidget *source, QWidget *target,
- QAccessible::RelationFlag relation)
-{
- if (!source || !target)
- return -1;
-
- int returnValue = -1;
- switch (relation) {
- case QAccessible::Up:
- if (target->y() <= source->y())
- returnValue = source->y() - target->y();
- break;
- case QAccessible::Down:
- if (target->y() >= source->y() + source->height())
- returnValue = target->y() - (source->y() + source->height());
- break;
- case QAccessible::Right:
- if (target->x() >= source->x() + source->width())
- returnValue = target->x() - (source->x() + source->width());
- break;
- case QAccessible::Left:
- if (target->x() <= source->x())
- returnValue = source->x() - target->x();
- break;
- default:
- break;
- }
- return returnValue;
-}
-
-static inline QWidget *mdiAreaNavigate(QWidget *area,
- QAccessible::RelationFlag relation, int entry)
-{
-#if defined(QT_NO_MDIAREA) && defined(QT_NO_WORKSPACE)
- Q_UNUSED(area);
-#endif
-#ifndef QT_NO_MDIAREA
- const QMdiArea *mdiArea = qobject_cast<QMdiArea *>(area);
-#endif
-#ifndef QT_NO_WORKSPACE
- const QWorkspace *workspace = qobject_cast<QWorkspace *>(area);
-#endif
- if (true
-#ifndef QT_NO_MDIAREA
- && !mdiArea
-#endif
-#ifndef QT_NO_WORKSPACE
- && !workspace
-#endif
- )
- return 0;
-
- QWidgetList windows;
-#ifndef QT_NO_MDIAREA
- if (mdiArea) {
- foreach (QMdiSubWindow *window, mdiArea->subWindowList())
- windows.append(window);
- } else
-#endif
- {
-#ifndef QT_NO_WORKSPACE
- foreach (QWidget *window, workspace->windowList())
- windows.append(window->parentWidget());
-#endif
- }
-
- if (windows.isEmpty() || entry < 1 || entry > windows.count())
- return 0;
-
- QWidget *source = windows.at(entry - 1);
- QMap<int, QWidget *> candidates;
- foreach (QWidget *window, windows) {
- if (source == window)
- continue;
- int candidateDistance = distance(source, window, relation);
- if (candidateDistance >= 0)
- candidates.insert(candidateDistance, window);
- }
-
- int minimumDistance = INT_MAX;
- QWidget *target = 0;
- foreach (QWidget *candidate, candidates) {
- switch (relation) {
- case QAccessible::Up:
- case QAccessible::Down:
- if (qAbs(candidate->x() - source->x()) < minimumDistance) {
- target = candidate;
- minimumDistance = qAbs(candidate->x() - source->x());
- }
- break;
- case QAccessible::Left:
- case QAccessible::Right:
- if (qAbs(candidate->y() - source->y()) < minimumDistance) {
- target = candidate;
- minimumDistance = qAbs(candidate->y() - source->y());
- }
- break;
- default:
- break;
- }
- if (minimumDistance == 0)
- break;
- }
-
-#ifndef QT_NO_WORKSPACE
- if (workspace) {
- foreach (QWidget *widget, workspace->windowList()) {
- if (widget->parentWidget() == target)
- target = widget;
- }
- }
-#endif
- return target;
-}
-
#ifndef QT_NO_TEXTEDIT
/*!
@@ -282,26 +167,6 @@ void QAccessibleTextEdit::setText(QAccessible::Text t, const QString &text)
textEdit()->setText(text);
}
-QVariant QAccessibleTextEdit::invokeMethod(QAccessible::Method method,
- const QVariantList &params)
-{
- switch (method) {
- case QAccessible::ListSupportedMethods: {
- QSet<QAccessible::Method> set;
- set << QAccessible::ListSupportedMethods << QAccessible::SetCursorPosition << QAccessible::GetCursorPosition;
- return QVariant::fromValue(set | qvariant_cast<QSet<QAccessible::Method> >(
- QAccessibleWidget::invokeMethod(method, params)));
- }
- case QAccessible::SetCursorPosition:
- setCursorPosition(params.value(0).toInt());
- return true;
- case QAccessible::GetCursorPosition:
- return textEdit()->textCursor().position();
- default:
- return QAccessibleWidget::invokeMethod(method, params);
- }
-}
-
void *QAccessibleTextEdit::interface_cast(QAccessible::InterfaceType t)
{
if (t == QAccessible::TextInterface)
@@ -316,7 +181,7 @@ void QAccessibleTextEdit::addSelection(int startOffset, int endOffset)
setSelection(0, startOffset, endOffset);
}
-QString QAccessibleTextEdit::attributes(int offset, int *startOffset, int *endOffset)
+QString QAccessibleTextEdit::attributes(int offset, int *startOffset, int *endOffset) const
{
/* The list of attributes can be found at:
http://linuxfoundation.org/collaborate/workgroups/accessibility/iaccessible2/textattributes
@@ -426,12 +291,12 @@ QString QAccessibleTextEdit::attributes(int offset, int *startOffset, int *endOf
return result;
}
-int QAccessibleTextEdit::cursorPosition()
+int QAccessibleTextEdit::cursorPosition() const
{
return textEdit()->textCursor().position();
}
-QRect QAccessibleTextEdit::characterRect(int offset, CoordinateType coordType)
+QRect QAccessibleTextEdit::characterRect(int offset, CoordinateType coordType) const
{
QTextEdit *edit = textEdit();
QTextCursor cursor(edit->document());
@@ -463,12 +328,12 @@ QRect QAccessibleTextEdit::characterRect(int offset, CoordinateType coordType)
return r;
}
-int QAccessibleTextEdit::selectionCount()
+int QAccessibleTextEdit::selectionCount() const
{
return textEdit()->textCursor().hasSelection() ? 1 : 0;
}
-int QAccessibleTextEdit::offsetAtPoint(const QPoint &point, CoordinateType coordType)
+int QAccessibleTextEdit::offsetAtPoint(const QPoint &point, CoordinateType coordType) const
{
QTextEdit *edit = textEdit();
@@ -481,7 +346,7 @@ int QAccessibleTextEdit::offsetAtPoint(const QPoint &point, CoordinateType coord
return edit->document()->documentLayout()->hitTest(p, Qt::ExactHit);
}
-void QAccessibleTextEdit::selection(int selectionIndex, int *startOffset, int *endOffset)
+void QAccessibleTextEdit::selection(int selectionIndex, int *startOffset, int *endOffset) const
{
*startOffset = *endOffset = 0;
QTextCursor cursor = textEdit()->textCursor();
@@ -493,7 +358,7 @@ void QAccessibleTextEdit::selection(int selectionIndex, int *startOffset, int *e
*endOffset = cursor.selectionEnd();
}
-QString QAccessibleTextEdit::text(int startOffset, int endOffset)
+QString QAccessibleTextEdit::text(int startOffset, int endOffset) const
{
QTextCursor cursor(textEdit()->document());
@@ -504,7 +369,7 @@ QString QAccessibleTextEdit::text(int startOffset, int endOffset)
}
QString QAccessibleTextEdit::textBeforeOffset (int offset, BoundaryType boundaryType,
- int *startOffset, int *endOffset)
+ int *startOffset, int *endOffset) const
{
// TODO - what exactly is before?
Q_UNUSED(offset);
@@ -515,7 +380,7 @@ QString QAccessibleTextEdit::textBeforeOffset (int offset, BoundaryType boundary
}
QString QAccessibleTextEdit::textAfterOffset(int offset, BoundaryType boundaryType,
- int *startOffset, int *endOffset)
+ int *startOffset, int *endOffset) const
{
// TODO - what exactly is after?
Q_UNUSED(offset);
@@ -526,7 +391,7 @@ QString QAccessibleTextEdit::textAfterOffset(int offset, BoundaryType boundaryTy
}
QString QAccessibleTextEdit::textAtOffset(int offset, BoundaryType boundaryType,
- int *startOffset, int *endOffset)
+ int *startOffset, int *endOffset) const
{
Q_ASSERT(startOffset);
Q_ASSERT(endOffset);
@@ -607,7 +472,7 @@ void QAccessibleTextEdit::setSelection(int selectionIndex, int startOffset, int
textEdit()->setTextCursor(cursor);
}
-int QAccessibleTextEdit::characterCount()
+int QAccessibleTextEdit::characterCount() const
{
return textEdit()->toPlainText().count();
}
@@ -640,7 +505,7 @@ static QTextCursor cursorForRange(QTextEdit *textEdit, int startOffset, int endO
return cursor;
}
-void QAccessibleTextEdit::copyText(int startOffset, int endOffset)
+void QAccessibleTextEdit::copyText(int startOffset, int endOffset) const
{
QTextCursor cursor = cursorForRange(textEdit(), startOffset, endOffset);
@@ -716,23 +581,17 @@ QAccessibleStackedWidget::QAccessibleStackedWidget(QWidget *widget)
Q_ASSERT(qobject_cast<QStackedWidget *>(widget));
}
-QVariant QAccessibleStackedWidget::invokeMethod(QAccessible::Method, int, const QVariantList &)
-{
- return QVariant();
-}
-
-
-int QAccessibleStackedWidget::childAt(int x, int y) const
+QAccessibleInterface *QAccessibleStackedWidget::childAt(int x, int y) const
{
if (!stackedWidget()->isVisible())
- return -1;
+ return 0;
QWidget *currentWidget = stackedWidget()->currentWidget();
if (!currentWidget)
- return -1;
+ return 0;
QPoint position = currentWidget->mapFromGlobal(QPoint(x, y));
if (currentWidget->rect().contains(position))
- return 1;
- return -1;
+ return child(stackedWidget()->currentIndex());
+ return 0;
}
int QAccessibleStackedWidget::childCount() const
@@ -746,10 +605,7 @@ int QAccessibleStackedWidget::indexOfChild(const QAccessibleInterface *child) co
return -1;
QWidget* widget = qobject_cast<QWidget*>(child->object());
- int index = stackedWidget()->indexOf(widget);
- if (index >= 0) // one based counting of children
- return index + 1;
- return -1;
+ return stackedWidget()->indexOf(widget);
}
QAccessibleInterface *QAccessibleStackedWidget::child(int index) const
@@ -759,17 +615,6 @@ QAccessibleInterface *QAccessibleStackedWidget::child(int index) const
return QAccessible::queryAccessibleInterface(stackedWidget()->widget(index));
}
-int QAccessibleStackedWidget::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
-{
- switch (relation) {
- case QAccessible::Child:
- *target = child(entry - 1);
- return *target ? 0 : -1;
- default:
- return QAccessibleWidget::navigate(relation, entry, target);
- }
-}
-
QStackedWidget *QAccessibleStackedWidget::stackedWidget() const
{
return static_cast<QStackedWidget *>(object());
@@ -803,42 +648,26 @@ int QAccessibleMdiArea::childCount() const
return mdiArea()->subWindowList().count();
}
+QAccessibleInterface *QAccessibleMdiArea::child(int index) const
+{
+ QList<QMdiSubWindow *> subWindows = mdiArea()->subWindowList();
+ QWidget *targetObject = subWindows.value(index);
+ if (!targetObject)
+ return 0;
+ return QAccessible::queryAccessibleInterface(targetObject);
+}
+
+
int QAccessibleMdiArea::indexOfChild(const QAccessibleInterface *child) const
{
if (!child || !child->object() || mdiArea()->subWindowList().isEmpty())
return -1;
if (QMdiSubWindow *window = qobject_cast<QMdiSubWindow *>(child->object())) {
- int index = mdiArea()->subWindowList().indexOf(window);
- if (index != -1)
- return ++index;
+ return mdiArea()->subWindowList().indexOf(window);
}
return -1;
}
-int QAccessibleMdiArea::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
-{
- *target = 0;
- QWidget *targetObject = 0;
- QList<QMdiSubWindow *> subWindows = mdiArea()->subWindowList();
- switch (relation) {
- case QAccessible::Child:
- if (entry < 1 || subWindows.isEmpty() || entry > subWindows.count())
- return -1;
- targetObject = subWindows.at(entry - 1);
- break;
- case QAccessible::Up:
- case QAccessible::Down:
- case QAccessible::Left:
- case QAccessible::Right:
- targetObject = mdiAreaNavigate(mdiArea(), relation, entry);
- break;
- default:
- return QAccessibleWidget::navigate(relation, entry, target);
- }
- *target = QAccessible::queryAccessibleInterface(targetObject);
- return *target ? 0: -1;
-}
-
QMdiArea *QAccessibleMdiArea::mdiArea() const
{
return static_cast<QMdiArea *>(object());
@@ -871,18 +700,21 @@ void QAccessibleMdiSubWindow::setText(QAccessible::Text textType, const QString
QAccessible::State QAccessibleMdiSubWindow::state() const
{
- QAccessible::State state = QAccessible::Normal | QAccessible::Focusable;
- if (!mdiSubWindow()->isMaximized())
- state |= (QAccessible::Movable | QAccessible::Sizeable);
+ QAccessible::State state;
+ state.focusable = true;
+ if (!mdiSubWindow()->isMaximized()) {
+ state.movable = true;
+ state.sizeable = true;
+ }
if (mdiSubWindow()->isAncestorOf(QApplication::focusWidget())
|| QApplication::focusWidget() == mdiSubWindow())
- state |= QAccessible::Focused;
+ state.focused = true;
if (!mdiSubWindow()->isVisible())
- state |= QAccessible::Invisible;
+ state.invisible = true;
if (!mdiSubWindow()->parentWidget()->contentsRect().contains(mdiSubWindow()->geometry()))
- state |= QAccessible::Offscreen;
+ state.offscreen = true;
if (!mdiSubWindow()->isEnabled())
- state |= QAccessible::Unavailable;
+ state.disabled = true;
return state;
}
@@ -893,54 +725,20 @@ int QAccessibleMdiSubWindow::childCount() const
return 0;
}
-int QAccessibleMdiSubWindow::indexOfChild(const QAccessibleInterface *child) const
+QAccessibleInterface *QAccessibleMdiSubWindow::child(int index) const
{
- if (child && child->object() && child->object() == mdiSubWindow()->widget())
- return 1;
- return -1;
+ QMdiSubWindow *source = mdiSubWindow();
+ if (index != 0 || !source->widget())
+ return 0;
+
+ return QAccessible::queryAccessibleInterface(source->widget());
}
-int QAccessibleMdiSubWindow::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
+int QAccessibleMdiSubWindow::indexOfChild(const QAccessibleInterface *child) const
{
- *target = 0;
-
- if (!mdiSubWindow()->parent())
- return QAccessibleWidget::navigate(relation, entry, target);
-
- QWidget *targetObject = 0;
- QMdiSubWindow *source = mdiSubWindow();
- switch (relation) {
- case QAccessible::Child:
- if (entry != 1 || !source->widget())
- return -1;
- targetObject = source->widget();
- break;
- case QAccessible::Up:
- case QAccessible::Down:
- case QAccessible::Left:
- case QAccessible::Right: {
- if (entry != 0)
- break;
- QWidget *parent = source->parentWidget();
- while (parent && !parent->inherits("QMdiArea"))
- parent = parent->parentWidget();
- QMdiArea *mdiArea = qobject_cast<QMdiArea *>(parent);
- if (!mdiArea)
- break;
- int index = mdiArea->subWindowList().indexOf(source);
- if (index == -1)
- break;
- if (QWidget *dest = mdiAreaNavigate(mdiArea, relation, index + 1)) {
- *target = QAccessible::queryAccessibleInterface(dest);
- return *target ? 0 : -1;
- }
- break;
- }
- default:
- return QAccessibleWidget::navigate(relation, entry, target);
- }
- *target = QAccessible::queryAccessibleInterface(targetObject);
- return *target ? 0: -1;
+ if (child && child->object() && child->object() == mdiSubWindow()->widget())
+ return 0;
+ return -1;
}
QRect QAccessibleMdiSubWindow::rect() const
@@ -953,25 +751,6 @@ QRect QAccessibleMdiSubWindow::rect() const
return QRect(pos, mdiSubWindow()->size());
}
-int QAccessibleMdiSubWindow::childAt(int x, int y) const
-{
- if (!mdiSubWindow()->isVisible())
- return -1;
- if (!mdiSubWindow()->parent())
- return QAccessibleWidget::childAt(x, y);
- const QRect globalGeometry = rect();
- if (!globalGeometry.isValid())
- return -1;
- QAccessibleInterface *childIface = child(0);
- const QRect globalChildGeometry = childIface->rect();
- delete childIface;
- if (globalChildGeometry.isValid() && globalChildGeometry.contains(QPoint(x, y)))
- return 1;
- if (globalGeometry.contains(QPoint(x, y)))
- return 0;
- return -1;
-}
-
QMdiSubWindow *QAccessibleMdiSubWindow::mdiSubWindow() const
{
return static_cast<QMdiSubWindow *>(object());
@@ -991,42 +770,25 @@ int QAccessibleWorkspace::childCount() const
return workspace()->windowList().count();
}
+QAccessibleInterface *QAccessibleWorkspace::child(int index) const
+{
+ QWidgetList subWindows = workspace()->windowList();
+ if (index < 0 || subWindows.isEmpty() || index >= subWindows.count())
+ return 0;
+ QObject *targetObject = subWindows.at(index);
+ return QAccessible::queryAccessibleInterface(targetObject);
+}
+
int QAccessibleWorkspace::indexOfChild(const QAccessibleInterface *child) const
{
if (!child || !child->object() || workspace()->windowList().isEmpty())
return -1;
if (QWidget *window = qobject_cast<QWidget *>(child->object())) {
- int index = workspace()->windowList().indexOf(window);
- if (index != -1)
- return ++index;
+ return workspace()->windowList().indexOf(window);
}
return -1;
}
-int QAccessibleWorkspace::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
-{
- *target = 0;
- QWidget *targetObject = 0;
- QWidgetList subWindows = workspace()->windowList();
- switch (relation) {
- case QAccessible::Child:
- if (entry < 1 || subWindows.isEmpty() || entry > subWindows.count())
- return -1;
- targetObject = subWindows.at(entry - 1);
- break;
- case QAccessible::Up:
- case QAccessible::Down:
- case QAccessible::Left:
- case QAccessible::Right:
- targetObject = mdiAreaNavigate(workspace(), relation, entry);
- break;
- default:
- return QAccessibleWidget::navigate(relation, entry, target);
- }
- *target = QAccessible::queryAccessibleInterface(targetObject);
- return *target ? 0: -1;
-}
-
QWorkspace *QAccessibleWorkspace::workspace() const
{
return static_cast<QWorkspace *>(object());
@@ -1041,10 +803,6 @@ QAccessibleDialogButtonBox::QAccessibleDialogButtonBox(QWidget *widget)
Q_ASSERT(qobject_cast<QDialogButtonBox*>(widget));
}
-QVariant QAccessibleDialogButtonBox::invokeMethod(QAccessible::Method, int, const QVariantList &)
-{
- return QVariant();
-}
#endif // QT_NO_DIALOGBUTTONBOX
#ifndef QT_NO_TEXTBROWSER
@@ -1068,11 +826,6 @@ QAccessibleCalendarWidget::QAccessibleCalendarWidget(QWidget *widget)
Q_ASSERT(qobject_cast<QCalendarWidget *>(widget));
}
-QVariant QAccessibleCalendarWidget::invokeMethod(QAccessible::Method, int, const QVariantList &)
-{
- return QVariant();
-}
-
int QAccessibleCalendarWidget::childCount() const
{
return calendarWidget()->isNavigationBarVisible() ? 2 : 1;
@@ -1083,8 +836,8 @@ int QAccessibleCalendarWidget::indexOfChild(const QAccessibleInterface *child) c
if (!child || !child->object() || childCount() <= 0)
return -1;
if (qobject_cast<QAbstractItemView *>(child->object()))
- return childCount();
- return 1;
+ return childCount() - 1; // FIXME
+ return 0;
}
QAccessibleInterface *QAccessibleCalendarWidget::child(int index) const
@@ -1098,31 +851,6 @@ QAccessibleInterface *QAccessibleCalendarWidget::child(int index) const
return QAccessible::queryAccessibleInterface(calendarView());
}
-int QAccessibleCalendarWidget::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
-{
- *target = 0;
- if (entry <= 0 || entry > childCount())
- return QAccessibleWidget::navigate(relation, entry, target);
- QWidget *targetWidget = 0;
- switch (relation) {
- case QAccessible::Child:
- *target = child(entry - 1);
- return *target ? 0 : -1;
- case QAccessible::Up:
- if (entry == 2)
- targetWidget = navigationBar();
- break;
- case QAccessible::Down:
- if (entry == 1 && childCount() == 2)
- targetWidget = calendarView();
- break;
- default:
- return QAccessibleWidget::navigate(relation, entry, target);
- }
- *target = QAccessible::queryAccessibleInterface(targetWidget);
- return *target ? 0 : -1;
-}
-
QCalendarWidget *QAccessibleCalendarWidget::calendarWidget() const
{
return static_cast<QCalendarWidget *>(object());
@@ -1173,9 +901,9 @@ int QAccessibleDockWidget::indexOfChild(const QAccessibleInterface *child) const
{
if (child) {
if (child->role() == QAccessible::TitleBar) {
- return 1;
+ return 0;
} else {
- return 2; //###
+ return 1; // FIXME
}
}
return -1;
@@ -1240,9 +968,6 @@ QAccessibleInterface *QAccessibleTitleBar::child(int index) const
int QAccessibleTitleBar::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **iface) const
{
switch (relation) {
- case QAccessible::Child:
- *iface = child(entry - 1);
- return *iface ? 0 : -1;
case QAccessible::FocusChild:
// ###
if (entry >= 1) {
@@ -1261,9 +986,6 @@ int QAccessibleTitleBar::navigate(QAccessible::RelationFlag relation, int entry,
return role > QDockWidgetLayout::FloatButton ? -1 : index;
}
break;
- case QAccessible::Ancestor:
- *iface = parent();
- return iface ? 0 : -1;
default:
break;
}
@@ -1271,11 +993,6 @@ int QAccessibleTitleBar::navigate(QAccessible::RelationFlag relation, int entry,
return -1;
}
-QAccessible::Relation QAccessibleTitleBar::relationTo(const QAccessibleInterface * /*otherChild*/) const
-{
- return QAccessible::Unrelated; //###
-}
-
int QAccessibleTitleBar::indexOfChild(const QAccessibleInterface * /*child*/) const
{
return -1;
@@ -1303,17 +1020,17 @@ QString QAccessibleTitleBar::text(QAccessible::Text t) const
QAccessible::State QAccessibleTitleBar::state() const
{
- QAccessible::State state = QAccessible::Normal;
+ QAccessible::State state;
QDockWidget *w = dockWidget();
if (w->testAttribute(Qt::WA_WState_Visible) == false)
- state |= QAccessible::Invisible;
+ state.invisible = true;
if (w->focusPolicy() != Qt::NoFocus && w->isActiveWindow())
- state |= QAccessible::Focusable;
+ state.focusable = true;
if (w->hasFocus())
- state |= QAccessible::Focused;
+ state.focused = true;
if (!w->isEnabled())
- state |= QAccessible::Unavailable;
+ state.disabled = true;
return state;
}
@@ -1344,17 +1061,16 @@ QRect QAccessibleTitleBar::rect() const
return rect;
}
-int QAccessibleTitleBar::childAt(int x, int y) const
+QAccessibleInterface *QAccessibleTitleBar::childAt(int x, int y) const
{
- for (int i = childCount(); i >= 0; --i) {
- QAccessibleInterface *childIface = child(i - 1);
+ for (int i = 0; i < childCount(); ++i) {
+ QAccessibleInterface *childIface = child(i);
if (childIface->rect().contains(x,y)) {
- delete childIface;
- return i;
+ return childIface;
}
delete childIface;
}
- return -1;
+ return 0;
}
QObject *QAccessibleTitleBar::object() const
@@ -1436,11 +1152,6 @@ bool QAccessibleTitleBar::isValid() const
QAccessibleMainWindow::QAccessibleMainWindow(QWidget *widget)
: QAccessibleWidget(widget, QAccessible::Window) { }
-QVariant QAccessibleMainWindow::invokeMethod(QAccessible::Method /*method*/, int /*child*/, const QVariantList & /*params*/)
-{
- return QVariant();
-}
-
QAccessibleInterface *QAccessibleMainWindow::child(int index) const
{
QList<QWidget*> kids = childWidgets(mainWindow(), true);
@@ -1459,25 +1170,24 @@ int QAccessibleMainWindow::childCount() const
int QAccessibleMainWindow::indexOfChild(const QAccessibleInterface *iface) const
{
QList<QWidget*> kids = childWidgets(mainWindow(), true);
- int childIndex = kids.indexOf(static_cast<QWidget*>(iface->object()));
- return childIndex == -1 ? -1 : ++childIndex;
+ return kids.indexOf(static_cast<QWidget*>(iface->object()));
}
-int QAccessibleMainWindow::childAt(int x, int y) const
+QAccessibleInterface *QAccessibleMainWindow::childAt(int x, int y) const
{
QWidget *w = widget();
if (!w->isVisible())
- return -1;
+ return 0;
QPoint gp = w->mapToGlobal(QPoint(0, 0));
if (!QRect(gp.x(), gp.y(), w->width(), w->height()).contains(x, y))
- return -1;
+ return 0;
QWidgetList kids = childWidgets(mainWindow(), true);
QPoint rp = mainWindow()->mapFromGlobal(QPoint(x, y));
for (int i = 0; i < kids.size(); ++i) {
QWidget *child = kids.at(i);
if (!child->isWindow() && !child->isHidden() && child->geometry().contains(rp)) {
- return i + 1;
+ return QAccessible::queryAccessibleInterface(child);
}
}
return 0;
diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.h b/src/plugins/accessible/widgets/qaccessiblewidgets.h
index 232293b32a..b53138636f 100644
--- a/src/plugins/accessible/widgets/qaccessiblewidgets.h
+++ b/src/plugins/accessible/widgets/qaccessiblewidgets.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -75,32 +75,31 @@ public:
QString text(QAccessible::Text t) const;
void setText(QAccessible::Text t, const QString &text);
- QVariant invokeMethod(QAccessible::Method method, const QVariantList &params);
void *interface_cast(QAccessible::InterfaceType t);
// QAccessibleTextInterface
void addSelection(int startOffset, int endOffset);
- QString attributes(int offset, int *startOffset, int *endOffset);
- int cursorPosition();
- QRect characterRect(int offset, QAccessible2::CoordinateType coordType);
- int selectionCount();
- int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType);
- void selection(int selectionIndex, int *startOffset, int *endOffset);
- QString text(int startOffset, int endOffset);
+ QString attributes(int offset, int *startOffset, int *endOffset) const;
+ int cursorPosition() const;
+ QRect characterRect(int offset, QAccessible2::CoordinateType coordType) const;
+ int selectionCount() const;
+ int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType) const;
+ void selection(int selectionIndex, int *startOffset, int *endOffset) const;
+ QString text(int startOffset, int endOffset) const;
QString textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset);
+ int *startOffset, int *endOffset) const;
QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset);
+ int *startOffset, int *endOffset) const;
QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset);
+ int *startOffset, int *endOffset) const;
void removeSelection(int selectionIndex);
void setCursorPosition(int position);
void setSelection(int selectionIndex, int startOffset, int endOffset);
- int characterCount();
+ int characterCount() const;
void scrollToSubstring(int startIndex, int endIndex);
// QAccessibleEditableTextInterface
- void copyText(int startOffset, int endOffset);
+ void copyText(int startOffset, int endOffset) const;
void deleteText(int startOffset, int endOffset);
void insertText(int offset, const QString &text);
void cutText(int startOffset, int endOffset);
@@ -121,12 +120,10 @@ class QAccessibleStackedWidget : public QAccessibleWidget
public:
explicit QAccessibleStackedWidget(QWidget *widget);
- QVariant invokeMethod(QAccessible::Method method, int child, const QVariantList &params);
- int childAt(int x, int y) const;
+ QAccessibleInterface *childAt(int x, int y) const;
int childCount() const;
int indexOfChild(const QAccessibleInterface *child) const;
QAccessibleInterface *child(int index) const;
- int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
protected:
QStackedWidget *stackedWidget() const;
@@ -154,8 +151,8 @@ public:
explicit QAccessibleMdiArea(QWidget *widget);
int childCount() const;
+ QAccessibleInterface *child(int index) const;
int indexOfChild(const QAccessibleInterface *child) const;
- int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
protected:
QMdiArea *mdiArea() const;
@@ -170,10 +167,9 @@ public:
void setText(QAccessible::Text textType, const QString &text);
QAccessible::State state() const;
int childCount() const;
+ QAccessibleInterface *child(int index) const;
int indexOfChild(const QAccessibleInterface *child) const;
- int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
QRect rect() const;
- int childAt(int x, int y) const;
protected:
QMdiSubWindow *mdiSubWindow() const;
@@ -187,8 +183,8 @@ public:
explicit QAccessibleWorkspace(QWidget *widget);
int childCount() const;
+ QAccessibleInterface *child(int index) const;
int indexOfChild(const QAccessibleInterface *child) const;
- int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
protected:
QWorkspace *workspace() const;
@@ -199,8 +195,6 @@ class QAccessibleDialogButtonBox : public QAccessibleWidget
{
public:
explicit QAccessibleDialogButtonBox(QWidget *widget);
-
- QVariant invokeMethod(QAccessible::Method method, int child, const QVariantList &params);
};
#ifndef QT_NO_TEXTBROWSER
@@ -221,12 +215,9 @@ public:
int childCount() const;
int indexOfChild(const QAccessibleInterface *child) const;
- int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
QAccessibleInterface *child(int index) const;
-
- QVariant invokeMethod(QAccessible::Method method, int child, const QVariantList &params);
protected:
QCalendarWidget *calendarWidget() const;
@@ -260,13 +251,12 @@ public:
int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **iface) const;
int indexOfChild(const QAccessibleInterface *child) const;
int childCount() const;
- QAccessible::Relation relationTo(const QAccessibleInterface *other) const;
+ QAccessibleInterface *childAt(int x, int y) const;
void setText(QAccessible::Text t, const QString &text);
QString text(QAccessible::Text t) const;
QAccessible::Role role() const;
QRect rect () const;
QAccessible::State state() const;
- int childAt(int x, int y) const;
QObject *object() const;
bool isValid() const;
@@ -287,10 +277,9 @@ public:
QAccessibleInterface *child(int index) const;
int childCount() const;
int indexOfChild(const QAccessibleInterface *iface) const;
- int childAt(int x, int y) const;
+ QAccessibleInterface *childAt(int x, int y) const;
QMainWindow *mainWindow() const;
- QVariant invokeMethod(QAccessible::Method method, int child, const QVariantList &params);
};
#endif //QT_NO_MAINWINDOW
diff --git a/src/plugins/accessible/widgets/rangecontrols.cpp b/src/plugins/accessible/widgets/rangecontrols.cpp
index 06ff8e2cbf..6c439a71f0 100644
--- a/src/plugins/accessible/widgets/rangecontrols.cpp
+++ b/src/plugins/accessible/widgets/rangecontrols.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -94,7 +94,7 @@ void *QAccessibleAbstractSpinBox::interface_cast(QAccessible::InterfaceType t)
return QAccessibleWidget::interface_cast(t);
}
-QVariant QAccessibleAbstractSpinBox::currentValue()
+QVariant QAccessibleAbstractSpinBox::currentValue() const
{
QVariant result = abstractSpinBox()->property("value");
QVariant::Type type = result.type();
@@ -112,12 +112,12 @@ void QAccessibleAbstractSpinBox::setCurrentValue(const QVariant &value)
abstractSpinBox()->setProperty("value", value);
}
-QVariant QAccessibleAbstractSpinBox::maximumValue()
+QVariant QAccessibleAbstractSpinBox::maximumValue() const
{
return abstractSpinBox()->property("maximum");
}
-QVariant QAccessibleAbstractSpinBox::minimumValue()
+QVariant QAccessibleAbstractSpinBox::minimumValue() const
{
return abstractSpinBox()->property("minimum");
}
@@ -258,7 +258,7 @@ void *QAccessibleAbstractSlider::interface_cast(QAccessible::InterfaceType t)
return QAccessibleWidget::interface_cast(t);
}
-QVariant QAccessibleAbstractSlider::currentValue()
+QVariant QAccessibleAbstractSlider::currentValue() const
{
return abstractSlider()->value();
}
@@ -268,12 +268,12 @@ void QAccessibleAbstractSlider::setCurrentValue(const QVariant &value)
abstractSlider()->setValue(value.toInt());
}
-QVariant QAccessibleAbstractSlider::maximumValue()
+QVariant QAccessibleAbstractSlider::maximumValue() const
{
return abstractSlider()->maximum();
}
-QVariant QAccessibleAbstractSlider::minimumValue()
+QVariant QAccessibleAbstractSlider::minimumValue() const
{
return abstractSlider()->minimum();
}
diff --git a/src/plugins/accessible/widgets/rangecontrols.h b/src/plugins/accessible/widgets/rangecontrols.h
index f6cbcc6900..218c48184c 100644
--- a/src/plugins/accessible/widgets/rangecontrols.h
+++ b/src/plugins/accessible/widgets/rangecontrols.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -67,10 +67,10 @@ public:
void *interface_cast(QAccessible::InterfaceType t);
// QAccessibleValueInterface
- QVariant currentValue();
+ QVariant currentValue() const;
void setCurrentValue(const QVariant &value);
- QVariant maximumValue();
- QVariant minimumValue();
+ QVariant maximumValue() const;
+ QVariant minimumValue() const;
// FIXME Action interface
@@ -106,10 +106,10 @@ public:
void *interface_cast(QAccessible::InterfaceType t);
// QAccessibleValueInterface
- QVariant currentValue();
+ QVariant currentValue() const;
void setCurrentValue(const QVariant &value);
- QVariant maximumValue();
- QVariant minimumValue();
+ QVariant maximumValue() const;
+ QVariant minimumValue() const;
protected:
QAbstractSlider *abstractSlider() const;
diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp
index 8f4fed48fe..d645ad2d22 100644
--- a/src/plugins/accessible/widgets/simplewidgets.cpp
+++ b/src/plugins/accessible/widgets/simplewidgets.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -140,18 +140,18 @@ QAccessible::State QAccessibleButton::state() const
QAbstractButton *b = button();
QCheckBox *cb = qobject_cast<QCheckBox *>(b);
if (b->isChecked())
- state |= QAccessible::Checked;
+ state.checked = true;
else if (cb && cb->checkState() == Qt::PartiallyChecked)
- state |= QAccessible::Mixed;
+ state.checkStateMixed = true;
if (b->isDown())
- state |= QAccessible::Pressed;
+ state.pressed = true;
QPushButton *pb = qobject_cast<QPushButton*>(b);
if (pb) {
if (pb->isDefault())
- state |= QAccessible::DefaultButton;
+ state.defaultButton = true;
#ifndef QT_NO_MENU
if (pb->menu())
- state |= QAccessible::HasPopup;
+ state.hasPopup = true;
#endif
}
@@ -171,7 +171,7 @@ QStringList QAccessibleButton::actionNames() const
break;
default:
if (button()->isCheckable()) {
- if (state() & QAccessible::Checked) {
+ if (state().checked) {
names << uncheckAction();
} else {
// FIXME
@@ -263,10 +263,10 @@ QAccessible::State QAccessibleToolButton::state() const
{
QAccessible::State st = QAccessibleButton::state();
if (toolButton()->autoRaise())
- st |= QAccessible::HotTracked;
+ st.hotTracked = true;
#ifndef QT_NO_MENU
if (toolButton()->menu())
- st |= QAccessible::HasPopup;
+ st.hasPopup = true;
#endif
return st;
}
@@ -464,10 +464,11 @@ int QAccessibleDisplay::navigate(QAccessible::RelationFlag rel, int entry, QAcce
} else {
QGroupBox *groupbox = qobject_cast<QGroupBox*>(object());
if (groupbox && !groupbox->title().isEmpty())
- rel = QAccessible::Child;
+ *target = child(entry - 1);
#endif
}
- *target = QAccessible::queryAccessibleInterface(targetObject);
+ if (targetObject)
+ *target = QAccessible::queryAccessibleInterface(targetObject);
if (*target)
return 0;
}
@@ -482,7 +483,7 @@ void *QAccessibleDisplay::interface_cast(QAccessible::InterfaceType t)
}
/*! \internal */
-QString QAccessibleDisplay::imageDescription()
+QString QAccessibleDisplay::imageDescription() const
{
#ifndef QT_NO_TOOLTIP
return widget()->toolTip();
@@ -492,7 +493,7 @@ QString QAccessibleDisplay::imageDescription()
}
/*! \internal */
-QSize QAccessibleDisplay::imageSize()
+QSize QAccessibleDisplay::imageSize() const
{
QLabel *label = qobject_cast<QLabel *>(widget());
if (!label)
@@ -504,7 +505,7 @@ QSize QAccessibleDisplay::imageSize()
}
/*! \internal */
-QRect QAccessibleDisplay::imagePosition(QAccessible2::CoordinateType coordType)
+QRect QAccessibleDisplay::imagePosition(QAccessible2::CoordinateType coordType) const
{
QLabel *label = qobject_cast<QLabel *>(widget());
if (!label)
@@ -587,40 +588,20 @@ QAccessible::State QAccessibleLineEdit::state() const
QLineEdit *l = lineEdit();
if (l->isReadOnly())
- state |= QAccessible::ReadOnly;
+ state.readOnly = true;
if (l->echoMode() != QLineEdit::Normal)
- state |= QAccessible::Protected;
- state |= QAccessible::Selectable;
+ state.passwordEdit = true;
+ state.selectable = true;
if (l->hasSelectedText())
- state |= QAccessible::Selected;
+ state.selected = true;
if (l->contextMenuPolicy() != Qt::NoContextMenu
&& l->contextMenuPolicy() != Qt::PreventContextMenu)
- state |= QAccessible::HasPopup;
+ state.hasPopup = true;
return state;
}
-QVariant QAccessibleLineEdit::invokeMethod(QAccessible::Method method,
- const QVariantList &params)
-{
- switch (method) {
- case QAccessible::ListSupportedMethods: {
- QSet<QAccessible::Method> set;
- set << QAccessible::ListSupportedMethods << QAccessible::SetCursorPosition << QAccessible::GetCursorPosition;
- return QVariant::fromValue(set | qvariant_cast<QSet<QAccessible::Method> >(
- QAccessibleWidget::invokeMethod(method, params)));
- }
- case QAccessible::SetCursorPosition:
- setCursorPosition(params.value(0).toInt());
- return true;
- case QAccessible::GetCursorPosition:
- return cursorPosition();
- default:
- return QAccessibleWidget::invokeMethod(method, params);
- }
-}
-
void *QAccessibleLineEdit::interface_cast(QAccessible::InterfaceType t)
{
if (t == QAccessible::TextInterface)
@@ -635,30 +616,30 @@ void QAccessibleLineEdit::addSelection(int startOffset, int endOffset)
setSelection(0, startOffset, endOffset);
}
-QString QAccessibleLineEdit::attributes(int offset, int *startOffset, int *endOffset)
+QString QAccessibleLineEdit::attributes(int offset, int *startOffset, int *endOffset) const
{
// QLineEdit doesn't have text attributes
*startOffset = *endOffset = offset;
return QString();
}
-int QAccessibleLineEdit::cursorPosition()
+int QAccessibleLineEdit::cursorPosition() const
{
return lineEdit()->cursorPosition();
}
-QRect QAccessibleLineEdit::characterRect(int /*offset*/, CoordinateType /*coordType*/)
+QRect QAccessibleLineEdit::characterRect(int /*offset*/, CoordinateType /*coordType*/) const
{
// QLineEdit doesn't hand out character rects
return QRect();
}
-int QAccessibleLineEdit::selectionCount()
+int QAccessibleLineEdit::selectionCount() const
{
return lineEdit()->hasSelectedText() ? 1 : 0;
}
-int QAccessibleLineEdit::offsetAtPoint(const QPoint &point, CoordinateType coordType)
+int QAccessibleLineEdit::offsetAtPoint(const QPoint &point, CoordinateType coordType) const
{
QPoint p = point;
if (coordType == RelativeToScreen)
@@ -667,7 +648,7 @@ int QAccessibleLineEdit::offsetAtPoint(const QPoint &point, CoordinateType coord
return lineEdit()->cursorPositionAt(p);
}
-void QAccessibleLineEdit::selection(int selectionIndex, int *startOffset, int *endOffset)
+void QAccessibleLineEdit::selection(int selectionIndex, int *startOffset, int *endOffset) const
{
*startOffset = *endOffset = 0;
if (selectionIndex != 0)
@@ -677,7 +658,7 @@ void QAccessibleLineEdit::selection(int selectionIndex, int *startOffset, int *e
*endOffset = *startOffset + lineEdit()->selectedText().count();
}
-QString QAccessibleLineEdit::text(int startOffset, int endOffset)
+QString QAccessibleLineEdit::text(int startOffset, int endOffset) const
{
if (startOffset > endOffset)
return QString();
@@ -689,7 +670,7 @@ QString QAccessibleLineEdit::text(int startOffset, int endOffset)
}
QString QAccessibleLineEdit::textBeforeOffset(int offset, BoundaryType boundaryType,
- int *startOffset, int *endOffset)
+ int *startOffset, int *endOffset) const
{
if (lineEdit()->echoMode() != QLineEdit::Normal) {
*startOffset = *endOffset = -1;
@@ -699,7 +680,7 @@ QString QAccessibleLineEdit::textBeforeOffset(int offset, BoundaryType boundaryT
}
QString QAccessibleLineEdit::textAfterOffset(int offset, BoundaryType boundaryType,
- int *startOffset, int *endOffset)
+ int *startOffset, int *endOffset) const
{
if (lineEdit()->echoMode() != QLineEdit::Normal) {
*startOffset = *endOffset = -1;
@@ -709,7 +690,7 @@ QString QAccessibleLineEdit::textAfterOffset(int offset, BoundaryType boundaryTy
}
QString QAccessibleLineEdit::textAtOffset(int offset, BoundaryType boundaryType,
- int *startOffset, int *endOffset)
+ int *startOffset, int *endOffset) const
{
if (lineEdit()->echoMode() != QLineEdit::Normal) {
*startOffset = *endOffset = -1;
@@ -739,7 +720,7 @@ void QAccessibleLineEdit::setSelection(int selectionIndex, int startOffset, int
lineEdit()->setSelection(startOffset, endOffset - startOffset);
}
-int QAccessibleLineEdit::characterCount()
+int QAccessibleLineEdit::characterCount() const
{
return lineEdit()->text().count();
}
@@ -766,17 +747,17 @@ void *QAccessibleProgressBar::interface_cast(QAccessible::InterfaceType t)
return QAccessibleDisplay::interface_cast(t);
}
-QVariant QAccessibleProgressBar::currentValue()
+QVariant QAccessibleProgressBar::currentValue() const
{
return progressBar()->value();
}
-QVariant QAccessibleProgressBar::maximumValue()
+QVariant QAccessibleProgressBar::maximumValue() const
{
return progressBar()->maximum();
}
-QVariant QAccessibleProgressBar::minimumValue()
+QVariant QAccessibleProgressBar::minimumValue() const
{
return progressBar()->minimum();
}
diff --git a/src/plugins/accessible/widgets/simplewidgets.h b/src/plugins/accessible/widgets/simplewidgets.h
index 40386153be..88bc931336 100644
--- a/src/plugins/accessible/widgets/simplewidgets.h
+++ b/src/plugins/accessible/widgets/simplewidgets.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -109,9 +109,9 @@ public:
void *interface_cast(QAccessible::InterfaceType t);
// QAccessibleImageInterface
- QString imageDescription();
- QSize imageSize();
- QRect imagePosition(QAccessible2::CoordinateType coordType);
+ QString imageDescription() const;
+ QSize imageSize() const;
+ QRect imagePosition(QAccessible2::CoordinateType coordType) const;
};
#ifndef QT_NO_LINEEDIT
@@ -124,28 +124,27 @@ public:
QString text(QAccessible::Text t) const;
void setText(QAccessible::Text t, const QString &text);
QAccessible::State state() const;
- QVariant invokeMethod(QAccessible::Method method, const QVariantList &params);
void *interface_cast(QAccessible::InterfaceType t);
// QAccessibleTextInterface
void addSelection(int startOffset, int endOffset);
- QString attributes(int offset, int *startOffset, int *endOffset);
- int cursorPosition();
- QRect characterRect(int offset, QAccessible2::CoordinateType coordType);
- int selectionCount();
- int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType);
- void selection(int selectionIndex, int *startOffset, int *endOffset);
- QString text(int startOffset, int endOffset);
+ QString attributes(int offset, int *startOffset, int *endOffset) const;
+ int cursorPosition() const;
+ QRect characterRect(int offset, QAccessible2::CoordinateType coordType) const;
+ int selectionCount() const;
+ int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType) const;
+ void selection(int selectionIndex, int *startOffset, int *endOffset) const;
+ QString text(int startOffset, int endOffset) const;
QString textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset);
+ int *startOffset, int *endOffset) const;
QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset);
+ int *startOffset, int *endOffset) const;
QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset);
+ int *startOffset, int *endOffset) const;
void removeSelection(int selectionIndex);
void setCursorPosition(int position);
void setSelection(int selectionIndex, int startOffset, int endOffset);
- int characterCount();
+ int characterCount() const;
void scrollToSubstring(int startIndex, int endIndex);
protected:
@@ -161,9 +160,9 @@ public:
void *interface_cast(QAccessible::InterfaceType t);
// QAccessibleValueInterface
- QVariant currentValue();
- QVariant maximumValue();
- QVariant minimumValue();
+ QVariant currentValue() const;
+ QVariant maximumValue() const;
+ QVariant minimumValue() const;
inline void setCurrentValue(const QVariant &) {}
protected:
diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro
index ead498e079..12b18ac1ea 100644
--- a/src/plugins/bearer/bearer.pro
+++ b/src/plugins/bearer/bearer.pro
@@ -1,12 +1,8 @@
TEMPLATE = subdirs
-contains(QT_CONFIG, dbus) {
- contains(QT_CONFIG, icd) {
- SUBDIRS += icd
- } else:linux* {
- SUBDIRS += generic
- SUBDIRS += connman networkmanager
- }
+linux*:contains(QT_CONFIG, dbus) {
+ SUBDIRS += generic
+ SUBDIRS += connman networkmanager
}
#win32:SUBDIRS += nla
diff --git a/src/plugins/bearer/connman/main.cpp b/src/plugins/bearer/connman/main.cpp
index a04f2a760f..730e6857ed 100644
--- a/src/plugins/bearer/connman/main.cpp
+++ b/src/plugins/bearer/connman/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
index de3985efd3..254a5ddd87 100644
--- a/src/plugins/bearer/connman/qconnmanengine.cpp
+++ b/src/plugins/bearer/connman/qconnmanengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h
index 0175112c80..ce944e3352 100644
--- a/src/plugins/bearer/connman/qconnmanengine.h
+++ b/src/plugins/bearer/connman/qconnmanengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
index edb8665039..81024e0e8b 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp
+++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux_p.h b/src/plugins/bearer/connman/qconnmanservice_linux_p.h
index 00a8bd8087..0298459798 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux_p.h
+++ b/src/plugins/bearer/connman/qconnmanservice_linux_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/connman/qofonoservice_linux.cpp b/src/plugins/bearer/connman/qofonoservice_linux.cpp
index 0980f79b99..b6670c98d6 100644
--- a/src/plugins/bearer/connman/qofonoservice_linux.cpp
+++ b/src/plugins/bearer/connman/qofonoservice_linux.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/connman/qofonoservice_linux_p.h b/src/plugins/bearer/connman/qofonoservice_linux_p.h
index e3282f1241..a6a64b8657 100644
--- a/src/plugins/bearer/connman/qofonoservice_linux_p.h
+++ b/src/plugins/bearer/connman/qofonoservice_linux_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/corewlan/main.cpp b/src/plugins/bearer/corewlan/main.cpp
index 781ec141b4..7cc8e9db29 100644
--- a/src/plugins/bearer/corewlan/main.cpp
+++ b/src/plugins/bearer/corewlan/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h
index 858d83a2f0..570640bc8f 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.h
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index c81f56a92c..5552252692 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/generic/main.cpp b/src/plugins/bearer/generic/main.cpp
index 838a6057f0..84d49a2365 100644
--- a/src/plugins/bearer/generic/main.cpp
+++ b/src/plugins/bearer/generic/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index 7e97ffef5b..1413514794 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h
index 23abb2dbca..33af624ce0 100644
--- a/src/plugins/bearer/generic/qgenericengine.h
+++ b/src/plugins/bearer/generic/qgenericengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/icd/dbusdispatcher.cpp b/src/plugins/bearer/icd/dbusdispatcher.cpp
deleted file mode 100644
index 60e4640f22..0000000000
--- a/src/plugins/bearer/icd/dbusdispatcher.cpp
+++ /dev/null
@@ -1,634 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QDebug>
-#include <QtCore>
-#include <poll.h>
-#include <dbus/dbus.h>
-#include <dbus/dbus-glib-lowlevel.h>
-#include <glib.h>
-#include "dbusdispatcher.h"
-
-namespace Maemo {
-
-/*!
- \class Maemo::DBusDispatcher
-
- \brief DBusDispatcher is a class that can send DBUS method call
- messages and receive unicast signals from DBUS objects.
-*/
-
-class DBusDispatcherPrivate
-{
-public:
- DBusDispatcherPrivate(const QString& service,
- const QString& path,
- const QString& interface,
- const QString& signalPath)
- : service(service), path(path), interface(interface),
- signalPath(signalPath), connection(0)
- {
- memset(&signal_vtable, 0, sizeof(signal_vtable));
- }
-
- ~DBusDispatcherPrivate()
- {
- foreach(DBusPendingCall *call, pending_calls) {
- dbus_pending_call_cancel(call);
- dbus_pending_call_unref(call);
- }
- }
-
- QString service;
- QString path;
- QString interface;
- QString signalPath;
- struct DBusConnection *connection;
- QList<DBusPendingCall *> pending_calls;
- struct DBusObjectPathVTable signal_vtable;
-};
-
-static bool constantVariantList(const QVariantList& variantList) {
- // Special case, empty list == empty struct
- if (variantList.isEmpty()) {
- return false;
- } else {
- QVariant::Type type = variantList[0].type();
- // Iterate items in the list and check if they are same type
- foreach(QVariant variant, variantList) {
- if (variant.type() != type) {
- return false;
- }
- }
- }
- return true;
-}
-
-static QString variantToSignature(const QVariant& argument,
- bool constantList = true) {
- switch (argument.type()) {
- case QVariant::Bool:
- return "b";
- case QVariant::ByteArray:
- return "ay";
- case QVariant::Char:
- return "y";
- case QVariant::Int:
- return "i";
- case QVariant::UInt:
- return "u";
- case QVariant::StringList:
- return "as";
- case QVariant::String:
- return "s";
- case QVariant::LongLong:
- return "x";
- case QVariant::ULongLong:
- return "t";
- case QVariant::List:
- {
- QString signature;
- QVariantList variantList = argument.toList();
- if (!constantList) {
- signature += DBUS_STRUCT_BEGIN_CHAR_AS_STRING;
- foreach(QVariant listItem, variantList) {
- signature += variantToSignature(listItem);
- }
- signature += DBUS_STRUCT_END_CHAR_AS_STRING;
- } else {
- if (variantList.isEmpty())
- return "";
- signature = "a" + variantToSignature(variantList[0]);
- }
-
- return signature;
- }
- default:
- qDebug() << "Unsupported variant type: " << argument.type();
- break;
- }
-
- return "";
-}
-
-static bool appendVariantToDBusMessage(const QVariant& argument,
- DBusMessageIter *dbus_iter) {
- int idx = 0;
- DBusMessageIter array_iter;
- QStringList str_list;
- dbus_bool_t bool_data;
- dbus_int32_t int32_data;
- dbus_uint32_t uint32_data;
- dbus_int64_t int64_data;
- dbus_uint64_t uint64_data;
- char *str_data;
- char char_data;
-
- switch (argument.type()) {
-
- case QVariant::Bool:
- bool_data = argument.toBool();
- dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_BOOLEAN,
- &bool_data);
- break;
-
- case QVariant::ByteArray:
- str_data = argument.toByteArray().data();
- dbus_message_iter_open_container(dbus_iter, DBUS_TYPE_ARRAY,
- DBUS_TYPE_BYTE_AS_STRING, &array_iter);
- dbus_message_iter_append_fixed_array(&array_iter,
- DBUS_TYPE_BYTE,
- &str_data,
- argument.toByteArray().size());
- dbus_message_iter_close_container(dbus_iter, &array_iter);
- break;
-
- case QVariant::Char:
- char_data = argument.toChar().toAscii();
- dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_BYTE,
- &char_data);
- break;
-
- case QVariant::Int:
- int32_data = argument.toInt();
- dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_INT32,
- &int32_data);
- break;
-
- case QVariant::String: {
- QByteArray data = argument.toString().toLatin1();
- str_data = data.data();
- dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_STRING,
- &str_data);
- break;
- }
-
- case QVariant::StringList:
- str_list = argument.toStringList();
- dbus_message_iter_open_container(dbus_iter, DBUS_TYPE_ARRAY,
- "s", &array_iter);
- for (idx = 0; idx < str_list.size(); idx++) {
- QByteArray data = str_list.at(idx).toLatin1();
- str_data = data.data();
- dbus_message_iter_append_basic(&array_iter,
- DBUS_TYPE_STRING,
- &str_data);
- }
- dbus_message_iter_close_container(dbus_iter, &array_iter);
- break;
-
- case QVariant::UInt:
- uint32_data = argument.toUInt();
- dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_UINT32,
- &uint32_data);
- break;
-
- case QVariant::ULongLong:
- uint64_data = argument.toULongLong();
- dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_UINT64,
- &uint64_data);
- break;
-
- case QVariant::LongLong:
- int64_data = argument.toLongLong();
- dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_INT64,
- &int64_data);
- break;
-
- case QVariant::List:
- {
- QVariantList variantList = argument.toList();
- bool constantList = constantVariantList(variantList);
- DBusMessageIter array_iter;
-
- // List is mapped either as an DBUS array (all items same type)
- // DBUS struct (variable types) depending on constantList
- if (constantList) {
- // Resolve the signature for the first item
- QString signature = "";
- if (!variantList.isEmpty()) {
- signature = variantToSignature(
- variantList[0],
- constantVariantList(variantList[0].toList()));
- }
-
- // Mapped as DBUS array
- dbus_message_iter_open_container(dbus_iter, DBUS_TYPE_ARRAY,
- signature.toAscii(),
- &array_iter);
-
- foreach(QVariant listItem, variantList) {
- appendVariantToDBusMessage(listItem, &array_iter);
- }
-
- dbus_message_iter_close_container(dbus_iter, &array_iter);
- } else {
- // Mapped as DBUS struct
- dbus_message_iter_open_container(dbus_iter, DBUS_TYPE_STRUCT,
- NULL,
- &array_iter);
-
- foreach(QVariant listItem, variantList) {
- appendVariantToDBusMessage(listItem, &array_iter);
- }
-
- dbus_message_iter_close_container(dbus_iter, &array_iter);
- }
-
- break;
- }
- default:
- qDebug() << "Unsupported variant type: " << argument.type();
- break;
- }
-
- return true;
-}
-
-static QVariant getVariantFromDBusMessage(DBusMessageIter *iter) {
- dbus_bool_t bool_data;
- dbus_int32_t int32_data;
- dbus_uint32_t uint32_data;
- dbus_int64_t int64_data;
- dbus_uint64_t uint64_data;
- char *str_data;
- char char_data;
- int argtype = dbus_message_iter_get_arg_type(iter);
-
- switch (argtype) {
-
- case DBUS_TYPE_BOOLEAN:
- {
- dbus_message_iter_get_basic(iter, &bool_data);
- QVariant variant((bool)bool_data);
- return variant;
- }
-
- case DBUS_TYPE_ARRAY:
- {
- // Handle all arrays here
- int elem_type = dbus_message_iter_get_element_type(iter);
- DBusMessageIter array_iter;
-
- dbus_message_iter_recurse(iter, &array_iter);
-
- if (elem_type == DBUS_TYPE_BYTE) {
- QByteArray byte_array;
- do {
- dbus_message_iter_get_basic(&array_iter, &char_data);
- byte_array.append(char_data);
- } while (dbus_message_iter_next(&array_iter));
- QVariant variant(byte_array);
- return variant;
- } else if (elem_type == DBUS_TYPE_STRING) {
- QStringList str_list;
- do {
- dbus_message_iter_get_basic(&array_iter, &str_data);
- str_list.append(str_data);
- } while (dbus_message_iter_next(&array_iter));
- QVariant variant(str_list);
- return variant;
- } else {
- QVariantList variantList;
- do {
- variantList << getVariantFromDBusMessage(&array_iter);
- } while (dbus_message_iter_next(&array_iter));
- QVariant variant(variantList);
- return variant;
- }
- break;
- }
-
- case DBUS_TYPE_BYTE:
- {
- dbus_message_iter_get_basic(iter, &char_data);
- QChar ch(char_data);
- QVariant variant(ch);
- return variant;
- }
-
- case DBUS_TYPE_INT32:
- {
- dbus_message_iter_get_basic(iter, &int32_data);
- QVariant variant((int)int32_data);
- return variant;
- }
-
- case DBUS_TYPE_UINT32:
- {
- dbus_message_iter_get_basic(iter, &uint32_data);
- QVariant variant((uint)uint32_data);
- return variant;
- }
-
- case DBUS_TYPE_STRING:
- {
- dbus_message_iter_get_basic(iter, &str_data);
- QString str(str_data);
- QVariant variant(str);
- return variant;
- }
-
- case DBUS_TYPE_INT64:
- {
- dbus_message_iter_get_basic(iter, &int64_data);
- QVariant variant((qlonglong)int64_data);
- return variant;
- }
-
- case DBUS_TYPE_UINT64:
- {
- dbus_message_iter_get_basic(iter, &uint64_data);
- QVariant variant((qulonglong)uint64_data);
- return variant;
- }
-
- case DBUS_TYPE_STRUCT:
- {
- // Handle all structs here
- DBusMessageIter struct_iter;
- dbus_message_iter_recurse(iter, &struct_iter);
-
- QVariantList variantList;
- do {
- variantList << getVariantFromDBusMessage(&struct_iter);
- } while (dbus_message_iter_next(&struct_iter));
- QVariant variant(variantList);
- return variant;
- }
-
- default:
- qDebug() << "Unsupported DBUS type: " << argtype;
- }
-
- return QVariant();
-}
-
-static DBusHandlerResult signalHandler (DBusConnection *connection,
- DBusMessage *message,
- void *object_ref) {
- (void)connection;
- QString interface;
- QString signal;
- DBusDispatcher *dispatcher = (DBusDispatcher *)object_ref;
-
- if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_SIGNAL) {
- interface = dbus_message_get_interface(message);
- signal = dbus_message_get_member(message);
-
- QList<QVariant> arglist;
- DBusMessageIter dbus_iter;
-
- if (dbus_message_iter_init(message, &dbus_iter)) {
- // Read return arguments
- while (dbus_message_iter_get_arg_type (&dbus_iter) != DBUS_TYPE_INVALID) {
- arglist << getVariantFromDBusMessage(&dbus_iter);
- dbus_message_iter_next(&dbus_iter);
- }
- }
-
- dispatcher->emitSignalReceived(interface, signal, arglist);
- return DBUS_HANDLER_RESULT_HANDLED;
- }
- (void)message;
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-DBusDispatcher::DBusDispatcher(const QString& service,
- const QString& path,
- const QString& interface,
- QObject *parent)
- : QObject(parent),
- d_ptr(new DBusDispatcherPrivate(service, path, interface, path)) {
- setupDBus();
-}
-
-DBusDispatcher::DBusDispatcher(const QString& service,
- const QString& path,
- const QString& interface,
- const QString& signalPath,
- QObject *parent)
- : QObject(parent),
- d_ptr(new DBusDispatcherPrivate(service, path, interface, signalPath)) {
- setupDBus();
-}
-
-DBusDispatcher::~DBusDispatcher()
-{
- if (d_ptr->connection) {
- dbus_connection_close(d_ptr->connection);
- dbus_connection_unref(d_ptr->connection);
- }
- delete d_ptr;
-}
-
-void DBusDispatcher::setupDBus()
-{
- d_ptr->connection = dbus_bus_get_private(DBUS_BUS_SYSTEM, NULL);
-
- if (d_ptr->connection == NULL)
- qDebug() << "Unable to get DBUS connection!";
- else {
- d_ptr->signal_vtable.message_function = signalHandler;
-
- dbus_connection_set_exit_on_disconnect(d_ptr->connection, FALSE);
- dbus_connection_setup_with_g_main(d_ptr->connection, g_main_context_get_thread_default());
- dbus_connection_register_object_path(d_ptr->connection,
- d_ptr->signalPath.toLatin1(),
- &d_ptr->signal_vtable,
- this);
- }
-}
-
-static DBusMessage *prepareDBusCall(const QString& service,
- const QString& path,
- const QString& interface,
- const QString& method,
- const QVariant& arg1 = QVariant(),
- const QVariant& arg2 = QVariant(),
- const QVariant& arg3 = QVariant(),
- const QVariant& arg4 = QVariant(),
- const QVariant& arg5 = QVariant(),
- const QVariant& arg6 = QVariant(),
- const QVariant& arg7 = QVariant(),
- const QVariant& arg8 = QVariant())
-{
- DBusMessage *message = dbus_message_new_method_call(service.toLatin1(),
- path.toLatin1(),
- interface.toLatin1(),
- method.toLatin1());
- DBusMessageIter dbus_iter;
-
- // Append variants to DBUS message
- QList<QVariant> arglist;
- if (arg1.isValid()) arglist << arg1;
- if (arg2.isValid()) arglist << arg2;
- if (arg3.isValid()) arglist << arg3;
- if (arg4.isValid()) arglist << arg4;
- if (arg5.isValid()) arglist << arg5;
- if (arg6.isValid()) arglist << arg6;
- if (arg7.isValid()) arglist << arg7;
- if (arg8.isValid()) arglist << arg8;
-
- dbus_message_iter_init_append (message, &dbus_iter);
-
- while (!arglist.isEmpty()) {
- QVariant argument = arglist.takeFirst();
- appendVariantToDBusMessage(argument, &dbus_iter);
- }
-
- return message;
-}
-
-QList<QVariant> DBusDispatcher::call(const QString& method,
- const QVariant& arg1,
- const QVariant& arg2,
- const QVariant& arg3,
- const QVariant& arg4,
- const QVariant& arg5,
- const QVariant& arg6,
- const QVariant& arg7,
- const QVariant& arg8) {
- DBusMessageIter dbus_iter;
- DBusMessage *message = prepareDBusCall(d_ptr->service, d_ptr->path,
- d_ptr->interface, method,
- arg1, arg2, arg3, arg4, arg5,
- arg6, arg7, arg8);
- DBusMessage *reply = dbus_connection_send_with_reply_and_block(
- d_ptr->connection,
- message, -1, NULL);
- dbus_message_unref(message);
-
- QList<QVariant> replylist;
- if (reply != NULL && dbus_message_iter_init(reply, &dbus_iter)) {
- // Read return arguments
- while (dbus_message_iter_get_arg_type (&dbus_iter) != DBUS_TYPE_INVALID) {
- replylist << getVariantFromDBusMessage(&dbus_iter);
- dbus_message_iter_next(&dbus_iter);
- }
- }
- if (reply != NULL) dbus_message_unref(reply);
- return replylist;
-}
-
-class PendingCallInfo {
-public:
- QString method;
- DBusDispatcher *dispatcher;
- DBusDispatcherPrivate *priv;
-};
-
-static void freePendingCallInfo(void *memory) {
- PendingCallInfo *info = (PendingCallInfo *)memory;
- delete info;
-}
-
-static void pendingCallFunction (DBusPendingCall *pending,
- void *memory) {
- PendingCallInfo *info = (PendingCallInfo *)memory;
- QString errorStr;
- QList<QVariant> replyList;
- DBusMessage *reply = dbus_pending_call_steal_reply (pending);
-
- Q_ASSERT(reply != NULL);
-
- if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) {
- errorStr = dbus_message_get_error_name (reply);
- } else {
- DBusMessageIter dbus_iter;
- dbus_message_iter_init(reply, &dbus_iter);
- // Read return arguments
- while (dbus_message_iter_get_arg_type (&dbus_iter) != DBUS_TYPE_INVALID) {
- replyList << getVariantFromDBusMessage(&dbus_iter);
- dbus_message_iter_next(&dbus_iter);
- }
- }
-
- info->priv->pending_calls.removeOne(pending);
- info->dispatcher->emitCallReply(info->method, replyList, errorStr);
- dbus_message_unref(reply);
- dbus_pending_call_unref(pending);
-}
-
-bool DBusDispatcher::callAsynchronous(const QString& method,
- const QVariant& arg1,
- const QVariant& arg2,
- const QVariant& arg3,
- const QVariant& arg4,
- const QVariant& arg5,
- const QVariant& arg6,
- const QVariant& arg7,
- const QVariant& arg8) {
- DBusMessage *message = prepareDBusCall(d_ptr->service, d_ptr->path,
- d_ptr->interface, method,
- arg1, arg2, arg3, arg4, arg5,
- arg6, arg7, arg8);
- DBusPendingCall *call = NULL;
- dbus_bool_t ret = dbus_connection_send_with_reply(d_ptr->connection,
- message, &call, -1);
- PendingCallInfo *info = new PendingCallInfo;
- info->method = method;
- info->dispatcher = this;
- info->priv = d_ptr;
-
- dbus_pending_call_set_notify(call, pendingCallFunction, info, freePendingCallInfo);
- d_ptr->pending_calls.append(call);
- return (bool)ret;
-}
-
-void DBusDispatcher::emitSignalReceived(const QString& interface,
- const QString& signal,
- const QList<QVariant>& args) {
- emit signalReceived(interface, signal, args); }
-
-void DBusDispatcher::emitCallReply(const QString& method,
- const QList<QVariant>& args,
- const QString& error) {
- emit callReply(method, args, error); }
-
-void DBusDispatcher::synchronousDispatch(int timeout_ms)
-{
- dbus_connection_read_write_dispatch(d_ptr->connection, timeout_ms);
-}
-
-} // Maemo namespace
-
diff --git a/src/plugins/bearer/icd/dbusdispatcher.h b/src/plugins/bearer/icd/dbusdispatcher.h
deleted file mode 100644
index bba63662fe..0000000000
--- a/src/plugins/bearer/icd/dbusdispatcher.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef DBUSDISPATCHER_H
-#define DBUSDISPATCHER_H
-
-#include <QObject>
-#include <QVariant>
-
-namespace Maemo {
-
-class DBusDispatcherPrivate;
-class DBusDispatcher : public QObject
-{
- Q_OBJECT
-
-public:
- DBusDispatcher(const QString& service,
- const QString& path,
- const QString& interface,
- QObject *parent = 0);
- DBusDispatcher(const QString& service,
- const QString& path,
- const QString& interface,
- const QString& signalPath,
- QObject *parent = 0);
- ~DBusDispatcher();
-
- QList<QVariant> call(const QString& method,
- const QVariant& arg1 = QVariant(),
- const QVariant& arg2 = QVariant(),
- const QVariant& arg3 = QVariant(),
- const QVariant& arg4 = QVariant(),
- const QVariant& arg5 = QVariant(),
- const QVariant& arg6 = QVariant(),
- const QVariant& arg7 = QVariant(),
- const QVariant& arg8 = QVariant());
- bool callAsynchronous(const QString& method,
- const QVariant& arg1 = QVariant(),
- const QVariant& arg2 = QVariant(),
- const QVariant& arg3 = QVariant(),
- const QVariant& arg4 = QVariant(),
- const QVariant& arg5 = QVariant(),
- const QVariant& arg6 = QVariant(),
- const QVariant& arg7 = QVariant(),
- const QVariant& arg8 = QVariant());
- void emitSignalReceived(const QString& interface,
- const QString& signal,
- const QList<QVariant>& args);
- void emitCallReply(const QString& method,
- const QList<QVariant>& args,
- const QString& error = "");
- void synchronousDispatch(int timeout_ms);
-
-Q_SIGNALS:
- void signalReceived(const QString& interface,
- const QString& signal,
- const QList<QVariant>& args);
- void callReply(const QString& method,
- const QList<QVariant>& args,
- const QString& error);
-
-protected:
- void setupDBus();
-
-private:
- DBusDispatcherPrivate *d_ptr;
-};
-
-} // Maemo namespace
-
-#endif
diff --git a/src/plugins/bearer/icd/iapconf.cpp b/src/plugins/bearer/icd/iapconf.cpp
deleted file mode 100644
index a29e326a22..0000000000
--- a/src/plugins/bearer/icd/iapconf.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <stdlib.h>
-#include <string.h>
-#include <conn_settings.h>
-
-#include "iapconf.h"
-
-#define QSTRING_TO_CONST_CSTR(str) \
- str.toUtf8().constData()
-
-namespace Maemo {
-
-class IAPConfPrivate {
-public:
- ConnSettings *settings;
-
- ConnSettingsValue *variantToValue(const QVariant &variant);
- QVariant valueToVariant(ConnSettingsValue *value);
-};
-
-ConnSettingsValue *IAPConfPrivate::variantToValue(const QVariant &variant)
-{
- // Convert variant to ConnSettingsValue
- ConnSettingsValue *value = conn_settings_value_new();
- if (value == 0) {
- qWarning("IAPConf: Unable to create new ConnSettingsValue");
- return 0;
- }
-
- switch(variant.type()) {
-
- case QVariant::Invalid:
- value->type = CONN_SETTINGS_VALUE_INVALID;
- break;
-
- case QVariant::String: {
- char *valueStr = strdup(QSTRING_TO_CONST_CSTR(variant.toString()));
- value->type = CONN_SETTINGS_VALUE_STRING;
- value->value.string_val = valueStr;
- break;
- }
-
- case QVariant::Int:
- value->type = CONN_SETTINGS_VALUE_INT;
- value->value.int_val = variant.toInt();
- break;
-
- case QMetaType::Float:
- case QVariant::Double:
- value->type = CONN_SETTINGS_VALUE_DOUBLE;
- value->value.double_val = variant.toDouble();
- break;
-
- case QVariant::Bool:
- value->type = CONN_SETTINGS_VALUE_BOOL;
- value->value.bool_val = variant.toBool() ? 1 : 0;
- break;
-
- case QVariant::ByteArray: {
- QByteArray array = variant.toByteArray();
- value->type = CONN_SETTINGS_VALUE_BYTE_ARRAY;
- value->value.byte_array.len = array.size();
- value->value.byte_array.val = (unsigned char *)malloc(array.size());
- memcpy(value->value.byte_array.val, array.constData(), array.size());
- break;
- }
-
- case QVariant::List: {
- QVariantList list = variant.toList();
- ConnSettingsValue **list_val = (ConnSettingsValue **)malloc(
- (list.size() + 1) * sizeof(ConnSettingsValue *));
-
- for (int idx = 0; idx < list.size(); idx++) {
- list_val[idx] = variantToValue(list.at(idx));
- }
- list_val[list.size()] = 0;
-
- value->type = CONN_SETTINGS_VALUE_LIST;
- value->value.list_val = list_val;
- break;
- }
-
- default:
- qWarning("IAPConf: Can not handle QVariant of type %d",
- variant.type());
- conn_settings_value_destroy(value);
- return 0;
- }
-
- return value;
-}
-
-QVariant IAPConfPrivate::valueToVariant(ConnSettingsValue *value)
-{
- if (value == 0 || value->type == CONN_SETTINGS_VALUE_INVALID) {
- return QVariant();
- }
-
- switch(value->type) {
-
- case CONN_SETTINGS_VALUE_BOOL:
- return QVariant(value->value.bool_val ? true : false);
-
- case CONN_SETTINGS_VALUE_STRING:
- return QVariant(QString(value->value.string_val));
-
- case CONN_SETTINGS_VALUE_DOUBLE:
- return QVariant(value->value.double_val);
-
- case CONN_SETTINGS_VALUE_INT:
- return QVariant(value->value.int_val);
-
- case CONN_SETTINGS_VALUE_LIST: {
- // At least with GConf backend connsettings returns byte array as list
- // of ints, first check for that case
- if (value->value.list_val && value->value.list_val[0]) {
- bool canBeConvertedToByteArray = true;
- for (int idx = 0; value->value.list_val[idx]; idx++) {
- ConnSettingsValue *val = value->value.list_val[idx];
- if (val->type != CONN_SETTINGS_VALUE_INT
- || val->value.int_val > 255
- || val->value.int_val < 0) {
- canBeConvertedToByteArray = false;
- break;
- }
- }
-
- if (canBeConvertedToByteArray) {
- QByteArray array;
- for (int idx = 0; value->value.list_val[idx]; idx++) {
- array.append(value->value.list_val[idx]->value.int_val);
- }
- return array;
- }
-
- // Create normal list
- QVariantList list;
- for (int idx = 0; value->value.list_val[idx]; idx++) {
- list.append(valueToVariant(value->value.list_val[idx]));
- }
- return list;
- }
- }
-
- case CONN_SETTINGS_VALUE_BYTE_ARRAY:
- return QByteArray::fromRawData((char *)value->value.byte_array.val,
- value->value.byte_array.len);
-
- default:
- return QVariant();
- }
-}
-
-// Public class implementation
-
-IAPConf::IAPConf(const QString &iap_id)
- : d_ptr(new IAPConfPrivate)
-{
- d_ptr->settings = conn_settings_open(CONN_SETTINGS_CONNECTION,
- QSTRING_TO_CONST_CSTR(iap_id));
- if (d_ptr->settings == 0) {
- qWarning("IAPConf: Unable to open ConnSettings for %s",
- QSTRING_TO_CONST_CSTR(iap_id));
- }
-}
-
-IAPConf::~IAPConf()
-{
- conn_settings_close(d_ptr->settings);
- delete d_ptr;
-}
-
-
-QVariant IAPConf::value(const QString& key) const
-{
- ConnSettingsValue *val = conn_settings_get(d_ptr->settings,
- QSTRING_TO_CONST_CSTR(key));
-
- QVariant variant = d_ptr->valueToVariant(val);
- conn_settings_value_destroy(val);
- return variant;
-}
-
-
-void IAPConf::getAll(QList<QString> &all_iaps, bool return_path)
-{
- Q_UNUSED(return_path); // We don't use return path currently
-
- // Go through all available connections and add them to the list
- char **ids = conn_settings_list_ids(CONN_SETTINGS_CONNECTION);
- if (ids == 0) {
- // No ids found - nothing to do
- return;
- }
-
- for (int idx = 0; ids[idx]; idx++) {
- all_iaps.append(QString(ids[idx]));
- free(ids[idx]);
- }
- free(ids);
-}
-
-
-} // namespace Maemo
diff --git a/src/plugins/bearer/icd/iapconf.h b/src/plugins/bearer/icd/iapconf.h
deleted file mode 100644
index f7b0ca316c..0000000000
--- a/src/plugins/bearer/icd/iapconf.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef IAPCONF_H
-#define IAPCONF_H
-
-#include <QString>
-#include <QVariant>
-
-namespace Maemo {
-
-class IAPConfPrivate;
-class IAPConf {
-public:
- IAPConf(const QString &iap_id);
- virtual ~IAPConf();
-
- /**
- Get one IAP value.
- */
- QVariant value(const QString& key) const;
-
- /**
- Return all the IAPs found in the system. If return_path is true,
- then do not strip the IAP path away.
- */
- static void getAll(QList<QString> &all_iaps, bool return_path=false);
-
-private:
- IAPConfPrivate *d_ptr;
-};
-
-} // namespace Maemo
-
-#endif
diff --git a/src/plugins/bearer/icd/iapmonitor.cpp b/src/plugins/bearer/icd/iapmonitor.cpp
deleted file mode 100644
index ba20778861..0000000000
--- a/src/plugins/bearer/icd/iapmonitor.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QStringList>
-
-#include <conn_settings.h>
-#include "iapmonitor.h"
-
-namespace Maemo {
-
-
-void conn_settings_notify_func (ConnSettingsType type,
- const char *id,
- const char *key,
- ConnSettingsValue *value,
- void *user_data);
-
-class IAPMonitorPrivate {
-private:
- IAPMonitor *monitor;
- ConnSettings *settings;
-
-public:
-
- IAPMonitorPrivate(IAPMonitor *monitor)
- : monitor(monitor)
- {
- settings = conn_settings_open(CONN_SETTINGS_CONNECTION, NULL);
- conn_settings_add_notify(
- settings,
- (ConnSettingsNotifyFunc *)conn_settings_notify_func,
- this);
- }
-
- ~IAPMonitorPrivate()
- {
- conn_settings_del_notify(settings);
- conn_settings_close(settings);
- }
-
- void iapAdded(const QString &iap)
- {
- monitor->iapAdded(iap);
- }
-
- void iapRemoved(const QString &iap)
- {
- monitor->iapRemoved(iap);
- }
-};
-
-void conn_settings_notify_func (ConnSettingsType type,
- const char *id,
- const char *key,
- ConnSettingsValue *value,
- void *user_data)
-{
- Q_UNUSED(id);
-
- if (type != CONN_SETTINGS_CONNECTION) return;
- IAPMonitorPrivate *priv = (IAPMonitorPrivate *)user_data;
-
- QString iapId(key);
- iapId = iapId.split("/")[0];
- if (value != 0) {
- priv->iapAdded(iapId);
- } else if (iapId == QString(key)) {
- // IAP is removed only when the directory gets removed
- priv->iapRemoved(iapId);
- }
-}
-
-IAPMonitor::IAPMonitor()
- : d_ptr(new IAPMonitorPrivate(this))
-{
-}
-
-IAPMonitor::~IAPMonitor()
-{
- delete d_ptr;
-}
-
-void IAPMonitor::iapAdded(const QString &id)
-{
- Q_UNUSED(id);
- // By default do nothing
-}
-
-void IAPMonitor::iapRemoved(const QString &id)
-{
- Q_UNUSED(id);
- // By default do nothing
-}
-
-} // namespace Maemo
diff --git a/src/plugins/bearer/icd/icd.pro b/src/plugins/bearer/icd/icd.pro
deleted file mode 100644
index 8cbf86d548..0000000000
--- a/src/plugins/bearer/icd/icd.pro
+++ /dev/null
@@ -1,33 +0,0 @@
-TARGET = qicdbearer
-load(qt_plugin)
-
-QT = core network network-private dbus
-
-QMAKE_CXXFLAGS *= $$QT_CFLAGS_DBUS $$QT_CFLAGS_CONNSETTINGS
-LIBS += $$QT_LIBS_CONNSETTINGS
-
-HEADERS += qicdengine.h \
- qnetworksession_impl.h \
- dbusdispatcher.h \
- iapconf.h \
- iapmonitor.h \
- maemo_icd.h \
- proxyconf.h \
- wlan-utils.h
-
-SOURCES += main.cpp \
- qicdengine.cpp \
- qnetworksession_impl.cpp \
- dbusdispatcher.cpp \
- iapmonitor.cpp \
- iapconf.cpp \
- maemo_icd.cpp \
- proxyconf.cpp
-
-#DEFINES += BEARER_MANAGEMENT_DEBUG
-
-include(../../../3rdparty/libgq.pri)
-
-DESTDIR = $$QT.network.plugins/bearer
-target.path += $$[QT_INSTALL_PLUGINS]/bearer
-INSTALLS += target
diff --git a/src/plugins/bearer/icd/maemo_icd.cpp b/src/plugins/bearer/icd/maemo_icd.cpp
deleted file mode 100644
index 2ab416ac5a..0000000000
--- a/src/plugins/bearer/icd/maemo_icd.cpp
+++ /dev/null
@@ -1,855 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include "maemo_icd.h"
-#include "dbusdispatcher.h"
-
-#include <QObject>
-#include <QTimer>
-#include <QCoreApplication>
-#include <QEventLoop>
-#include <QDebug>
-#include <dbus/dbus.h>
-#include <dbus/dbus-glib-lowlevel.h>
-
-#include <stdio.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-namespace Maemo {
-
-#undef PRINT_DEBUGINFO
-#ifdef PRINT_DEBUGINFO
- static FILE *fdebug = NULL;
-#define PDEBUG(fmt, args...) \
- do { \
- struct timeval tv; \
- gettimeofday(&tv, 0); \
- fprintf(fdebug, "DEBUG[%d]:%ld.%ld:%s:%s():%d: " fmt, \
- getpid(), \
- tv.tv_sec, tv.tv_usec, \
- __FILE__, __FUNCTION__, __LINE__, args); \
- fflush(fdebug); \
- } while(0)
-#else
-#define PDEBUG(fmt...)
-#endif
-
-
-class IcdPrivate
-{
-public:
- IcdPrivate(Icd *myfriend)
- {
- init(10000, IcdNewDbusInterface, myfriend);
- }
-
- IcdPrivate(unsigned int timeout, Icd *myfriend)
- {
- init(timeout, IcdNewDbusInterface, myfriend);
- }
-
- IcdPrivate(unsigned int timeout, IcdDbusInterfaceVer ver, Icd *myfriend)
- {
- Q_UNUSED(ver);
-
- /* Note that the old Icd interface is currently disabled and
- * the new one is always used.
- */
- init(timeout, IcdNewDbusInterface, myfriend);
- }
-
- ~IcdPrivate()
- {
- QObject::disconnect(mDBus,
- SIGNAL(signalReceived(const QString&,
- const QString&,
- const QList<QVariant>&)),
- icd,
- SLOT(icdSignalReceived(const QString&,
- const QString&,
- const QList<QVariant>&)));
-
- QObject::disconnect(mDBus,
- SIGNAL(callReply(const QString&,
- const QList<QVariant>&,
- const QString&)),
- icd,
- SLOT(icdCallReply(const QString&,
- const QList<QVariant>&,
- const QString&)));
-
- delete mDBus;
- mDBus = 0;
- }
-
- /* Icd2 dbus API functions */
- QStringList scan(icd_scan_request_flags flags,
- QStringList &network_types,
- QList<IcdScanResult>& scan_results,
- QString& error);
-
- uint state(QString& service_type, uint service_attrs,
- QString& service_id, QString& network_type,
- uint network_attrs, QByteArray& network_id,
- IcdStateResult &state_result);
-
- uint addrinfo(QString& service_type, uint service_attrs,
- QString& service_id, QString& network_type,
- uint network_attrs, QByteArray& network_id,
- IcdAddressInfoResult& addr_result);
-
- uint state(QList<IcdStateResult>& state_results);
- uint statistics(QList<IcdStatisticsResult>& stats_results);
- uint addrinfo(QList<IcdAddressInfoResult>& addr_results);
-
- void signalReceived(const QString& interface,
- const QString& signal,
- const QList<QVariant>& args);
- void callReply(const QString& method,
- const QList<QVariant>& args,
- const QString& error);
-
-public:
- DBusDispatcher *mDBus;
- QString mMethod;
- QString mInterface;
- QString mSignal;
- QString mError;
- QList<QVariant> mArgs;
- QList<QVariant> receivedSignals;
- unsigned int timeout;
- IcdDbusInterfaceVer icd_dbus_version;
- Icd *icd;
-
- void init(unsigned int dbus_timeout, IcdDbusInterfaceVer ver,
- Icd *myfriend)
- {
- if (ver == IcdNewDbusInterface) {
- mDBus = new DBusDispatcher(ICD_DBUS_API_INTERFACE,
- ICD_DBUS_API_PATH,
- ICD_DBUS_API_INTERFACE);
- } else {
- mDBus = new DBusDispatcher(ICD_DBUS_SERVICE,
- ICD_DBUS_PATH,
- ICD_DBUS_INTERFACE);
- }
- icd_dbus_version = ver;
-
- /* This connect has a side effect as it means that only one
- * Icd object can exists in one time. This should be fixed!
- */
- QObject::connect(mDBus,
- SIGNAL(signalReceived(const QString&,
- const QString&,
- const QList<QVariant>&)),
- myfriend,
- SLOT(icdSignalReceived(const QString&,
- const QString&,
- const QList<QVariant>&)));
-
- QObject::connect(mDBus,
- SIGNAL(callReply(const QString&,
- const QList<QVariant>&,
- const QString&)),
- myfriend,
- SLOT(icdCallReply(const QString&,
- const QList<QVariant>&,
- const QString&)));
-
- icd = myfriend;
- timeout = dbus_timeout;
-
-#ifdef PRINT_DEBUGINFO
- if (!fdebug) {
- fdebug = fopen("/tmp/maemoicd.log", "a+");
- }
- PDEBUG("created %s\n", "IcdPrivate");
-#endif
- }
-
- void clearState()
- {
- mMethod.clear();
- mInterface.clear();
- mSignal.clear();
- mError.clear();
- mArgs.clear();
- receivedSignals.clear();
- }
-
- bool doState();
-};
-
-
-void IcdPrivate::signalReceived(const QString& interface,
- const QString& signal,
- const QList<QVariant>& args)
-{
- // Signal handler, which simply records what has been signalled
- mInterface = interface;
- mSignal = signal;
- mArgs = args;
-
- //qDebug() << "signal" << signal << "received:" << args;
- receivedSignals << QVariant(interface) << QVariant(signal) << QVariant(args);
-}
-
-
-void IcdPrivate::callReply(const QString& method,
- const QList<QVariant>& /*args*/,
- const QString& error)
-{
- mMethod = method;
- mError = error;
-}
-
-
-static void get_scan_result(QList<QVariant>& args,
- IcdScanResult& ret)
-{
- int i=0;
-
- if (args.isEmpty())
- return;
-
- ret.status = args[i++].toUInt();
- ret.timestamp = args[i++].toUInt();
- ret.scan.service_type = args[i++].toString();
- ret.service_name = args[i++].toString();
- ret.scan.service_attrs = args[i++].toUInt();
- ret.scan.service_id = args[i++].toString();
- ret.service_priority = args[i++].toInt();
- ret.scan.network_type = args[i++].toString();
- ret.network_name = args[i++].toString();
- ret.scan.network_attrs = args[i++].toUInt();
- ret.scan.network_id = args[i++].toByteArray();
- ret.network_priority = args[i++].toInt();
- ret.signal_strength = args[i++].toInt();
- ret.station_id = args[i++].toString();
- ret.signal_dB = args[i++].toInt();
-}
-
-
-QStringList IcdPrivate::scan(icd_scan_request_flags flags,
- QStringList &network_types,
- QList<IcdScanResult>& scan_results,
- QString& error)
-{
- Q_UNUSED(network_types);
-
- QStringList scanned_types;
- QTimer timer;
- QVariant reply;
- QVariantList vl;
- bool last_result = false;
- IcdScanResult result;
- int all_waited;
-
- clearState();
- reply = mDBus->call(ICD_DBUS_API_SCAN_REQ, (uint)flags);
- if (reply.type() != QVariant::List)
- return scanned_types;
- vl = reply.toList();
- if (vl.isEmpty()) {
- error = "Scan did not return anything.";
- return scanned_types;
- }
- reply = vl.first();
- scanned_types = reply.toStringList();
- //qDebug() << "Scanning:" << scanned_types;
- all_waited = scanned_types.size();
-
- timer.setSingleShot(true);
- timer.start(timeout);
-
- scan_results.clear();
- while (!last_result) {
- while (timer.isActive() && mInterface.isEmpty() && mError.isEmpty()) {
- QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
- }
-
- if (!timer.isActive()) {
- //qDebug() << "Timeout happened";
- break;
- }
-
- if (mSignal != ICD_DBUS_API_SCAN_SIG) {
- //qDebug() << "Received" << mSignal << "while waiting" << ICD_DBUS_API_SCAN_SIG << ", ignoring";
- mInterface.clear();
- continue;
- }
-
- if (mError.isEmpty()) {
- QString msgInterface = receivedSignals.takeFirst().toString();
- QString msgSignal = receivedSignals.takeFirst().toString();
- QList<QVariant> msgArgs = receivedSignals.takeFirst().toList();
- //qDebug() << "Signal" << msgSignal << "received.";
- //qDebug() << "Params:" << msgArgs;
-
- while (!msgSignal.isEmpty()) {
- get_scan_result(msgArgs, result);
-
-#if 0
- qDebug() << "Received: " <<
- "status =" << result.status <<
- ", timestamp =" << result.timestamp <<
- ", service_type =" << result.scan.service_type <<
- ", service_name =" << result.service_name <<
- ", service_attrs =" << result.scan.service_attrs <<
- ", service_id =" << result.scan.service_id <<
- ", service_priority =" << result.service_priority <<
- ", network_type =" << result.scan.network_type <<
- ", network_name =" << result.network_name <<
- ", network_attrs =" << result.scan.network_attrs <<
- ", network_id =" << "-" <<
- ", network_priority =" << result.network_priority <<
- ", signal_strength =" << result.signal_strength <<
- ", station_id =" << result.station_id <<
- ", signal_dB =" << result.signal_dB;
-#endif
-
- if (result.status == ICD_SCAN_COMPLETE) {
- //qDebug() << "waited =" << all_waited;
- if (--all_waited == 0) {
- last_result = true;
- break;
- }
- } else
- scan_results << result;
-
- if (receivedSignals.isEmpty())
- break;
-
- msgInterface = receivedSignals.takeFirst().toString();
- msgSignal = receivedSignals.takeFirst().toString();
- msgArgs = receivedSignals.takeFirst().toList();
- }
- mInterface.clear();
-
- } else {
- qWarning() << "Error while scanning:" << mError;
- break;
- }
- }
- timer.stop();
-
- error = mError;
- return scanned_types;
-}
-
-
-static void get_state_all_result(QList<QVariant>& args,
- IcdStateResult& ret)
-{
- int i=0;
-
- ret.params.service_type = args[i++].toString();
- ret.params.service_attrs = args[i++].toUInt();
- ret.params.service_id = args[i++].toString();
- ret.params.network_type = args[i++].toString();
- ret.params.network_attrs = args[i++].toUInt();
- ret.params.network_id = args[i++].toByteArray();
- ret.error = args[i++].toString();
- ret.state = args[i++].toInt();
-}
-
-
-static void get_state_all_result2(QList<QVariant>& args,
- IcdStateResult& ret)
-{
- int i=0;
-
- ret.params.network_type = args[i++].toString();
- ret.state = args[i++].toInt();
-
- // Initialize the other values so that the caller can
- // notice we only returned partial status
- ret.params.service_type = QString();
- ret.params.service_attrs = 0;
- ret.params.service_id = QString();
- ret.params.network_attrs = 0;
- ret.params.network_id = QByteArray();
- ret.error = QString();
-}
-
-
-uint IcdPrivate::state(QString& service_type, uint service_attrs,
- QString& service_id, QString& network_type,
- uint network_attrs, QByteArray& network_id,
- IcdStateResult& state_result)
-{
- QTimer timer;
- QVariant reply;
- uint total_signals;
- QVariantList vl;
-
- clearState();
-
- reply = mDBus->call(ICD_DBUS_API_STATE_REQ,
- service_type, service_attrs, service_id,
- network_type, network_attrs, network_id);
- if (reply.type() != QVariant::List)
- return 0;
- vl = reply.toList();
- if (vl.isEmpty())
- return 0;
- reply = vl.first();
- total_signals = reply.toUInt();
- if (!total_signals)
- return 0;
-
- timer.setSingleShot(true);
- timer.start(timeout);
-
- mInterface.clear();
- while (timer.isActive() && mInterface.isEmpty()) {
- QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
-
- if (mSignal != ICD_DBUS_API_STATE_SIG) {
- mInterface.clear();
- continue;
- }
- }
-
- timer.stop();
-
- if (mError.isEmpty()) {
- if (!mArgs.isEmpty()) {
- if (mArgs.size()>2)
- get_state_all_result(mArgs, state_result);
- else {
- // We are not connected as we did not get the status we asked
- return 0;
- }
- }
- } else {
- qWarning() << "Error:" << mError;
- }
-
- // The returned value should be one because we asked for one state
- return total_signals;
-}
-
-
-/* Special version of the state() call which does not call event loop.
- * Needed in order to fix NB#175098 where Qt4.7 webkit crashes because event
- * loop is run when webkit does not expect it. This function is called from
- * bearer management API syncStateWithInterface() in QNetworkSession
- * constructor.
- */
-uint IcdPrivate::state(QList<IcdStateResult>& state_results)
-{
- QVariant reply;
- QVariantList vl;
- uint signals_left, total_signals;
- IcdStateResult result;
- time_t started;
- int timeout_secs = timeout / 1000;
-
- PDEBUG("%s\n", "state_results");
-
- clearState();
- reply = mDBus->call(ICD_DBUS_API_STATE_REQ);
- if (reply.type() != QVariant::List)
- return 0;
- vl = reply.toList();
- if (vl.isEmpty())
- return 0;
- reply = vl.first();
- signals_left = total_signals = reply.toUInt();
- if (!signals_left)
- return 0;
-
- started = time(0);
- state_results.clear();
- mError.clear();
- while (signals_left) {
- mInterface.clear();
- while ((time(0)<=(started+timeout_secs)) && mInterface.isEmpty()) {
- mDBus->synchronousDispatch(1000);
- QCoreApplication::sendPostedEvents(icd, QEvent::MetaCall);
- }
-
- if (time(0)>(started+timeout_secs)) {
- total_signals = 0;
- break;
- }
-
- if (mSignal != ICD_DBUS_API_STATE_SIG) {
- continue;
- }
-
- if (mError.isEmpty()) {
- if (!mArgs.isEmpty()) {
- if (mArgs.size()==2)
- get_state_all_result2(mArgs, result);
- else
- get_state_all_result(mArgs, result);
- state_results << result;
- }
- signals_left--;
- } else {
- qWarning() << "Error:" << mError;
- break;
- }
- }
-
- PDEBUG("total_signals=%d\n", total_signals);
- return total_signals;
-}
-
-
-static void get_statistics_all_result(QList<QVariant>& args,
- IcdStatisticsResult& ret)
-{
- int i=0;
-
- if (args.isEmpty())
- return;
-
- ret.params.service_type = args[i++].toString();
- ret.params.service_attrs = args[i++].toUInt();
- ret.params.service_id = args[i++].toString();
- ret.params.network_type = args[i++].toString();
- ret.params.network_attrs = args[i++].toUInt();
- ret.params.network_id = args[i++].toByteArray();
- ret.time_active = args[i++].toUInt();
- ret.signal_strength = (enum icd_nw_levels)args[i++].toUInt();
- ret.bytes_sent = args[i++].toUInt();
- ret.bytes_received = args[i++].toUInt();
-}
-
-
-uint IcdPrivate::statistics(QList<IcdStatisticsResult>& stats_results)
-{
- QTimer timer;
- QVariant reply;
- QVariantList vl;
- uint signals_left, total_signals;
- IcdStatisticsResult result;
-
- clearState();
- reply = mDBus->call(ICD_DBUS_API_STATISTICS_REQ);
- if (reply.type() != QVariant::List)
- return 0;
- vl = reply.toList();
- if (vl.isEmpty())
- return 0;
- reply = vl.first();
- if (reply.type() != QVariant::UInt)
- return 0;
- signals_left = total_signals = reply.toUInt();
-
- if (!signals_left)
- return 0;
-
- timer.setSingleShot(true);
- timer.start(timeout);
- stats_results.clear();
- while (signals_left) {
- mInterface.clear();
- while (timer.isActive() && mInterface.isEmpty()) {
- QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
- }
-
- if (!timer.isActive()) {
- total_signals = 0;
- break;
- }
-
- if (mSignal != ICD_DBUS_API_STATISTICS_SIG) {
- continue;
- }
-
- if (mError.isEmpty()) {
- get_statistics_all_result(mArgs, result);
- stats_results << result;
- signals_left--;
- } else {
- qWarning() << "Error:" << mError;
- break;
- }
- }
- timer.stop();
-
- return total_signals;
-}
-
-
-static void get_addrinfo_all_result(QList<QVariant>& args,
- IcdAddressInfoResult& ret)
-{
- int i=0;
-
- if (args.isEmpty())
- return;
-
- ret.params.service_type = args[i++].toString();
- ret.params.service_attrs = args[i++].toUInt();
- ret.params.service_id = args[i++].toString();
- ret.params.network_type = args[i++].toString();
- ret.params.network_attrs = args[i++].toUInt();
- ret.params.network_id = args[i++].toByteArray();
-
- QVariantList vl = args[i].toList();
- QVariant reply = vl.first();
- QList<QVariant> lst = reply.toList();
- for (int k=0; k<lst.size()/6; k=k+6) {
- IcdIPInformation ip_info;
- ip_info.address = lst[k].toString();
- ip_info.netmask = lst[k++].toString();
- ip_info.default_gateway = lst[k++].toString();
- ip_info.dns1 = lst[k++].toString();
- ip_info.dns2 = lst[k++].toString();
- ip_info.dns3 = lst[k++].toString();
-
- ret.ip_info << ip_info;
- }
-}
-
-
-/* Special version of the addrinfo() call which does not call event loop.
- * Needed in order to fix NB#175098 where Qt4.7 webkit crashes because event
- * loop is run when webkit does not expect it. This function is called from
- * bearer management API syncStateWithInterface() in QNetworkSession
- * constructor.
- */
-uint IcdPrivate::addrinfo(QList<IcdAddressInfoResult>& addr_results)
-{
- QVariant reply;
- QVariantList vl;
- uint signals_left, total_signals;
- IcdAddressInfoResult result;
- time_t started;
- int timeout_secs = timeout / 1000;
-
- PDEBUG("%s\n", "addr_results");
-
- clearState();
- reply = mDBus->call(ICD_DBUS_API_ADDRINFO_REQ);
- if (reply.type() != QVariant::List)
- return 0;
- vl = reply.toList();
- if (vl.isEmpty())
- return 0;
- reply = vl.first();
- if (reply.type() != QVariant::UInt)
- return 0;
- signals_left = total_signals = reply.toUInt();
- if (!signals_left)
- return 0;
-
- started = time(0);
- addr_results.clear();
- while (signals_left) {
- mInterface.clear();
- while ((time(0)<=(started+timeout_secs)) && mInterface.isEmpty()) {
- mDBus->synchronousDispatch(1000);
- QCoreApplication::sendPostedEvents(icd, QEvent::MetaCall);
- }
-
- if (time(0)>(started+timeout_secs)) {
- total_signals = 0;
- break;
- }
-
- if (mSignal != ICD_DBUS_API_ADDRINFO_SIG) {
- continue;
- }
-
- if (mError.isEmpty()) {
- get_addrinfo_all_result(mArgs, result);
- addr_results << result;
- signals_left--;
- } else {
- qWarning() << "Error:" << mError;
- break;
- }
- }
-
- PDEBUG("total_signals=%d\n", total_signals);
- return total_signals;
-}
-
-
-uint IcdPrivate::addrinfo(QString& service_type, uint service_attrs,
- QString& service_id, QString& network_type,
- uint network_attrs, QByteArray& network_id,
- IcdAddressInfoResult& addr_result)
-{
- QTimer timer;
- QVariant reply;
- uint total_signals;
- QVariantList vl;
-
- clearState();
-
- reply = mDBus->call(ICD_DBUS_API_ADDRINFO_REQ,
- service_type, service_attrs, service_id,
- network_type, network_attrs, network_id);
- if (reply.type() != QVariant::List)
- return 0;
- vl = reply.toList();
- if (vl.isEmpty())
- return 0;
- reply = vl.first();
- total_signals = reply.toUInt();
-
- if (!total_signals)
- return 0;
-
- timer.setSingleShot(true);
- timer.start(timeout);
-
- mInterface.clear();
- while (timer.isActive() && mInterface.isEmpty()) {
- QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
-
- if (mSignal != ICD_DBUS_API_ADDRINFO_SIG) {
- mInterface.clear();
- continue;
- }
- }
-
- timer.stop();
-
- if (mError.isEmpty()) {
- get_addrinfo_all_result(mArgs, addr_result);
- } else {
- qWarning() << "Error:" << mError;
- }
-
- // The returned value should be one because we asked for one addrinfo
- return total_signals;
-}
-
-
-Icd::Icd(QObject *parent)
- : QObject(parent), d(new IcdPrivate(this))
-{
-}
-
-Icd::Icd(unsigned int timeout, QObject *parent)
- : QObject(parent), d(new IcdPrivate(timeout, this))
-{
-}
-
-Icd::Icd(unsigned int timeout, IcdDbusInterfaceVer ver, QObject *parent)
- : QObject(parent), d(new IcdPrivate(timeout, ver, this))
-{
-}
-
-Icd::~Icd()
-{
- delete d;
-}
-
-
-QStringList Icd::scan(icd_scan_request_flags flags,
- QStringList &network_types,
- QList<IcdScanResult>& scan_results,
- QString& error)
-{
- return d->scan(flags, network_types, scan_results, error);
-}
-
-
-uint Icd::state(QString& service_type, uint service_attrs,
- QString& service_id, QString& network_type,
- uint network_attrs, QByteArray& network_id,
- IcdStateResult &state_result)
-{
- return d->state(service_type, service_attrs, service_id,
- network_type, network_attrs, network_id,
- state_result);
-}
-
-
-uint Icd::addrinfo(QString& service_type, uint service_attrs,
- QString& service_id, QString& network_type,
- uint network_attrs, QByteArray& network_id,
- IcdAddressInfoResult& addr_result)
-{
- return d->addrinfo(service_type, service_attrs, service_id,
- network_type, network_attrs, network_id,
- addr_result);
-}
-
-
-uint Icd::state(QList<IcdStateResult>& state_results)
-{
- return d->state(state_results);
-}
-
-
-uint Icd::statistics(QList<IcdStatisticsResult>& stats_results)
-{
- return d->statistics(stats_results);
-}
-
-
-uint Icd::addrinfo(QList<IcdAddressInfoResult>& addr_results)
-{
- return d->addrinfo(addr_results);
-}
-
-
-void Icd::icdSignalReceived(const QString& interface,
- const QString& signal,
- const QList<QVariant>& args)
-{
- d->signalReceived(interface, signal, args);
-}
-
-
-void Icd::icdCallReply(const QString& method,
- const QList<QVariant>& args,
- const QString& error)
-{
- d->callReply(method, args, error);
-}
-
-} // Maemo namespace
-
-
diff --git a/src/plugins/bearer/icd/maemo_icd.h b/src/plugins/bearer/icd/maemo_icd.h
deleted file mode 100644
index 367a171189..0000000000
--- a/src/plugins/bearer/icd/maemo_icd.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef MAEMO_ICD_H
-#define MAEMO_ICD_H
-
-#include <QObject>
-#include <QStringList>
-#include <QByteArray>
-#include <QMetaType>
-#include <QtDBus>
-#include <QDBusArgument>
-
-#include <glib.h>
-#include <icd/dbus_api.h>
-#include <icd/osso-ic.h>
-#include <icd/osso-ic-dbus.h>
-#include <icd/network_api_defines.h>
-
-#define ICD_LONG_SCAN_TIMEOUT (30*1000) /* 30sec */
-#define ICD_SHORT_SCAN_TIMEOUT (10*1000) /* 10sec */
-#define ICD_SHORT_CONNECT_TIMEOUT (10*1000) /* 10sec */
-#define ICD_LONG_CONNECT_TIMEOUT (150*1000) /* 2.5min */
-
-namespace Maemo {
-
-struct CommonParams {
- QString service_type;
- uint service_attrs;
- QString service_id;
- QString network_type;
- uint network_attrs;
- QByteArray network_id;
-};
-
-struct IcdScanResult {
- uint status; // see #icd_scan_status
- uint timestamp; // when last seen
- QString service_name;
- uint service_priority; // within a service type
- QString network_name;
- uint network_priority;
- struct CommonParams scan;
- uint signal_strength; // quality, 0 (none) - 10 (good)
- QString station_id; // e.g. MAC address or similar id
- uint signal_dB; // use signal strength above unless you know what you are doing
-
- IcdScanResult() {
- status = timestamp = scan.service_attrs = service_priority =
- scan.network_attrs = network_priority = signal_strength =
- signal_dB = 0;
- }
-};
-
-struct IcdStateResult {
- struct CommonParams params;
- QString error;
- uint state;
-};
-
-struct IcdStatisticsResult {
- struct CommonParams params;
- uint time_active; // in seconds
- enum icd_nw_levels signal_strength; // see network_api_defines.h in icd2-dev package
- uint bytes_sent;
- uint bytes_received;
-};
-
-struct IcdIPInformation {
- QString address;
- QString netmask;
- QString default_gateway;
- QString dns1;
- QString dns2;
- QString dns3;
-};
-
-struct IcdAddressInfoResult {
- struct CommonParams params;
- QList<IcdIPInformation> ip_info;
-};
-
-enum IcdDbusInterfaceVer {
- IcdOldDbusInterface = 0, // use the old OSSO-IC interface
- IcdNewDbusInterface // use the new Icd2 interface (default)
-};
-
-
-class IcdPrivate;
-class Icd : public QObject
-{
- Q_OBJECT
-
-public:
- Icd(QObject *parent = 0);
- Icd(unsigned int timeout, QObject *parent = 0);
- Icd(unsigned int timeout, IcdDbusInterfaceVer ver, QObject *parent = 0);
- ~Icd();
-
- /* Icd2 dbus API functions */
- QStringList scan(icd_scan_request_flags flags,
- QStringList &network_types,
- QList<IcdScanResult>& scan_results,
- QString& error);
-
- uint state(QString& service_type, uint service_attrs,
- QString& service_id, QString& network_type,
- uint network_attrs, QByteArray& network_id,
- IcdStateResult &state_result);
-
- uint addrinfo(QString& service_type, uint service_attrs,
- QString& service_id, QString& network_type,
- uint network_attrs, QByteArray& network_id,
- IcdAddressInfoResult& addr_result);
-
- uint state(QList<IcdStateResult>& state_results);
- uint statistics(QList<IcdStatisticsResult>& stats_results);
- uint addrinfo(QList<IcdAddressInfoResult>& addr_results);
-
-private Q_SLOTS:
- void icdSignalReceived(const QString& interface,
- const QString& signal,
- const QList<QVariant>& args);
- void icdCallReply(const QString& method,
- const QList<QVariant>& args,
- const QString& error);
-
-private:
- IcdPrivate *d;
- friend class IcdPrivate;
-};
-
-} // Maemo namespace
-
-#endif
diff --git a/src/plugins/bearer/icd/proxyconf.cpp b/src/plugins/bearer/icd/proxyconf.cpp
deleted file mode 100644
index 904fabca94..0000000000
--- a/src/plugins/bearer/icd/proxyconf.cpp
+++ /dev/null
@@ -1,422 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QVariant>
-#include <QStringList>
-#include <QDebug>
-#include <QWriteLocker>
-#include <QNetworkProxyFactory>
-#include <QNetworkProxy>
-#include <gconf/gconf-value.h>
-#include <gconf/gconf-client.h>
-#include "proxyconf.h"
-
-#define CONF_PROXY "/system/proxy"
-#define HTTP_PROXY "/system/http_proxy"
-
-
-namespace Maemo {
-
-static QString convertKey(const char *key)
-{
- return QString::fromUtf8(key);
-}
-
-static QVariant convertValue(GConfValue *src)
-{
- if (!src) {
- return QVariant();
- } else {
- switch (src->type) {
- case GCONF_VALUE_INVALID:
- return QVariant(QVariant::Invalid);
- case GCONF_VALUE_BOOL:
- return QVariant((bool)gconf_value_get_bool(src));
- case GCONF_VALUE_INT:
- return QVariant(gconf_value_get_int(src));
- case GCONF_VALUE_FLOAT:
- return QVariant(gconf_value_get_float(src));
- case GCONF_VALUE_STRING:
- return QVariant(QString::fromUtf8(gconf_value_get_string(src)));
- case GCONF_VALUE_LIST:
- switch (gconf_value_get_list_type(src)) {
- case GCONF_VALUE_STRING:
- {
- QStringList result;
- for (GSList *elts = gconf_value_get_list(src); elts; elts = elts->next)
- result.append(QString::fromUtf8(gconf_value_get_string((GConfValue *)elts->data)));
- return QVariant(result);
- }
- default:
- {
- QList<QVariant> result;
- for (GSList *elts = gconf_value_get_list(src); elts; elts = elts->next)
- result.append(convertValue((GConfValue *)elts->data));
- return QVariant(result);
- }
- }
- case GCONF_VALUE_SCHEMA:
- default:
- return QVariant();
- }
- }
-}
-
-
-/* Fast version of GConfItem, allows reading subtree at a time */
-class GConfItemFast {
-public:
- GConfItemFast(const QString &k) : key(k) {}
- QHash<QString,QVariant> getEntries() const;
-
-private:
- QString key;
-};
-
-#define withClient(c) for (GConfClient *c = gconf_client_get_default(); c; c=0)
-
-
-QHash<QString,QVariant> GConfItemFast::getEntries() const
-{
- QHash<QString,QVariant> children;
-
- withClient(client) {
- QByteArray k = key.toUtf8();
- GSList *entries = gconf_client_all_entries(client, k.data(), NULL);
- for (GSList *e = entries; e; e = e->next) {
- char *key_name = strrchr(((GConfEntry *)e->data)->key, '/');
- if (!key_name)
- key_name = ((GConfEntry *)e->data)->key;
- else
- key_name++;
- QString key(convertKey(key_name));
- QVariant value = convertValue(((GConfEntry *)e->data)->value);
- gconf_entry_unref((GConfEntry *)e->data);
- //qDebug()<<"key="<<key<<"value="<<value;
- children.insert(key, value);
- }
- g_slist_free (entries);
- }
-
- return children;
-}
-
-
-
-class NetworkProxyFactory : QNetworkProxyFactory
-{
- ProxyConf proxy_conf;
- bool proxy_data_read;
-
-public:
- NetworkProxyFactory() : proxy_data_read(false) { }
- QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query = QNetworkProxyQuery());
-};
-
-
-QList<QNetworkProxy> NetworkProxyFactory::queryProxy(const QNetworkProxyQuery &query)
-{
- if (proxy_data_read == false) {
- proxy_data_read = true;
- proxy_conf.readProxyData();
- }
-
- QList<QNetworkProxy> result = proxy_conf.flush(query);
- if (result.isEmpty())
- result << QNetworkProxy::NoProxy;
-
- return result;
-}
-
-
-class ProxyConfPrivate {
-private:
- // proxy values from gconf
- QString mode;
- bool use_http_host;
- QString autoconfig_url;
- QString http_proxy;
- quint16 http_port;
- QList<QVariant> ignore_hosts;
- QString secure_host;
- quint16 secure_port;
- QString ftp_host;
- quint16 ftp_port;
- QString socks_host;
- quint16 socks_port;
- QString rtsp_host;
- quint16 rtsp_port;
-
- bool isHostExcluded(const QString &host);
-
-public:
- QString prefix;
- QString http_prefix;
-
- void readProxyData();
- QList<QNetworkProxy> flush(const QNetworkProxyQuery &query);
-};
-
-
-static QHash<QString,QVariant> getValues(const QString& prefix)
-{
- GConfItemFast item(prefix);
- return item.getEntries();
-}
-
-static QHash<QString,QVariant> getHttpValues(const QString& prefix)
-{
- GConfItemFast item(prefix);
- return item.getEntries();
-}
-
-#define GET(var, type) \
- do { \
- QVariant v = values.value(#var); \
- if (v.isValid()) \
- var = v.to##type (); \
- } while(0)
-
-#define GET_HTTP(var, name, type) \
- do { \
- QVariant v = httpValues.value(#name); \
- if (v.isValid()) \
- var = v.to##type (); \
- } while(0)
-
-
-void ProxyConfPrivate::readProxyData()
-{
- QHash<QString,QVariant> values = getValues(prefix);
- QHash<QString,QVariant> httpValues = getHttpValues(http_prefix);
-
- //qDebug()<<"values="<<values;
-
- /* Read the proxy settings from /system/proxy* */
- GET_HTTP(http_proxy, host, String);
- GET_HTTP(http_port, port, Int);
- GET_HTTP(ignore_hosts, ignore_hosts, List);
-
- GET(mode, String);
- GET(autoconfig_url, String);
- GET(secure_host, String);
- GET(secure_port, Int);
- GET(ftp_host, String);
- GET(ftp_port, Int);
- GET(socks_host, String);
- GET(socks_port, Int);
- GET(rtsp_host, String);
- GET(rtsp_port, Int);
-
- if (http_proxy.isEmpty())
- use_http_host = false;
- else
- use_http_host = true;
-}
-
-
-bool ProxyConfPrivate::isHostExcluded(const QString &host)
-{
- if (host.isEmpty())
- return true;
-
- if (ignore_hosts.isEmpty())
- return false;
-
- QHostAddress ipAddress;
- bool isIpAddress = ipAddress.setAddress(host);
-
- foreach (QVariant h, ignore_hosts) {
- QString entry = h.toString();
- if (isIpAddress && ipAddress.isInSubnet(QHostAddress::parseSubnet(entry))) {
- return true; // excluded
- } else {
- // do wildcard matching
- QRegExp rx(entry, Qt::CaseInsensitive, QRegExp::Wildcard);
- if (rx.exactMatch(host))
- return true;
- }
- }
-
- // host was not excluded
- return false;
-}
-
-
-QList<QNetworkProxy> ProxyConfPrivate::flush(const QNetworkProxyQuery &query)
-{
- QList<QNetworkProxy> result;
-
-#if 0
- qDebug()<<"http_proxy" << http_proxy;
- qDebug()<<"http_port" << http_port;
- qDebug()<<"ignore_hosts" << ignore_hosts;
- qDebug()<<"use_http_host" << use_http_host;
- qDebug()<<"mode" << mode;
- qDebug()<<"autoconfig_url" << autoconfig_url;
- qDebug()<<"secure_host" << secure_host;
- qDebug()<<"secure_port" << secure_port;
- qDebug()<<"ftp_host" << ftp_host;
- qDebug()<<"ftp_port" << ftp_port;
- qDebug()<<"socks_host" << socks_host;
- qDebug()<<"socks_port" << socks_port;
- qDebug()<<"rtsp_host" << rtsp_host;
- qDebug()<<"rtsp_port" << rtsp_port;
-#endif
-
- if (isHostExcluded(query.peerHostName()))
- return result; // no proxy for this host
-
- if (mode == QLatin1String("AUTO")) {
- // TODO: pac currently not supported, fix me
- return result;
- }
-
- if (mode == QLatin1String("MANUAL")) {
- bool isHttps = false;
- QString protocol = query.protocolTag().toLower();
-
- // try the protocol-specific proxy
- QNetworkProxy protocolSpecificProxy;
-
- if (protocol == QLatin1String("ftp")) {
- if (!ftp_host.isEmpty()) {
- protocolSpecificProxy.setType(QNetworkProxy::FtpCachingProxy);
- protocolSpecificProxy.setHostName(ftp_host);
- protocolSpecificProxy.setPort(ftp_port);
- }
- } else if (protocol == QLatin1String("http")) {
- if (!http_proxy.isEmpty()) {
- protocolSpecificProxy.setType(QNetworkProxy::HttpProxy);
- protocolSpecificProxy.setHostName(http_proxy);
- protocolSpecificProxy.setPort(http_port);
- }
- } else if (protocol == QLatin1String("https")) {
- isHttps = true;
- if (!secure_host.isEmpty()) {
- protocolSpecificProxy.setType(QNetworkProxy::HttpProxy);
- protocolSpecificProxy.setHostName(secure_host);
- protocolSpecificProxy.setPort(secure_port);
- }
- }
-
- if (protocolSpecificProxy.type() != QNetworkProxy::DefaultProxy)
- result << protocolSpecificProxy;
-
-
- if (!socks_host.isEmpty()) {
- QNetworkProxy proxy;
- proxy.setType(QNetworkProxy::Socks5Proxy);
- proxy.setHostName(socks_host);
- proxy.setPort(socks_port);
- result << proxy;
- }
-
-
- // Add the HTTPS proxy if present (and if we haven't added yet)
- if (!isHttps) {
- QNetworkProxy https;
- if (!secure_host.isEmpty()) {
- https.setType(QNetworkProxy::HttpProxy);
- https.setHostName(secure_host);
- https.setPort(secure_port);
- }
-
- if (https.type() != QNetworkProxy::DefaultProxy &&
- https != protocolSpecificProxy)
- result << https;
- }
- }
-
- return result;
-}
-
-
-ProxyConf::ProxyConf()
- : d_ptr(new ProxyConfPrivate)
-{
- g_type_init();
- d_ptr->prefix = CONF_PROXY;
- d_ptr->http_prefix = HTTP_PROXY;
-}
-
-ProxyConf::~ProxyConf()
-{
- delete d_ptr;
-}
-
-void ProxyConf::readProxyData()
-{
- d_ptr->readProxyData();
-}
-
-QList<QNetworkProxy> ProxyConf::flush(const QNetworkProxyQuery &query)
-{
- return d_ptr->flush(query);
-}
-
-
-static int refcount = 0;
-static QReadWriteLock lock;
-
-void ProxyConf::update()
-{
- QWriteLocker locker(&lock);
- NetworkProxyFactory *factory = new NetworkProxyFactory();
- QNetworkProxyFactory::setApplicationProxyFactory((QNetworkProxyFactory*)factory);
- refcount++;
-}
-
-
-void ProxyConf::clear(void)
-{
- QWriteLocker locker(&lock);
- refcount--;
- if (refcount == 0)
- QNetworkProxyFactory::setApplicationProxyFactory(NULL);
-
- if (refcount<0)
- refcount = 0;
-}
-
-
-} // namespace Maemo
diff --git a/src/plugins/bearer/icd/proxyconf.h b/src/plugins/bearer/icd/proxyconf.h
deleted file mode 100644
index 9f657f87ba..0000000000
--- a/src/plugins/bearer/icd/proxyconf.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef PROXYCONF_H
-#define PROXYCONF_H
-
-#include <QString>
-#include <QNetworkProxy>
-
-namespace Maemo {
-
-class ProxyConfPrivate;
-class ProxyConf {
-private:
- ProxyConfPrivate *d_ptr;
-
-public:
- ProxyConf();
- virtual ~ProxyConf();
-
- QList<QNetworkProxy> flush(const QNetworkProxyQuery &query = QNetworkProxyQuery()); // read the proxies from db
- void readProxyData();
-
- /* Note that for each update() call there should be corresponding
- * clear() call because the ProxyConf class implements a reference
- * counting mechanism. The factory is removed only when there is
- * no one using the factory any more.
- */
- static void update(void); // this builds QNetworkProxy factory
- static void clear(void); // this removes QNetworkProxy factory
-};
-
-} // namespace Maemo
-
-#endif
diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp
deleted file mode 100644
index d79a513ec4..0000000000
--- a/src/plugins/bearer/icd/qicdengine.cpp
+++ /dev/null
@@ -1,1126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qicdengine.h"
-#include "qnetworksession_impl.h"
-
-#include <wlancond.h>
-#include <wlan-utils.h>
-#include <iapconf.h>
-#include <iapmonitor.h>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-IcdNetworkConfigurationPrivate::IcdNetworkConfigurationPrivate()
-: service_attrs(0), network_attrs(0)
-{
-}
-
-IcdNetworkConfigurationPrivate::~IcdNetworkConfigurationPrivate()
-{
-}
-
-QString IcdNetworkConfigurationPrivate::bearerTypeName() const
-{
- QMutexLocker locker(&mutex);
-
- return iap_type;
-}
-
-/******************************************************************************/
-/** IapAddTimer specific */
-/******************************************************************************/
-
-/* The IapAddTimer is a helper class that makes sure we update
- * the configuration only after all db additions to certain
- * iap are finished (after a certain timeout)
- */
-class _IapAddTimer : public QObject
-{
- Q_OBJECT
-
-public:
- _IapAddTimer() {}
- ~_IapAddTimer()
- {
- if (timer.isActive()) {
- QObject::disconnect(&timer, SIGNAL(timeout()), this, SLOT(timeout()));
- timer.stop();
- }
- }
-
- void add(QString& iap_id, QIcdEngine *d);
-
- QString iap_id;
- QTimer timer;
- QIcdEngine *d;
-
-public Q_SLOTS:
- void timeout();
-};
-
-
-void _IapAddTimer::add(QString& id, QIcdEngine *d_ptr)
-{
- iap_id = id;
- d = d_ptr;
-
- if (timer.isActive()) {
- QObject::disconnect(&timer, SIGNAL(timeout()), this, SLOT(timeout()));
- timer.stop();
- }
- timer.setSingleShot(true);
- QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(timeout()));
- timer.start(1500);
-}
-
-
-void _IapAddTimer::timeout()
-{
- d->addConfiguration(iap_id);
-}
-
-
-class IapAddTimer {
- QHash<QString, _IapAddTimer* > timers;
-
-public:
- IapAddTimer() {}
- ~IapAddTimer() {}
-
- void add(QString& iap_id, QIcdEngine *d);
- void del(QString& iap_id);
- void removeAll();
-};
-
-
-void IapAddTimer::removeAll()
-{
- QHashIterator<QString, _IapAddTimer* > i(timers);
- while (i.hasNext()) {
- i.next();
- _IapAddTimer *t = i.value();
- delete t;
- }
- timers.clear();
-}
-
-
-void IapAddTimer::add(QString& iap_id, QIcdEngine *d)
-{
- if (timers.contains(iap_id)) {
- _IapAddTimer *iap = timers.value(iap_id);
- iap->add(iap_id, d);
- } else {
- _IapAddTimer *iap = new _IapAddTimer;
- iap->add(iap_id, d);
- timers.insert(iap_id, iap);
- }
-}
-
-void IapAddTimer::del(QString& iap_id)
-{
- if (timers.contains(iap_id)) {
- _IapAddTimer *iap = timers.take(iap_id);
- delete iap;
- }
-}
-
-/******************************************************************************/
-/** IAPMonitor specific */
-/******************************************************************************/
-
-class IapMonitor : public Maemo::IAPMonitor
-{
-public:
- IapMonitor() : first_call(true) { }
-
- void setup(QIcdEngine *d);
- void cleanup();
-
-protected:
- void iapAdded(const QString &iapId);
- void iapRemoved(const QString &iapId);
-
-private:
- bool first_call;
-
- QIcdEngine *d;
- IapAddTimer timers;
-};
-
-void IapMonitor::setup(QIcdEngine *d_ptr)
-{
- if (first_call) {
- d = d_ptr;
- first_call = false;
- }
-}
-
-
-void IapMonitor::cleanup()
-{
- if (!first_call) {
- timers.removeAll();
- first_call = true;
- }
-}
-
-
-void IapMonitor::iapAdded(const QString &iap_id)
-{
- /* We cannot know when the IAP is fully added to db, so a timer is
- * installed instead. When the timer expires we hope that IAP is added ok.
- */
- QString id = iap_id;
- timers.add(id, d);
-}
-
-
-void IapMonitor::iapRemoved(const QString &iap_id)
-{
- QString id = iap_id;
- d->deleteConfiguration(id);
-}
-
-
-/******************************************************************************/
-/** QIcdEngine implementation */
-/******************************************************************************/
-
-QIcdEngine::QIcdEngine(QObject *parent)
-: QBearerEngine(parent), iapMonitor(0), m_dbusInterface(0), m_icdServiceWatcher(0),
- firstUpdate(true), m_scanGoingOn(false)
-{
-}
-
-QIcdEngine::~QIcdEngine()
-{
- cleanup();
- delete iapMonitor;
-}
-
-QNetworkConfigurationManager::Capabilities QIcdEngine::capabilities() const
-{
- return QNetworkConfigurationManager::CanStartAndStopInterfaces |
- QNetworkConfigurationManager::DataStatistics |
- QNetworkConfigurationManager::ForcedRoaming |
- QNetworkConfigurationManager::NetworkSessionRequired;
-}
-
-bool QIcdEngine::ensureDBusConnection()
-{
- if (m_dbusInterface)
- return true;
-
- // Setup DBus Interface for ICD
- m_dbusInterface = new QDBusInterface(ICD_DBUS_API_INTERFACE,
- ICD_DBUS_API_PATH,
- ICD_DBUS_API_INTERFACE,
- QDBusConnection::systemBus(),
- this);
-
- if (!m_dbusInterface->isValid()) {
- delete m_dbusInterface;
- m_dbusInterface = 0;
-
- if (!m_icdServiceWatcher) {
- m_icdServiceWatcher = new QDBusServiceWatcher(ICD_DBUS_API_INTERFACE,
- QDBusConnection::systemBus(),
- QDBusServiceWatcher::WatchForOwnerChange,
- this);
-
- connect(m_icdServiceWatcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
- this, SLOT(icdServiceOwnerChanged(QString,QString,QString)));
- }
-
- return false;
- }
-
- connect(&m_scanTimer, SIGNAL(timeout()), this, SLOT(finishAsyncConfigurationUpdate()));
- m_scanTimer.setSingleShot(true);
-
- /* Turn on IAP state monitoring */
- startListeningStateSignalsForAllConnections();
-
- /* Turn on IAP add/remove monitoring */
- iapMonitor = new IapMonitor;
- iapMonitor->setup(this);
-
- /* We create a default configuration which is a pseudo config */
- QNetworkConfigurationPrivate *cpPriv = new IcdNetworkConfigurationPrivate;
- cpPriv->name = "UserChoice";
- cpPriv->state = QNetworkConfiguration::Discovered;
- cpPriv->isValid = true;
- cpPriv->id = OSSO_IAP_ANY;
- cpPriv->type = QNetworkConfiguration::UserChoice;
- cpPriv->purpose = QNetworkConfiguration::UnknownPurpose;
- cpPriv->roamingSupported = false;
-
- QNetworkConfigurationPrivatePointer ptr(cpPriv);
- userChoiceConfigurations.insert(cpPriv->id, ptr);
-
- doRequestUpdate();
-
- getIcdInitialState();
-
- return true;
-}
-
-void QIcdEngine::initialize()
-{
- QMutexLocker locker(&mutex);
-
- if (!ensureDBusConnection()) {
- locker.unlock();
- emit updateCompleted();
- locker.relock();
- }
-}
-
-static inline QString network_attrs_to_security(uint network_attrs)
-{
- uint cap = 0;
- nwattr2cap(network_attrs, &cap); /* from libicd-network-wlan-dev.h */
- if (cap & WLANCOND_OPEN)
- return "NONE";
- else if (cap & WLANCOND_WEP)
- return "WEP";
- else if (cap & WLANCOND_WPA_PSK)
- return "WPA_PSK";
- else if (cap & WLANCOND_WPA_EAP)
- return "WPA_EAP";
- return "";
-}
-
-
-struct SSIDInfo {
- QString iap_id;
- QString wlan_security;
-};
-
-
-void QIcdEngine::deleteConfiguration(const QString &iap_id)
-{
- QMutexLocker locker(&mutex);
-
- /* Called when IAPs are deleted in db, in this case we do not scan
- * or read all the IAPs from db because it might take too much power
- * (multiple applications would need to scan and read all IAPs from db)
- */
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(iap_id);
- if (ptr) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "IAP" << iap_id << "was removed from storage.";
-#endif
-
- locker.unlock();
- emit configurationRemoved(ptr);
- } else {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("IAP: %s, already missing from the known list", iap_id.toAscii().data());
-#endif
- }
-}
-
-
-static quint32 getNetworkAttrs(bool is_iap_id,
- const QString &iap_id,
- const QString &iap_type,
- QString security_method)
-{
- guint network_attr = 0;
- dbus_uint32_t cap = 0;
-
- if (iap_type == "WLAN_INFRA")
- cap |= WLANCOND_INFRA;
- else if (iap_type == "WLAN_ADHOC")
- cap |= WLANCOND_ADHOC;
-
- if (security_method.isEmpty() && (cap & (WLANCOND_INFRA | WLANCOND_ADHOC))) {
- Maemo::IAPConf saved_ap(iap_id);
- security_method = saved_ap.value("wlan_security").toString();
- }
-
- if (!security_method.isEmpty()) {
- if (security_method == "WEP")
- cap |= WLANCOND_WEP;
- else if (security_method == "WPA_PSK")
- cap |= WLANCOND_WPA_PSK;
- else if (security_method == "WPA_EAP")
- cap |= WLANCOND_WPA_EAP;
- else if (security_method == "NONE")
- cap |= WLANCOND_OPEN;
-
- if (cap & (WLANCOND_WPA_PSK | WLANCOND_WPA_EAP)) {
- Maemo::IAPConf saved_iap(iap_id);
- bool wpa2_only = saved_iap.value("EAP_wpa2_only_mode").toBool();
- if (wpa2_only) {
- cap |= WLANCOND_WPA2;
- }
- }
- }
-
- cap2nwattr(cap, &network_attr);
- if (is_iap_id)
- network_attr |= ICD_NW_ATTR_IAPNAME;
-
- return quint32(network_attr);
-}
-
-
-void QIcdEngine::addConfiguration(QString& iap_id)
-{
- // Note: When new IAP is created, this function gets called multiple times
- // in a row.
- // For example: Empty type & name for WLAN was stored into newly
- // created IAP data in gconf when this function gets
- // called for the first time.
- // WLAN type & name are updated into IAP data in gconf
- // as soon as WLAN connection is up and running.
- // => And this function gets called again.
-
- QMutexLocker locker(&mutex);
-
- if (!accessPointConfigurations.contains(iap_id)) {
- Maemo::IAPConf saved_iap(iap_id);
- QString iap_type = saved_iap.value("type").toString();
- QString iap_name = saved_iap.value("name").toString();
- QByteArray ssid = saved_iap.value("wlan_ssid").toByteArray();
- if (!iap_type.isEmpty() && !iap_name.isEmpty()) {
- // Check if new IAP is actually Undefined WLAN configuration
- // Note: SSID is used as an iap id for Undefined WLAN configurations
- // => configuration must be searched using SSID
- if (!ssid.isEmpty() && accessPointConfigurations.contains(ssid)) {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(ssid);
- if (ptr) {
- ptr->mutex.lock();
- ptr->id = iap_id;
- toIcdConfig(ptr)->iap_type = iap_type;
- ptr->bearerType = bearerTypeFromIapType(iap_type);
- toIcdConfig(ptr)->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString());
- toIcdConfig(ptr)->network_id = ssid;
- toIcdConfig(ptr)->service_id = saved_iap.value("service_id").toString();
- toIcdConfig(ptr)->service_type = saved_iap.value("service_type").toString();
- if (m_onlineIapId == iap_id) {
- ptr->state = QNetworkConfiguration::Active;
- } else {
- ptr->state = QNetworkConfiguration::Defined;
- }
- ptr->mutex.unlock();
- accessPointConfigurations.insert(iap_id, ptr);
-
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- }
- } else {
- IcdNetworkConfigurationPrivate *cpPriv = new IcdNetworkConfigurationPrivate;
- cpPriv->name = saved_iap.value("name").toString();
- if (cpPriv->name.isEmpty())
- cpPriv->name = iap_id;
- cpPriv->isValid = true;
- cpPriv->id = iap_id;
- cpPriv->iap_type = iap_type;
- cpPriv->bearerType = bearerTypeFromIapType(iap_type);
- cpPriv->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString());
- cpPriv->service_id = saved_iap.value("service_id").toString();
- cpPriv->service_type = saved_iap.value("service_type").toString();
- if (iap_type.startsWith(QLatin1String("WLAN"))) {
- QByteArray ssid = saved_iap.value("wlan_ssid").toByteArray();
- if (ssid.isEmpty()) {
- qWarning() << "Cannot get ssid for" << iap_id;
- }
- cpPriv->network_id = ssid;
- }
- cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
- if (m_onlineIapId == iap_id) {
- cpPriv->state = QNetworkConfiguration::Active;
- } else {
- cpPriv->state = QNetworkConfiguration::Defined;
- }
-
- QNetworkConfigurationPrivatePointer ptr(cpPriv);
- accessPointConfigurations.insert(iap_id, ptr);
-
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("IAP: %s, name: %s, added to known list", iap_id.toAscii().data(), cpPriv->name.toAscii().data());
-#endif
- locker.unlock();
- emit configurationAdded(ptr);
- locker.relock();
- }
- } else {
- qWarning("IAP %s does not have \"type\" or \"name\" fields defined, skipping this IAP.", iap_id.toAscii().data());
- }
- } else {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "IAP" << iap_id << "already in db.";
-#endif
-
- /* Check if the data in db changed and update configuration accordingly
- */
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iap_id);
- if (ptr) {
- Maemo::IAPConf changed_iap(iap_id);
- QString iap_type = changed_iap.value("type").toString();
- bool update_needed = false; /* if IAP type or ssid changed, we need to change the state */
-
- QMutexLocker configLocker(&ptr->mutex);
-
- toIcdConfig(ptr)->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString());
- toIcdConfig(ptr)->service_id = changed_iap.value("service_id").toString();
- toIcdConfig(ptr)->service_type = changed_iap.value("service_type").toString();
-
- if (!iap_type.isEmpty()) {
- ptr->name = changed_iap.value("name").toString();
- if (ptr->name.isEmpty())
- ptr->name = iap_id;
- ptr->isValid = true;
- if (toIcdConfig(ptr)->iap_type != iap_type) {
- toIcdConfig(ptr)->iap_type = iap_type;
- ptr->bearerType = bearerTypeFromIapType(iap_type);
- update_needed = true;
- }
- if (iap_type.startsWith(QLatin1String("WLAN"))) {
- QByteArray ssid = changed_iap.value("wlan_ssid").toByteArray();
- if (ssid.isEmpty()) {
- qWarning() << "Cannot get ssid for" << iap_id;
- }
- if (toIcdConfig(ptr)->network_id != ssid) {
- toIcdConfig(ptr)->network_id = ssid;
- update_needed = true;
- }
- }
- }
-
- if (update_needed) {
- ptr->type = QNetworkConfiguration::InternetAccessPoint;
- if (m_onlineIapId == iap_id) {
- if (ptr->state < QNetworkConfiguration::Active) {
- ptr->state = QNetworkConfiguration::Active;
-
- configLocker.unlock();
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- }
- } else if (ptr->state < QNetworkConfiguration::Defined) {
- ptr->state = QNetworkConfiguration::Defined;
-
- configLocker.unlock();
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- }
- }
- } else {
- qWarning("Cannot find IAP %s from current configuration although it should be there.", iap_id.toAscii().data());
- }
- }
-}
-
-void QIcdEngine::doRequestUpdate(QList<Maemo::IcdScanResult> scanned)
-{
- /* Contains all known iap_ids from storage */
- QList<QString> knownConfigs = accessPointConfigurations.keys();
-
- /* Contains all known WLAN network ids (like ssid) from storage */
- QMultiHash<QByteArray, SSIDInfo* > notDiscoveredWLANConfigs;
-
- QList<QString> all_iaps;
- Maemo::IAPConf::getAll(all_iaps);
-
- foreach (const QString &iap_id, all_iaps) {
- QByteArray ssid;
-
- Maemo::IAPConf saved_ap(iap_id);
- bool is_temporary = saved_ap.value("temporary").toBool();
- if (is_temporary) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "IAP" << iap_id << "is temporary, skipping it.";
-#endif
- continue;
- }
-
- QString iap_type = saved_ap.value("type").toString();
- if (iap_type.startsWith(QLatin1String("WLAN"))) {
- ssid = saved_ap.value("wlan_ssid").toByteArray();
- if (ssid.isEmpty())
- continue;
-
- QString security_method = saved_ap.value("wlan_security").toString();
- SSIDInfo *info = new SSIDInfo;
- info->iap_id = iap_id;
- info->wlan_security = security_method;
- notDiscoveredWLANConfigs.insert(ssid, info);
- } else if (iap_type.isEmpty()) {
- continue;
- } else {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "IAP" << iap_id << "network type is" << iap_type;
-#endif
- ssid.clear();
- }
-
- if (!accessPointConfigurations.contains(iap_id)) {
- IcdNetworkConfigurationPrivate *cpPriv = new IcdNetworkConfigurationPrivate;
-
- cpPriv->name = saved_ap.value("name").toString();
- if (cpPriv->name.isEmpty()) {
- if (!ssid.isEmpty() && ssid.size() > 0)
- cpPriv->name = ssid.data();
- else
- cpPriv->name = iap_id;
- }
- cpPriv->isValid = true;
- cpPriv->id = iap_id;
- cpPriv->network_id = ssid;
- cpPriv->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString());
- cpPriv->iap_type = iap_type;
- cpPriv->bearerType = bearerTypeFromIapType(iap_type);
- cpPriv->service_id = saved_ap.value("service_id").toString();
- cpPriv->service_type = saved_ap.value("service_type").toString();
- cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
- cpPriv->state = QNetworkConfiguration::Defined;
-
- QNetworkConfigurationPrivatePointer ptr(cpPriv);
- accessPointConfigurations.insert(iap_id, ptr);
-
- mutex.unlock();
- emit configurationAdded(ptr);
- mutex.lock();
-
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("IAP: %s, name: %s, ssid: %s, added to known list",
- iap_id.toAscii().data(), ptr->name.toAscii().data(),
- !ssid.isEmpty() ? ssid.data() : "-");
-#endif
- } else {
- knownConfigs.removeOne(iap_id);
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("IAP: %s, ssid: %s, already exists in the known list",
- iap_id.toAscii().data(), !ssid.isEmpty() ? ssid.data() : "-");
-#endif
- }
- }
-
- /* This is skipped in the first update as scanned size is zero */
- if (!scanned.isEmpty()) {
- for (int i=0; i<scanned.size(); ++i) {
- const Maemo::IcdScanResult ap = scanned.at(i);
-
- if (ap.scan.network_attrs & ICD_NW_ATTR_IAPNAME) {
- /* The network_id is IAP id, so the IAP is a known one */
- QString iapid = ap.scan.network_id.data();
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iapid);
- if (ptr) {
- bool changed = false;
-
- ptr->mutex.lock();
-
- if (!ptr->isValid) {
- ptr->isValid = true;
- changed = true;
- }
-
- /* If this config is the current active one, we do not set it
- * to discovered.
- */
- if ((ptr->state != QNetworkConfiguration::Discovered) &&
- (ptr->state != QNetworkConfiguration::Active)) {
- ptr->state = QNetworkConfiguration::Discovered;
- changed = true;
- }
-
- toIcdConfig(ptr)->network_attrs = ap.scan.network_attrs;
- toIcdConfig(ptr)->service_id = ap.scan.service_id;
- toIcdConfig(ptr)->service_type = ap.scan.service_type;
- toIcdConfig(ptr)->service_attrs = ap.scan.service_attrs;
-
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("IAP: %s, ssid: %s, discovered",
- iapid.toAscii().data(), toIcdConfig(ptr)->network_id.data());
-#endif
-
- ptr->mutex.unlock();
-
- if (changed) {
- mutex.unlock();
- emit configurationChanged(ptr);
- mutex.lock();
- }
-
- if (!ap.scan.network_type.startsWith(QLatin1String("WLAN")))
- continue; // not a wlan AP
-
- /* Remove scanned AP from discovered WLAN configurations so that we can
- * emit configurationRemoved signal later
- */
- ptr->mutex.lock();
- QList<SSIDInfo* > known_iaps = notDiscoveredWLANConfigs.values(toIcdConfig(ptr)->network_id);
-rescan_list:
- if (!known_iaps.isEmpty()) {
- for (int k=0; k<known_iaps.size(); ++k) {
- SSIDInfo *iap = known_iaps.at(k);
-
- if (iap->wlan_security ==
- network_attrs_to_security(ap.scan.network_attrs)) {
- /* Remove IAP from the list */
- notDiscoveredWLANConfigs.remove(toIcdConfig(ptr)->network_id, iap);
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "Removed IAP" << iap->iap_id << "from unknown config";
-#endif
- known_iaps.removeAt(k);
- delete iap;
- goto rescan_list;
- }
- }
- }
- ptr->mutex.unlock();
- }
- } else {
- /* Non saved access point data */
- QByteArray scanned_ssid = ap.scan.network_id;
- if (!accessPointConfigurations.contains(scanned_ssid)) {
- IcdNetworkConfigurationPrivate *cpPriv = new IcdNetworkConfigurationPrivate;
- QString hrs = scanned_ssid.data();
-
- cpPriv->name = ap.network_name.isEmpty() ? hrs : ap.network_name;
- cpPriv->isValid = true;
- cpPriv->id = scanned_ssid.data(); // Note: id is now ssid, it should be set to IAP id if the IAP is saved
- cpPriv->network_id = scanned_ssid;
- cpPriv->iap_type = ap.scan.network_type;
- cpPriv->bearerType = bearerTypeFromIapType(cpPriv->iap_type);
- cpPriv->network_attrs = ap.scan.network_attrs;
- cpPriv->service_id = ap.scan.service_id;
- cpPriv->service_type = ap.scan.service_type;
- cpPriv->service_attrs = ap.scan.service_attrs;
-
- cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
- cpPriv->state = QNetworkConfiguration::Undefined;
-
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "IAP with network id" << cpPriv->id << "was found in the scan.";
-#endif
-
- QNetworkConfigurationPrivatePointer ptr(cpPriv);
- accessPointConfigurations.insert(ptr->id, ptr);
-
- mutex.unlock();
- emit configurationAdded(ptr);
- mutex.lock();
- } else {
- knownConfigs.removeOne(scanned_ssid);
- }
- }
- }
- }
-
- if (!firstUpdate) {
- // Update Defined status to all defined WLAN IAPs which
- // could not be found when access points were scanned
- QHashIterator<QByteArray, SSIDInfo* > i(notDiscoveredWLANConfigs);
- while (i.hasNext()) {
- i.next();
- SSIDInfo *iap = i.value();
- QString iap_id = iap->iap_id;
- //qDebug() << i.key() << ": " << iap_id;
-
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iap_id);
- if (ptr) {
- QMutexLocker configLocker(&ptr->mutex);
-
- // WLAN AccessPoint configuration could not be Discovered
- // => Make sure that configuration state is Defined
- if (ptr->state > QNetworkConfiguration::Defined) {
- ptr->state = QNetworkConfiguration::Defined;
-
- configLocker.unlock();
- mutex.unlock();
- emit configurationChanged(ptr);
- mutex.lock();
- }
- }
- }
-
- /* Remove non existing iaps since last update */
- foreach (const QString &oldIface, knownConfigs) {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(oldIface);
- if (ptr) {
- mutex.unlock();
- emit configurationRemoved(ptr);
- mutex.lock();
- //if we would have SNAP support we would have to remove the references
- //from existing ServiceNetworks to the removed access point configuration
- }
- }
- }
-
- QMutableHashIterator<QByteArray, SSIDInfo* > i(notDiscoveredWLANConfigs);
- while (i.hasNext()) {
- i.next();
- SSIDInfo *iap = i.value();
- delete iap;
- i.remove();
- }
-
- if (!firstUpdate) {
- mutex.unlock();
- emit updateCompleted();
- mutex.lock();
- }
-
- if (firstUpdate)
- firstUpdate = false;
-}
-
-QNetworkConfigurationPrivatePointer QIcdEngine::defaultConfiguration()
-{
- QMutexLocker locker(&mutex);
-
- if (!ensureDBusConnection())
- return QNetworkConfigurationPrivatePointer();
-
- // Here we just return [ANY] request to icd and let the icd decide which IAP to connect.
- return userChoiceConfigurations.value(OSSO_IAP_ANY);
-}
-
-void QIcdEngine::startListeningStateSignalsForAllConnections()
-{
- // Start listening ICD_DBUS_API_STATE_SIG signals
- m_dbusInterface->connection().connect(ICD_DBUS_API_INTERFACE,
- ICD_DBUS_API_PATH,
- ICD_DBUS_API_INTERFACE,
- ICD_DBUS_API_STATE_SIG,
- this, SLOT(connectionStateSignalsSlot(QDBusMessage)));
-}
-
-void QIcdEngine::getIcdInitialState()
-{
- /* Instead of requesting ICD status asynchronously, we ask it synchronously.
- * It ensures that we always get right icd status BEFORE initialize() ends.
- * If not, initialize() might end before we got icd status and
- * QNetworkConfigurationManager::updateConfigurations()
- * call from user might also end before receiving icd status.
- * In such case, we come up to a bug:
- * QNetworkConfigurationManagerPrivate::isOnline() will be false even
- * if we are connected.
- */
- Maemo::Icd icd;
- QList<Maemo::IcdStateResult> state_results;
- QNetworkConfigurationPrivatePointer ptr;
-
- if (icd.state(state_results) && !state_results.isEmpty()) {
-
- if (!(state_results.first().params.network_attrs == 0 &&
- state_results.first().params.network_id.isEmpty())) {
-
- switch (state_results.first().state) {
- case ICD_STATE_CONNECTED:
- m_onlineIapId = state_results.first().params.network_id;
-
- ptr = accessPointConfigurations.value(m_onlineIapId);
- if (ptr) {
- QMutexLocker configLocker(&ptr->mutex);
- ptr->state = QNetworkConfiguration::Active;
- configLocker.unlock();
-
- mutex.unlock();
- emit configurationChanged(ptr);
- mutex.lock();
- }
- break;
- default:
- break;
- }
- }
- }
-}
-
-void QIcdEngine::connectionStateSignalsSlot(QDBusMessage msg)
-{
- QMutexLocker locker(&mutex);
-
- QList<QVariant> arguments = msg.arguments();
- if (arguments.count() < 8 || arguments.at(1).toUInt() != 0) {
- return;
- }
-
- QString iapid = arguments[5].toByteArray().data();
- uint icd_connection_state = arguments.at(7).toUInt();
-
- switch (icd_connection_state) {
- case ICD_STATE_CONNECTED:
- {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iapid);
- if (ptr) {
- QMutexLocker configLocker(&ptr->mutex);
-
- ptr->type = QNetworkConfiguration::InternetAccessPoint;
- if (ptr->state != QNetworkConfiguration::Active) {
- ptr->state = QNetworkConfiguration::Active;
-
- configLocker.unlock();
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
-
- m_onlineIapId = iapid;
- }
- } else {
- // This gets called when new WLAN IAP is created using Connection dialog
- // At this point Undefined WLAN configuration has SSID as iap id
- // => Because of that configuration can not be found from
- // accessPointConfigurations using correct iap id
- m_onlineIapId = iapid;
- }
- break;
- }
- case ICD_STATE_DISCONNECTED:
- {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iapid);
- if (ptr) {
- QMutexLocker configLocker(&ptr->mutex);
-
- ptr->type = QNetworkConfiguration::InternetAccessPoint;
- if (ptr->state == QNetworkConfiguration::Active) {
- ptr->state = QNetworkConfiguration::Discovered;
-
- configLocker.unlock();
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
-
- // Note: If ICD switches used IAP from one to another:
- // 1) new IAP is reported to be online first
- // 2) old IAP is reported to be offline then
- // => Device can be reported to be offline only
- // if last known online IAP is reported to be disconnected
- if (iapid == m_onlineIapId) {
- // It's known that there is only one global ICD connection
- // => Because ICD state was reported to be DISCONNECTED, Device is offline
- m_onlineIapId.clear();
- }
- }
- } else {
- // Disconnected IAP was not found from accessPointConfigurations
- // => Reason: Online IAP was removed which resulted ICD to disconnect
- if (iapid == m_onlineIapId) {
- // It's known that there is only one global ICD connection
- // => Because ICD state was reported to be DISCONNECTED, Device is offline
- m_onlineIapId.clear();
- }
- }
- break;
- }
- default:
- break;
- }
-
- locker.unlock();
- emit iapStateChanged(iapid, icd_connection_state);
- locker.relock();
-}
-
-void QIcdEngine::icdServiceOwnerChanged(const QString &serviceName, const QString &oldOwner,
- const QString &newOwner)
-{
- Q_UNUSED(serviceName);
- Q_UNUSED(oldOwner);
-
- QMutexLocker locker(&mutex);
-
- if (newOwner.isEmpty()) {
- // Disconnected from ICD, remove all configurations
- cleanup();
- delete iapMonitor;
- iapMonitor = 0;
- delete m_dbusInterface;
- m_dbusInterface = 0;
-
- QMutableHashIterator<QString, QNetworkConfigurationPrivatePointer> i(accessPointConfigurations);
- while (i.hasNext()) {
- i.next();
-
- QNetworkConfigurationPrivatePointer ptr = i.value();
- i.remove();
-
- locker.unlock();
- emit configurationRemoved(ptr);
- locker.relock();
- }
-
- userChoiceConfigurations.clear();
- } else {
- // Connected to ICD ensure connection.
- ensureDBusConnection();
- }
-}
-
-void QIcdEngine::requestUpdate()
-{
- QMutexLocker locker(&mutex);
-
- if (!ensureDBusConnection()) {
- locker.unlock();
- emit updateCompleted();
- locker.relock();
- return;
- }
-
- if (m_scanGoingOn)
- return;
-
- m_scanGoingOn = true;
-
- m_dbusInterface->connection().connect(ICD_DBUS_API_INTERFACE,
- ICD_DBUS_API_PATH,
- ICD_DBUS_API_INTERFACE,
- ICD_DBUS_API_SCAN_SIG,
- this, SLOT(asyncUpdateConfigurationsSlot(QDBusMessage)));
-
- QDBusMessage msg = m_dbusInterface->call(ICD_DBUS_API_SCAN_REQ,
- (uint)ICD_SCAN_REQUEST_ACTIVE);
- m_typesToBeScanned = msg.arguments()[0].value<QStringList>();
- m_scanTimer.start(ICD_SHORT_SCAN_TIMEOUT);
-}
-
-void QIcdEngine::cancelAsyncConfigurationUpdate()
-{
- if (!ensureDBusConnection())
- return;
-
- if (!m_scanGoingOn)
- return;
-
- m_scanGoingOn = false;
-
- if (m_scanTimer.isActive())
- m_scanTimer.stop();
-
- m_dbusInterface->connection().disconnect(ICD_DBUS_API_INTERFACE,
- ICD_DBUS_API_PATH,
- ICD_DBUS_API_INTERFACE,
- ICD_DBUS_API_SCAN_SIG,
- this, SLOT(asyncUpdateConfigurationsSlot(QDBusMessage)));
-
- // Stop scanning rounds by calling ICD_DBUS_API_SCAN_CANCEL
- // <=> If ICD_DBUS_API_SCAN_CANCEL is not called, new scanning round will
- // be started after the module scan timeout.
- m_dbusInterface->call(ICD_DBUS_API_SCAN_CANCEL);
-}
-
-void QIcdEngine::finishAsyncConfigurationUpdate()
-{
- QMutexLocker locker(&mutex);
-
- cancelAsyncConfigurationUpdate();
- doRequestUpdate(m_scanResult);
- m_scanResult.clear();
-}
-
-void QIcdEngine::asyncUpdateConfigurationsSlot(QDBusMessage msg)
-{
- QMutexLocker locker(&mutex);
-
- QList<QVariant> arguments = msg.arguments();
- uint icd_scan_status = arguments.takeFirst().toUInt();
- if (icd_scan_status == ICD_SCAN_COMPLETE) {
- m_typesToBeScanned.removeOne(arguments[6].toString());
- if (!m_typesToBeScanned.count()) {
- locker.unlock();
- finishAsyncConfigurationUpdate();
- locker.relock();
- }
- } else {
- Maemo::IcdScanResult scanResult;
- scanResult.status = icd_scan_status;
- scanResult.timestamp = arguments.takeFirst().toUInt();
- scanResult.scan.service_type = arguments.takeFirst().toString();
- scanResult.service_name = arguments.takeFirst().toString();
- scanResult.scan.service_attrs = arguments.takeFirst().toUInt();
- scanResult.scan.service_id = arguments.takeFirst().toString();
- scanResult.service_priority = arguments.takeFirst().toInt();
- scanResult.scan.network_type = arguments.takeFirst().toString();
- scanResult.network_name = arguments.takeFirst().toString();
- scanResult.scan.network_attrs = arguments.takeFirst().toUInt();
- scanResult.scan.network_id = arguments.takeFirst().toByteArray();
- scanResult.network_priority = arguments.takeFirst().toInt();
- scanResult.signal_strength = arguments.takeFirst().toInt();
- scanResult.station_id = arguments.takeFirst().toString();
- scanResult.signal_dB = arguments.takeFirst().toInt();
-
- m_scanResult.append(scanResult);
- }
-}
-
-void QIcdEngine::cleanup()
-{
- if (m_scanGoingOn) {
- m_scanTimer.stop();
- m_dbusInterface->call(ICD_DBUS_API_SCAN_CANCEL);
- }
- if (iapMonitor)
- iapMonitor->cleanup();
-}
-
-bool QIcdEngine::hasIdentifier(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- return accessPointConfigurations.contains(id) ||
- snapConfigurations.contains(id) ||
- userChoiceConfigurations.contains(id);
-}
-
-QNetworkSessionPrivate *QIcdEngine::createSessionBackend()
-{
- return new QNetworkSessionPrivateImpl(this);
-}
-
-#include "qicdengine.moc"
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/plugins/bearer/icd/qicdengine.h b/src/plugins/bearer/icd/qicdengine.h
deleted file mode 100644
index a72cc72b8e..0000000000
--- a/src/plugins/bearer/icd/qicdengine.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QICDENGINE_H
-#define QICDENGINE_H
-
-#include <QtNetwork/private/qbearerengine_p.h>
-
-#include <QtCore/qtimer.h>
-
-#include "maemo_icd.h"
-
-QT_BEGIN_NAMESPACE
-
-class QNetworkConfigurationPrivate;
-class IapMonitor;
-class QDBusInterface;
-class QDBusServiceWatcher;
-
-inline QNetworkConfiguration::BearerType bearerTypeFromIapType(const QString &iapType)
-{
- if (iapType == QLatin1String("WLAN_INFRA") ||
- iapType == QLatin1String("WLAN_ADHOC")) {
- return QNetworkConfiguration::BearerWLAN;
- } else if (iapType == QLatin1String("GPRS")) {
- return QNetworkConfiguration::BearerHSPA;
- } else {
- return QNetworkConfiguration::BearerUnknown;
- }
-}
-
-class IcdNetworkConfigurationPrivate : public QNetworkConfigurationPrivate
-{
-public:
- IcdNetworkConfigurationPrivate();
- ~IcdNetworkConfigurationPrivate();
-
- virtual QString bearerTypeName() const;
-
- // In Maemo the id field (defined in QNetworkConfigurationPrivate)
- // is the IAP id (which typically is UUID)
- QByteArray network_id; // typically WLAN ssid or similar
- QString iap_type; // is this one WLAN or GPRS
-
- QString service_type;
- QString service_id;
- quint32 service_attrs;
-
- // Network attributes for this IAP, this is the value returned by icd and
- // passed to it when connecting.
- quint32 network_attrs;
-};
-
-inline IcdNetworkConfigurationPrivate *toIcdConfig(QNetworkConfigurationPrivatePointer ptr)
-{
- return static_cast<IcdNetworkConfigurationPrivate *>(ptr.data());
-}
-
-class QIcdEngine : public QBearerEngine
-{
- Q_OBJECT
-
-public:
- QIcdEngine(QObject *parent = 0);
- ~QIcdEngine();
-
- bool hasIdentifier(const QString &id);
-
- Q_INVOKABLE void initialize();
- Q_INVOKABLE void requestUpdate();
-
- QNetworkConfigurationManager::Capabilities capabilities() const;
-
- QNetworkSessionPrivate *createSessionBackend();
-
- QNetworkConfigurationPrivatePointer defaultConfiguration();
-
- void deleteConfiguration(const QString &iap_id);
-
- inline QNetworkConfigurationPrivatePointer configuration(const QString &id)
- {
- QMutexLocker locker(&mutex);
-
- return accessPointConfigurations.value(id);
- }
-
- inline void addSessionConfiguration(QNetworkConfigurationPrivatePointer ptr)
- {
- QMutexLocker locker(&mutex);
-
- accessPointConfigurations.insert(ptr->id, ptr);
-
- locker.unlock();
- emit configurationAdded(ptr);
- }
-
- inline void changedSessionConfiguration(QNetworkConfigurationPrivatePointer ptr)
- {
- emit configurationChanged(ptr);
- }
-
- void cleanup();
-
- void addConfiguration(QString &iap_id);
-
-Q_SIGNALS:
- void iapStateChanged(const QString& iapid, uint icd_connection_state);
-
-private Q_SLOTS:
- void finishAsyncConfigurationUpdate();
- void asyncUpdateConfigurationsSlot(QDBusMessage msg);
- void connectionStateSignalsSlot(QDBusMessage msg);
- void icdServiceOwnerChanged(const QString &serviceName, const QString &oldOwner,
- const QString &newOwner);
-
-private:
- void startListeningStateSignalsForAllConnections();
- void doRequestUpdate(QList<Maemo::IcdScanResult> scanned = QList<Maemo::IcdScanResult>());
- void cancelAsyncConfigurationUpdate();
- void getIcdInitialState();
- bool ensureDBusConnection();
-
-private:
- IapMonitor *iapMonitor;
- QDBusInterface *m_dbusInterface;
- QTimer m_scanTimer;
- QString m_onlineIapId;
- QStringList m_typesToBeScanned;
- QList<Maemo::IcdScanResult> m_scanResult;
-
- QDBusServiceWatcher *m_icdServiceWatcher;
-
- bool firstUpdate;
- bool m_scanGoingOn;
-};
-
-QT_END_NAMESPACE
-
-#endif // QICDENGINE_H
diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp
deleted file mode 100644
index f08d8bf363..0000000000
--- a/src/plugins/bearer/icd/qnetworksession_impl.cpp
+++ /dev/null
@@ -1,1072 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qnetworksession_impl.h"
-#include "qicdengine.h"
-
-#include <QHash>
-
-#include <maemo_icd.h>
-#include <iapconf.h>
-#include <proxyconf.h>
-
-#include <ifaddrs.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-QDBusArgument &operator<<(QDBusArgument &argument,
- const ICd2DetailsDBusStruct &icd2)
-{
- argument.beginStructure();
-
- argument << icd2.serviceType;
- argument << icd2.serviceAttributes;
- argument << icd2.setviceId;
- argument << icd2.networkType;
- argument << icd2.networkAttributes;
- argument << icd2.networkId;
-
- argument.endStructure();
-
- return argument;
-}
-
-const QDBusArgument &operator>>(const QDBusArgument &argument,
- ICd2DetailsDBusStruct &icd2)
-{
- argument.beginStructure();
-
- argument >> icd2.serviceType;
- argument >> icd2.serviceAttributes;
- argument >> icd2.setviceId;
- argument >> icd2.networkType;
- argument >> icd2.networkAttributes;
- argument >> icd2.networkId;
-
- argument.endStructure();
-
- return argument;
-}
-
-const QDBusArgument &operator>>(const QDBusArgument &argument,
- ICd2DetailsList &detailsList)
-{
- argument.beginArray();
- detailsList.clear();
-
- while (!argument.atEnd()) {
- ICd2DetailsDBusStruct element;
- argument >> element;
- detailsList.append(element);
- }
-
- argument.endArray();
- return argument;
-}
-
-QDBusArgument &operator<<(QDBusArgument &argument,
- const ICd2DetailsList &detailsList)
-{
- argument.beginArray(qMetaTypeId<ICd2DetailsDBusStruct>());
-
- for (int i = 0; i < detailsList.count(); ++i)
- argument << detailsList[i];
-
- argument.endArray();
-
- return argument;
-}
-
-static QHash<QString, QVariant> properties;
-
-static QString get_network_interface();
-
-void QNetworkSessionPrivateImpl::iapStateChanged(const QString& iapid, uint icd_connection_state)
-{
-
- if (((publicConfig.type() == QNetworkConfiguration::UserChoice) &&
- (activeConfig.identifier() == iapid)) ||
- (publicConfig.identifier() == iapid)) {
- switch (icd_connection_state) {
- case ICD_STATE_CONNECTING:
- updateState(QNetworkSession::Connecting);
- break;
- case ICD_STATE_CONNECTED:
- updateState(QNetworkSession::Connected);
- break;
- case ICD_STATE_DISCONNECTING:
- updateState(QNetworkSession::Closing);
- break;
- case ICD_STATE_DISCONNECTED:
- updateState(QNetworkSession::Disconnected);
- break;
- default:
- break;
- }
- }
- if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
- updateIdentifier(iapid);
- }
-}
-
-void QNetworkSessionPrivateImpl::cleanupSession(void)
-{
- QObject::disconnect(q, SIGNAL(stateChanged(QNetworkSession::State)),
- this, SLOT(updateProxies(QNetworkSession::State)));
-}
-
-
-void QNetworkSessionPrivateImpl::updateState(QNetworkSession::State newState)
-{
- if (newState != state) {
- if (newState == QNetworkSession::Disconnected) {
- if (isOpen) {
- // The Session was aborted by the user or system
- lastError = QNetworkSession::SessionAbortedError;
- emit QNetworkSessionPrivate::error(lastError);
- emit closed();
- }
- if (m_stopTimer.isActive()) {
- // Session was closed by calling stop()
- m_stopTimer.stop();
- }
- isOpen = false;
- opened = false;
- currentNetworkInterface.clear();
- if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
- copyConfig(publicConfig, activeConfig);
- IcdNetworkConfigurationPrivate *icdConfig =
- toIcdConfig(privateConfiguration(activeConfig));
-
- icdConfig->mutex.lock();
- icdConfig->state = QNetworkConfiguration::Defined;
- icdConfig->mutex.unlock();
- } else {
- if (!activeConfig.isValid()) {
- // Active configuration (IAP) was removed from system
- // => Connection was disconnected and configuration became
- // invalid
- // => Also Session state must be changed to invalid
- newState = QNetworkSession::Invalid;
- }
- }
- } else if (newState == QNetworkSession::Connected) {
- if (opened) {
- isOpen = true;
- }
- if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
- IcdNetworkConfigurationPrivate *icdConfig =
- toIcdConfig(privateConfiguration(activeConfig));
-
- icdConfig->mutex.lock();
- icdConfig->state = QNetworkConfiguration::Active;
- icdConfig->type = QNetworkConfiguration::InternetAccessPoint;
- icdConfig->mutex.unlock();
- }
-
- IcdNetworkConfigurationPrivate *icdConfig =
- toIcdConfig(privateConfiguration(publicConfig));
-
- icdConfig->mutex.lock();
- icdConfig->state = QNetworkConfiguration::Active;
- icdConfig->mutex.unlock();
- }
-
- if (newState != state) {
- state = newState;
- emit stateChanged(newState);
- }
- }
-}
-
-
-void QNetworkSessionPrivateImpl::updateIdentifier(const QString &newId)
-{
- if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
- IcdNetworkConfigurationPrivate *icdConfig =
- toIcdConfig(privateConfiguration(activeConfig));
-
- icdConfig->mutex.lock();
- icdConfig->network_attrs |= ICD_NW_ATTR_IAPNAME;
- icdConfig->id = newId;
- icdConfig->mutex.unlock();
- } else {
- IcdNetworkConfigurationPrivate *icdConfig =
- toIcdConfig(privateConfiguration(publicConfig));
-
- icdConfig->mutex.lock();
- icdConfig->network_attrs |= ICD_NW_ATTR_IAPNAME;
- if (icdConfig->id != newId)
- icdConfig->id = newId;
- icdConfig->mutex.unlock();
- }
-}
-
-
-QNetworkSessionPrivateImpl::Statistics QNetworkSessionPrivateImpl::getStatistics() const
-{
- /* This could be also implemented by using the Maemo::Icd::statistics()
- * that gets the statistics data for a specific IAP. Change if
- * necessary.
- */
- Maemo::Icd icd;
- QList<Maemo::IcdStatisticsResult> stats_results;
- Statistics stats = { 0, 0, 0};
-
- if (!icd.statistics(stats_results))
- return stats;
-
- foreach (const Maemo::IcdStatisticsResult &res, stats_results) {
- if (res.params.network_attrs & ICD_NW_ATTR_IAPNAME) {
- /* network_id is the IAP UUID */
- if (QString(res.params.network_id.data()) == activeConfig.identifier()) {
- stats.txData = res.bytes_sent;
- stats.rxData = res.bytes_received;
- stats.activeTime = res.time_active;
- }
- } else {
- /* We probably will never get to this branch */
- IcdNetworkConfigurationPrivate *icdConfig =
- toIcdConfig(privateConfiguration(activeConfig));
-
- icdConfig->mutex.lock();
- if (res.params.network_id == icdConfig->network_id) {
- stats.txData = res.bytes_sent;
- stats.rxData = res.bytes_received;
- stats.activeTime = res.time_active;
- }
- icdConfig->mutex.unlock();
- }
- }
-
- return stats;
-}
-
-
-quint64 QNetworkSessionPrivateImpl::bytesWritten() const
-{
- return getStatistics().txData;
-}
-
-quint64 QNetworkSessionPrivateImpl::bytesReceived() const
-{
- return getStatistics().rxData;
-}
-
-quint64 QNetworkSessionPrivateImpl::activeTime() const
-{
- return getStatistics().activeTime;
-}
-
-
-QNetworkConfiguration& QNetworkSessionPrivateImpl::copyConfig(QNetworkConfiguration &fromConfig,
- QNetworkConfiguration &toConfig,
- bool deepCopy)
-{
- IcdNetworkConfigurationPrivate *cpPriv;
- if (deepCopy) {
- cpPriv = new IcdNetworkConfigurationPrivate;
- setPrivateConfiguration(toConfig, QNetworkConfigurationPrivatePointer(cpPriv));
- } else {
- cpPriv = toIcdConfig(privateConfiguration(toConfig));
- }
-
- IcdNetworkConfigurationPrivate *fromPriv = toIcdConfig(privateConfiguration(fromConfig));
-
- QMutexLocker toLocker(&cpPriv->mutex);
- QMutexLocker fromLocker(&fromPriv->mutex);
-
- cpPriv->name = fromPriv->name;
- cpPriv->isValid = fromPriv->isValid;
- // Note that we do not copy id field here as the publicConfig does
- // not contain a valid IAP id.
- cpPriv->state = fromPriv->state;
- cpPriv->type = fromPriv->type;
- cpPriv->roamingSupported = fromPriv->roamingSupported;
- cpPriv->purpose = fromPriv->purpose;
- cpPriv->network_id = fromPriv->network_id;
- cpPriv->iap_type = fromPriv->iap_type;
- cpPriv->bearerType = fromPriv->bearerType;
- cpPriv->network_attrs = fromPriv->network_attrs;
- cpPriv->service_type = fromPriv->service_type;
- cpPriv->service_id = fromPriv->service_id;
- cpPriv->service_attrs = fromPriv->service_attrs;
-
- return toConfig;
-}
-
-
-/* This is called by QNetworkSession constructor and it updates the current
- * state of the configuration.
- */
-void QNetworkSessionPrivateImpl::syncStateWithInterface()
-{
- /* Initially we are not active although the configuration might be in
- * connected state.
- */
- isOpen = false;
- opened = false;
-
- connect(engine, SIGNAL(iapStateChanged(const QString&, uint)),
- this, SLOT(iapStateChanged(const QString&, uint)));
-
- QObject::connect(q, SIGNAL(stateChanged(QNetworkSession::State)), this, SLOT(updateProxies(QNetworkSession::State)));
-
- state = QNetworkSession::Invalid;
- lastError = QNetworkSession::UnknownSessionError;
-
- switch (publicConfig.type()) {
- case QNetworkConfiguration::InternetAccessPoint:
- activeConfig = publicConfig;
- break;
- case QNetworkConfiguration::ServiceNetwork:
- serviceConfig = publicConfig;
- break;
- case QNetworkConfiguration::UserChoice:
- // active config will contain correct data after open() has succeeded
- copyConfig(publicConfig, activeConfig);
-
- /* We create new configuration that holds the actual configuration
- * returned by icd. This way publicConfig still contains the
- * original user specified configuration.
- *
- * Note that the new activeConfig configuration is not inserted
- * to configurationManager as manager class will get the newly
- * connected configuration from gconf when the IAP is saved.
- * This configuration manager update is done by IapMonitor class.
- * If the ANY connection fails in open(), then the configuration
- * data is not saved to gconf and will not be added to
- * configuration manager IAP list.
- */
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug()<<"New configuration created for" << publicConfig.identifier();
-#endif
- break;
- default:
- /* Invalid configuration, no point continuing */
- return;
- }
-
- if (!activeConfig.isValid())
- return;
-
- /* Get the initial state from icd */
- Maemo::Icd icd;
- QList<Maemo::IcdStateResult> state_results;
-
- /* Update the active config from first connection, this is ok as icd
- * supports only one connection anyway.
- */
- if (icd.state(state_results) && !state_results.isEmpty()) {
- /* If we did not get full state back, then we are not
- * connected and can skip the next part.
- */
- if (!(state_results.first().params.network_attrs == 0 &&
- state_results.first().params.network_id.isEmpty())) {
-
- /* If we try to connect to specific IAP and we get results back
- * that tell the icd is actually connected to another IAP,
- * then do not update current state etc.
- */
- if (publicConfig.type() == QNetworkConfiguration::UserChoice ||
- publicConfig.identifier() == state_results.first().params.network_id) {
- switch (state_results.first().state) {
- case ICD_STATE_DISCONNECTED:
- state = QNetworkSession::Disconnected;
- if (QNetworkConfigurationPrivatePointer ptr = privateConfiguration(activeConfig)) {
- ptr->mutex.lock();
- ptr->isValid = true;
- ptr->mutex.unlock();
- }
- break;
- case ICD_STATE_CONNECTING:
- state = QNetworkSession::Connecting;
- if (QNetworkConfigurationPrivatePointer ptr = privateConfiguration(activeConfig)) {
- ptr->mutex.lock();
- ptr->isValid = true;
- ptr->mutex.unlock();
- }
- break;
- case ICD_STATE_CONNECTED:
- {
- if (!state_results.first().error.isEmpty())
- break;
-
- const QString id = state_results.first().params.network_id;
-
- QNetworkConfiguration config = manager.configurationFromIdentifier(id);
- if (config.isValid()) {
- //we don't want the copied data if the config is already known by the manager
- //just reuse it so that existing references to the old data get the same update
- setPrivateConfiguration(activeConfig, privateConfiguration(config));
- }
-
- QNetworkConfigurationPrivatePointer ptr = privateConfiguration(activeConfig);
-
- QMutexLocker configLocker(&ptr->mutex);
-
- state = QNetworkSession::Connected;
- toIcdConfig(ptr)->network_id = state_results.first().params.network_id;
- ptr->id = toIcdConfig(ptr)->network_id;
- toIcdConfig(ptr)->network_attrs = state_results.first().params.network_attrs;
- toIcdConfig(ptr)->iap_type = state_results.first().params.network_type;
- ptr->bearerType = bearerTypeFromIapType(toIcdConfig(ptr)->iap_type);
- toIcdConfig(ptr)->service_type = state_results.first().params.service_type;
- toIcdConfig(ptr)->service_id = state_results.first().params.service_id;
- toIcdConfig(ptr)->service_attrs = state_results.first().params.service_attrs;
- ptr->type = QNetworkConfiguration::InternetAccessPoint;
- ptr->state = QNetworkConfiguration::Active;
- ptr->isValid = true;
- currentNetworkInterface = get_network_interface();
-
- Maemo::IAPConf iap_name(ptr->id);
- QString name_value = iap_name.value("name").toString();
- if (!name_value.isEmpty())
- ptr->name = name_value;
- else
- ptr->name = ptr->id;
-
- const QString identifier = ptr->id;
-
- configLocker.unlock();
-
- // Add the new active configuration to manager or update the old config
- if (!engine->hasIdentifier(identifier))
- engine->addSessionConfiguration(ptr);
- else
- engine->changedSessionConfiguration(ptr);
- }
- break;
-
- case ICD_STATE_DISCONNECTING:
- state = QNetworkSession::Closing;
- if (QNetworkConfigurationPrivatePointer ptr = privateConfiguration(activeConfig)) {
- ptr->mutex.lock();
- ptr->isValid = true;
- ptr->mutex.unlock();
- }
- break;
- default:
- break;
- }
- }
- } else {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "status_req tells icd is not connected";
-#endif
- }
- } else {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "status_req did not return any results from icd";
-#endif
- }
-
- networkConfigurationsChanged();
-}
-
-
-void QNetworkSessionPrivateImpl::networkConfigurationsChanged()
-{
- if (serviceConfig.isValid())
- updateStateFromServiceNetwork();
- else
- updateStateFromActiveConfig();
-}
-
-
-void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork()
-{
- QNetworkSession::State oldState = state;
-
- foreach (const QNetworkConfiguration &config, serviceConfig.children()) {
- if ((config.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active)
- continue;
-
- if (activeConfig != config) {
- activeConfig = config;
- emit newConfigurationActivated();
- }
-
- state = QNetworkSession::Connected;
- if (state != oldState)
- emit stateChanged(state);
-
- return;
- }
-
- if (serviceConfig.children().isEmpty())
- state = QNetworkSession::NotAvailable;
- else
- state = QNetworkSession::Disconnected;
-
- if (state != oldState)
- emit stateChanged(state);
-}
-
-
-void QNetworkSessionPrivateImpl::clearConfiguration(QNetworkConfiguration &config)
-{
- IcdNetworkConfigurationPrivate *icdConfig = toIcdConfig(privateConfiguration(config));
-
- QMutexLocker locker(&icdConfig->mutex);
-
- icdConfig->network_id.clear();
- icdConfig->iap_type.clear();
- icdConfig->network_attrs = 0;
- icdConfig->service_type.clear();
- icdConfig->service_id.clear();
- icdConfig->service_attrs = 0;
-}
-
-
-void QNetworkSessionPrivateImpl::updateStateFromActiveConfig()
-{
- QNetworkSession::State oldState = state;
-
- bool newActive = false;
-
- if (!activeConfig.isValid())
- return;
-
- if (!activeConfig.isValid()) {
- state = QNetworkSession::Invalid;
- clearConfiguration(activeConfig);
- } else if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
- state = QNetworkSession::Connected;
- newActive = opened;
- } else if ((activeConfig.state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) {
- state = QNetworkSession::Disconnected;
- } else if ((activeConfig.state() & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) {
- state = QNetworkSession::NotAvailable;
- } else if ((activeConfig.state() & QNetworkConfiguration::Undefined) == QNetworkConfiguration::Undefined) {
- state = QNetworkSession::NotAvailable;
- }
-
- bool oldActive = isOpen;
- isOpen = newActive;
-
- if (!oldActive && isOpen)
- emit quitPendingWaitsForOpened();
-
- if (oldActive && !isOpen)
- emit closed();
-
- if (oldState != state) {
- emit stateChanged(state);
-
- if (state == QNetworkSession::Disconnected && oldActive) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- //qDebug()<<"session aborted error emitted for"<<activeConfig.identifier();
-#endif
- lastError = QNetworkSession::SessionAbortedError;
- emit QNetworkSessionPrivate::error(lastError);
- }
- }
-
-#ifdef BEARER_MANAGEMENT_DEBUG
- //qDebug()<<"oldState ="<<oldState<<" state ="<<state<<" oldActive ="<<oldActive<<" newActive ="<<newActive<<" opened ="<<opened;
-#endif
-}
-
-static QString get_network_interface()
-{
- Maemo::Icd icd;
- QList<Maemo::IcdAddressInfoResult> addr_results;
- uint ret;
- QString iface;
-
- ret = icd.addrinfo(addr_results);
- if (ret == 0) {
- /* No results */
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "Cannot get addrinfo from icd, are you connected or is icd running?";
-#endif
- return iface;
- }
-
- if (addr_results.first().ip_info.isEmpty())
- return QString();
-
- QByteArray data = addr_results.first().ip_info.first().address.toAscii();
- struct in_addr addr;
- if (inet_aton(data.constData(), &addr) == 0) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "address" << data.constData() << "invalid";
-#endif
- return iface;
- }
-
- struct ifaddrs *ifaddr, *ifa;
- int family;
-
- if (getifaddrs(&ifaddr) == -1) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "getifaddrs() failed";
-#endif
- return iface;
- }
-
- for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
- if (ifa->ifa_addr) {
- family = ifa->ifa_addr->sa_family;
- if (family != AF_INET) {
- continue; /* Currently only IPv4 is supported by icd dbus interface */
- }
- if (((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr == addr.s_addr) {
- iface = QString(ifa->ifa_name);
- break;
- }
- }
- }
-
- freeifaddrs(ifaddr);
- return iface;
-}
-
-
-void QNetworkSessionPrivateImpl::open()
-{
- if (m_stopTimer.isActive()) {
- m_stopTimer.stop();
- }
- if (!publicConfig.isValid()) {
- lastError = QNetworkSession::InvalidConfigurationError;
- emit QNetworkSessionPrivate::error(lastError);
- return;
- }
- if (serviceConfig.isValid()) {
- lastError = QNetworkSession::OperationNotSupportedError;
- emit QNetworkSessionPrivate::error(lastError);
- } else if (!opened) {
- if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
- /* Caller is trying to connect to default IAP.
- * At this time we will not know the IAP details so we just
- * connect and update the active config when the IAP is
- * connected.
- */
- opened = true;
- state = QNetworkSession::Connecting;
- emit stateChanged(state);
- QTimer::singleShot(0, this, SLOT(do_open()));
- return;
- }
-
- /* User is connecting to one specific IAP. If that IAP is not
- * in discovered state we cannot continue.
- */
- if ((activeConfig.state() & QNetworkConfiguration::Discovered) !=
- QNetworkConfiguration::Discovered) {
- lastError =QNetworkSession::InvalidConfigurationError;
- emit QNetworkSessionPrivate::error(lastError);
- return;
- }
- opened = true;
-
- if ((activeConfig.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) {
- state = QNetworkSession::Connecting;
- emit stateChanged(state);
- QTimer::singleShot(0, this, SLOT(do_open()));
- return;
- }
- isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active;
- if (isOpen)
- emit quitPendingWaitsForOpened();
- } else {
- /* We seem to be active so inform caller */
- emit quitPendingWaitsForOpened();
- }
-}
-
-void QNetworkSessionPrivateImpl::do_open()
-{
- icd_connection_flags flags = connectFlags;
- QString iap = publicConfig.identifier();
-
- if (state == QNetworkSession::Connected) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "Already connected to" << activeConfig.identifier();
-#endif
- emit stateChanged(QNetworkSession::Connected);
- emit quitPendingWaitsForOpened();
- return;
- }
-
- if (publicConfig.type() == QNetworkConfiguration::UserChoice)
- config = activeConfig;
- else
- config = publicConfig;
-
- if (iap == OSSO_IAP_ANY) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "connecting to default IAP" << iap;
-#endif
- m_connectRequestTimer.start(ICD_LONG_CONNECT_TIMEOUT);
- m_dbusInterface->asyncCall(ICD_DBUS_API_CONNECT_REQ, (uint)flags); // Return value ignored
- m_asynchCallActive = true;
- } else {
- IcdNetworkConfigurationPrivate *icdConfig = toIcdConfig(privateConfiguration(config));
-
- icdConfig->mutex.lock();
- ICd2DetailsDBusStruct icd2;
- icd2.serviceType = icdConfig->service_type;
- icd2.serviceAttributes = icdConfig->service_attrs;
- icd2.setviceId = icdConfig->service_id;
- icd2.networkType = icdConfig->iap_type;
- icd2.networkAttributes = icdConfig->network_attrs;
- if (icdConfig->network_attrs & ICD_NW_ATTR_IAPNAME) {
- icd2.networkId = QByteArray(iap.toLatin1());
- } else {
- icd2.networkId = icdConfig->network_id;
- }
- icdConfig->mutex.unlock();
-
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("connecting to %s/%s/0x%x/%s/0x%x/%s",
- icd2.networkId.data(),
- icd2.networkType.toAscii().constData(),
- icd2.networkAttributes,
- icd2.serviceType.toAscii().constData(),
- icd2.serviceAttributes,
- icd2.setviceId.toAscii().constData());
-#endif
-
- ICd2DetailsList paramArray;
- paramArray.append(icd2);
- m_connectRequestTimer.start(ICD_LONG_CONNECT_TIMEOUT);
- m_dbusInterface->asyncCall(ICD_DBUS_API_CONNECT_REQ, (uint)flags, QVariant::fromValue(paramArray)); // Return value ignored
- m_asynchCallActive = true;
- }
-}
-
-void QNetworkSessionPrivateImpl::stateChange(const QDBusMessage& rep)
-{
- if (m_asynchCallActive == true) {
- if (m_connectRequestTimer.isActive())
- m_connectRequestTimer.stop();
- m_asynchCallActive = false;
-
- QString result = rep.arguments().at(5).toString(); // network id or empty string
- QString connected_iap = result;
- if (connected_iap.isEmpty()) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "connect to"<< publicConfig.identifier() << "failed, result is empty";
-#endif
- updateState(QNetworkSession::Disconnected);
- emit QNetworkSessionPrivate::error(QNetworkSession::SessionAbortedError);
- if (publicConfig.type() == QNetworkConfiguration::UserChoice)
- copyConfig(publicConfig, activeConfig);
- return;
- }
-
- /* If the user tried to connect to some specific connection (foo)
- * and we were already connected to some other connection (bar),
- * then we cannot activate this session although icd has a valid
- * connection to somewhere.
- */
- if ((publicConfig.type() != QNetworkConfiguration::UserChoice) &&
- (connected_iap != config.identifier())) {
- updateState(QNetworkSession::Disconnected);
- emit QNetworkSessionPrivate::error(QNetworkSession::UnknownSessionError);
- return;
- }
-
- IcdNetworkConfigurationPrivate *icdConfig = toIcdConfig(privateConfiguration(config));
-
- /* Did we connect to non saved IAP? */
- icdConfig->mutex.lock();
- if (!(icdConfig->network_attrs & ICD_NW_ATTR_IAPNAME)) {
- /* Because the connection succeeded, the IAP is now known.
- */
- icdConfig->network_attrs |= ICD_NW_ATTR_IAPNAME;
- icdConfig->id = connected_iap;
- }
-
- /* User might have changed the IAP name when a new IAP was saved */
- Maemo::IAPConf iap_name(icdConfig->id);
- QString name = iap_name.value("name").toString();
- if (!name.isEmpty())
- icdConfig->name = name;
-
- icdConfig->iap_type = rep.arguments().at(3).toString(); // connect_result.connect.network_type;
- icdConfig->bearerType = bearerTypeFromIapType(icdConfig->iap_type);
- icdConfig->isValid = true;
- icdConfig->state = QNetworkConfiguration::Active;
- icdConfig->type = QNetworkConfiguration::InternetAccessPoint;
-
- icdConfig->mutex.unlock();
-
- startTime = QDateTime::currentDateTime();
- updateState(QNetworkSession::Connected);
- //currentNetworkInterface = get_network_interface();
-#ifdef BEARER_MANAGEMENT_DEBUG
- //qDebug() << "connected to" << result << config.name() << "at" << currentNetworkInterface;
-#endif
-
- /* We first check if the configuration already exists in the manager
- * and if it is not found there, we then insert it. Note that this
- * is only done for user choice config only because it can be missing
- * from config manager list.
- */
- if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
- if (!engine->hasIdentifier(result)) {
- engine->addSessionConfiguration(privateConfiguration(config));
- } else {
- QNetworkConfigurationPrivatePointer priv = engine->configuration(result);
- QNetworkConfiguration reference;
- setPrivateConfiguration(reference, priv);
- copyConfig(config, reference, false);
- privateConfiguration(reference)->id = result; // Note: Id was not copied in copyConfig() function
- config = reference;
- activeConfig = reference;
- engine->changedSessionConfiguration(privateConfiguration(config));
-
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug()<<"Existing configuration"<<result<<"updated in manager in open";
-#endif
- }
- }
-
- emit quitPendingWaitsForOpened();
- }
-}
-
-void QNetworkSessionPrivateImpl::connectTimeout()
-{
- updateState(QNetworkSession::Disconnected);
- if (publicConfig.type() == QNetworkConfiguration::UserChoice)
- copyConfig(publicConfig, activeConfig);
- emit QNetworkSessionPrivate::error(QNetworkSession::UnknownSessionError);
-}
-
-void QNetworkSessionPrivateImpl::close()
-{
- if (m_connectRequestTimer.isActive())
- m_connectRequestTimer.stop();
-
- if (serviceConfig.isValid()) {
- lastError = QNetworkSession::OperationNotSupportedError;
- emit QNetworkSessionPrivate::error(lastError);
- } else if (isOpen) {
- if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
- // We will not wait any disconnect from icd as it might never come
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "closing session" << publicConfig.identifier();
-#endif
- state = QNetworkSession::Closing;
- emit stateChanged(state);
-
- // we fake a disconnection, session error is sent
- updateState(QNetworkSession::Disconnected);
-
- opened = false;
- isOpen = false;
-
- m_dbusInterface->call(ICD_DBUS_API_DISCONNECT_REQ, ICD_CONNECTION_FLAG_APPLICATION_EVENT);
- startTime = QDateTime();
- } else {
- opened = false;
- isOpen = false;
- emit closed();
- }
- }
-}
-
-
-void QNetworkSessionPrivateImpl::stop()
-{
- if (m_connectRequestTimer.isActive())
- m_connectRequestTimer.stop();
-
- if (serviceConfig.isValid()) {
- lastError = QNetworkSession::OperationNotSupportedError;
- emit QNetworkSessionPrivate::error(lastError);
- } else {
- if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "stopping session" << publicConfig.identifier();
-#endif
- state = QNetworkSession::Closing;
- emit stateChanged(state);
-
- // we fake a disconnection, a session error is sent also
- updateState(QNetworkSession::Disconnected);
-
- opened = false;
- isOpen = false;
-
- m_dbusInterface->call(ICD_DBUS_API_DISCONNECT_REQ, ICD_CONNECTION_FLAG_APPLICATION_EVENT);
- startTime = QDateTime();
- } else {
- opened = false;
- isOpen = false;
- emit closed();
- }
- }
-}
-
-void QNetworkSessionPrivateImpl::finishStopBySendingClosedSignal()
-{
- if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
- state = QNetworkSession::Connected;
- emit stateChanged(state);
- }
-
- emit closed();
-}
-
-void QNetworkSessionPrivateImpl::migrate()
-{
-}
-
-
-void QNetworkSessionPrivateImpl::accept()
-{
-}
-
-
-void QNetworkSessionPrivateImpl::ignore()
-{
-}
-
-
-void QNetworkSessionPrivateImpl::reject()
-{
-}
-
-#ifndef QT_NO_NETWORKINTERFACE
-QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const
-{
- if (!publicConfig.isValid() || state != QNetworkSession::Connected)
- return QNetworkInterface();
-
- if (currentNetworkInterface.isEmpty())
- return QNetworkInterface();
-
- return QNetworkInterface::interfaceFromName(currentNetworkInterface);
-}
-#endif
-
-void QNetworkSessionPrivateImpl::setSessionProperty(const QString& key, const QVariant& value)
-{
- if (value.isValid()) {
- properties.insert(key, value);
-
- if (key == "ConnectInBackground") {
- bool v = value.toBool();
- if (v)
- connectFlags = ICD_CONNECTION_FLAG_APPLICATION_EVENT;
- else
- connectFlags = ICD_CONNECTION_FLAG_USER_EVENT;
- }
- } else {
- properties.remove(key);
-
- /* Set default value when property is removed */
- if (key == "ConnectInBackground")
- connectFlags = ICD_CONNECTION_FLAG_USER_EVENT;
- }
-}
-
-
-QVariant QNetworkSessionPrivateImpl::sessionProperty(const QString& key) const
-{
- return properties.value(key);
-}
-
-
-QString QNetworkSessionPrivateImpl::errorString() const
-{
- QString errorStr;
- switch(q->error()) {
- case QNetworkSession::RoamingError:
- errorStr = QNetworkSessionPrivateImpl::tr("Roaming error");
- break;
- case QNetworkSession::SessionAbortedError:
- errorStr = QNetworkSessionPrivateImpl::tr("Session aborted by user or system");
- break;
- case QNetworkSession::InvalidConfigurationError:
- errorStr = QNetworkSessionPrivateImpl::tr("The specified configuration cannot be used.");
- break;
- default:
- case QNetworkSession::UnknownSessionError:
- errorStr = QNetworkSessionPrivateImpl::tr("Unidentified Error");
- break;
- }
- return errorStr;
-}
-
-
-QNetworkSession::SessionError QNetworkSessionPrivateImpl::error() const
-{
- return QNetworkSession::UnknownSessionError;
-}
-
-void QNetworkSessionPrivateImpl::updateProxies(QNetworkSession::State newState)
-{
- if ((newState == QNetworkSession::Connected) &&
- (newState != currentState))
- updateProxyInformation();
- else if ((newState == QNetworkSession::Disconnected) &&
- (currentState == QNetworkSession::Closing))
- clearProxyInformation();
-
- currentState = newState;
-}
-
-
-void QNetworkSessionPrivateImpl::updateProxyInformation()
-{
- Maemo::ProxyConf::update();
-}
-
-
-void QNetworkSessionPrivateImpl::clearProxyInformation()
-{
- Maemo::ProxyConf::clear();
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/plugins/bearer/icd/qnetworksession_impl.h b/src/plugins/bearer/icd/qnetworksession_impl.h
deleted file mode 100644
index b47396b8e1..0000000000
--- a/src/plugins/bearer/icd/qnetworksession_impl.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNETWORKSESSION_IMPL_H
-#define QNETWORKSESSION_IMPL_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtNetwork/private/qnetworksession_p.h>
-#include <QtNetwork/qnetworkconfigmanager.h>
-
-#include <QtCore/qdatetime.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/quuid.h>
-
-#include <QtDBus/qdbusconnection.h>
-#include <QtDBus/qdbusinterface.h>
-#include <QtDBus/qdbusmessage.h>
-#include <QtDBus/qdbusmetatype.h>
-
-#include <icd/dbus_api.h>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-class QIcdEngine;
-
-struct ICd2DetailsDBusStruct
-{
- QString serviceType;
- uint serviceAttributes;
- QString setviceId;
- QString networkType;
- uint networkAttributes;
- QByteArray networkId;
-};
-
-typedef QList<ICd2DetailsDBusStruct> ICd2DetailsList;
-
-class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate
-{
- Q_OBJECT
-
-public:
- QNetworkSessionPrivateImpl(QIcdEngine *engine)
- : engine(engine),
- connectFlags(ICD_CONNECTION_FLAG_USER_EVENT),
- currentState(QNetworkSession::Invalid),
- m_asynchCallActive(false)
- {
- m_stopTimer.setSingleShot(true);
- connect(&m_stopTimer, SIGNAL(timeout()), this, SLOT(finishStopBySendingClosedSignal()));
-
- QDBusConnection systemBus = QDBusConnection::connectToBus(
- QDBusConnection::SystemBus,
- QUuid::createUuid().toString());
-
- m_dbusInterface = new QDBusInterface(ICD_DBUS_API_INTERFACE,
- ICD_DBUS_API_PATH,
- ICD_DBUS_API_INTERFACE,
- systemBus,
- this);
-
- systemBus.connect(ICD_DBUS_API_INTERFACE,
- ICD_DBUS_API_PATH,
- ICD_DBUS_API_INTERFACE,
- ICD_DBUS_API_CONNECT_SIG,
- this,
- SLOT(stateChange(const QDBusMessage&)));
-
- qDBusRegisterMetaType<ICd2DetailsDBusStruct>();
- qDBusRegisterMetaType<ICd2DetailsList>();
-
- m_connectRequestTimer.setSingleShot(true);
- connect(&m_connectRequestTimer, SIGNAL(timeout()), this, SLOT(connectTimeout()));
- }
-
- ~QNetworkSessionPrivateImpl()
- {
- cleanupSession();
-
- QDBusConnection::disconnectFromBus(m_dbusInterface->connection().name());
- }
-
- //called by QNetworkSession constructor and ensures
- //that the state is immediately updated (w/o actually opening
- //a session). Also this function should take care of
- //notification hooks to discover future state changes.
- void syncStateWithInterface();
-
-#ifndef QT_NO_NETWORKINTERFACE
- QNetworkInterface currentInterface() const;
-#endif
- QVariant sessionProperty(const QString& key) const;
- void setSessionProperty(const QString& key, const QVariant& value);
-
- void open();
- void close();
- void stop();
-
- void migrate();
- void accept();
- void ignore();
- void reject();
-
- QString errorString() const; //must return translated string
- QNetworkSession::SessionError error() const;
-
- quint64 bytesWritten() const;
- quint64 bytesReceived() const;
- quint64 activeTime() const;
-
-private:
- void updateStateFromServiceNetwork();
- void updateStateFromActiveConfig();
-
-private Q_SLOTS:
- void do_open();
- void networkConfigurationsChanged();
- void iapStateChanged(const QString& iapid, uint icd_connection_state);
- void updateProxies(QNetworkSession::State newState);
- void finishStopBySendingClosedSignal();
- void stateChange(const QDBusMessage& rep);
- void connectTimeout();
-
-private:
- QNetworkConfigurationManager manager;
- QIcdEngine *engine;
-
- struct Statistics {
- quint64 txData;
- quint64 rxData;
- quint64 activeTime;
- };
-
- // The config set on QNetworkSession.
- QNetworkConfiguration config;
-
- QNetworkConfiguration& copyConfig(QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy = true);
- void clearConfiguration(QNetworkConfiguration &config);
-
- bool opened;
- icd_connection_flags connectFlags;
-
- QNetworkSession::SessionError lastError;
-
- QDateTime startTime;
- QString currentNetworkInterface;
- friend class IcdListener;
- void updateState(QNetworkSession::State);
- void updateIdentifier(const QString &newId);
- Statistics getStatistics() const;
- void cleanupSession(void);
-
- void updateProxyInformation();
- void clearProxyInformation();
- QNetworkSession::State currentState;
-
- QDBusInterface *m_dbusInterface;
-
- QTimer m_stopTimer;
-
- bool m_asynchCallActive;
- QTimer m_connectRequestTimer;
-};
-
-// Marshall the ICd2DetailsDBusStruct data into a D-Bus argument
-QDBusArgument &operator<<(QDBusArgument &argument, const ICd2DetailsDBusStruct &icd2);
-
-// Retrieve the ICd2DetailsDBusStruct data from the D-Bus argument
-const QDBusArgument &operator>>(const QDBusArgument &argument, ICd2DetailsDBusStruct &icd2);
-
-Q_DECLARE_METATYPE(ICd2DetailsDBusStruct);
-Q_DECLARE_METATYPE(ICd2DetailsList);
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
-
-#endif //QNETWORKSESSIONPRIVATE_H
-
diff --git a/src/plugins/bearer/icd/wlan-utils.h b/src/plugins/bearer/icd/wlan-utils.h
deleted file mode 100644
index b98ee7e64c..0000000000
--- a/src/plugins/bearer/icd/wlan-utils.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef WLAN_UTILS_H
-#define WLAN_UTILS_H
-
-/** Originally taken from: libicd-network-wlan-dev.h*/
-
-#include <glib.h>
-#include <dbus/dbus.h>
-#include <wlancond.h>
-#include <icd/network_api_defines.h>
-
-/* capability bits inside network attributes var */
-#define NWATTR_WPS_MASK 0x0000F000
-#define NWATTR_ALGORITHM_MASK 0x00000F00
-#define NWATTR_WPA2_MASK 0x00000080
-#define NWATTR_METHOD_MASK 0x00000078
-#define NWATTR_MODE_MASK 0x00000007
-
-#define CAP_LOCALMASK 0x0FFFE008
-
-/* how much to shift between capability and network attributes var */
-#define CAP_SHIFT_WPS 3
-#define CAP_SHIFT_ALGORITHM 20
-#define CAP_SHIFT_WPA2 1
-#define CAP_SHIFT_METHOD 1
-#define CAP_SHIFT_MODE 0
-#define CAP_SHIFT_ALWAYS_ONLINE 26
-
-/* ------------------------------------------------------------------------- */
-/* From combined to capability */
-static inline dbus_uint32_t nwattr2cap(guint nwattrs, dbus_uint32_t *cap)
-{
- guint oldval = *cap;
-
- *cap &= CAP_LOCALMASK; /* clear old capabilities */
- *cap |=
- ((nwattrs & ICD_NW_ATTR_ALWAYS_ONLINE) >> CAP_SHIFT_ALWAYS_ONLINE) |
- ((nwattrs & NWATTR_WPS_MASK) >> CAP_SHIFT_WPS) |
- ((nwattrs & NWATTR_ALGORITHM_MASK) << CAP_SHIFT_ALGORITHM) |
- ((nwattrs & NWATTR_WPA2_MASK) << CAP_SHIFT_WPA2) |
- ((nwattrs & NWATTR_METHOD_MASK) << CAP_SHIFT_METHOD) |
- (nwattrs & NWATTR_MODE_MASK);
-
- return oldval;
-}
-
-
-/* ------------------------------------------------------------------------- */
-/* From capability to combined */
-static inline guint cap2nwattr(dbus_uint32_t cap, guint *nwattrs)
-{
- guint oldval = *nwattrs;
-
- *nwattrs &= ~ICD_NW_ATTR_LOCALMASK; /* clear old capabilities */
- *nwattrs |=
-#ifdef WLANCOND_WPS_MASK
- ((cap & WLANCOND_WPS_MASK) << CAP_SHIFT_WPS) |
-#endif
- ((cap & (WLANCOND_ENCRYPT_ALG_MASK |
- WLANCOND_ENCRYPT_GROUP_ALG_MASK)) >> CAP_SHIFT_ALGORITHM)|
- ((cap & WLANCOND_ENCRYPT_WPA2_MASK) >> CAP_SHIFT_WPA2) |
- ((cap & WLANCOND_ENCRYPT_METHOD_MASK) >> CAP_SHIFT_METHOD) |
- (cap & WLANCOND_MODE_MASK);
-
- return oldval;
-}
-
-
-#endif
diff --git a/src/plugins/bearer/nativewifi/main.cpp b/src/plugins/bearer/nativewifi/main.cpp
index ce7d9063c2..5e9fb6ed7d 100644
--- a/src/plugins/bearer/nativewifi/main.cpp
+++ b/src/plugins/bearer/nativewifi/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/nativewifi/platformdefs.h b/src/plugins/bearer/nativewifi/platformdefs.h
index 41ff30a165..62ea55c6b2 100644
--- a/src/plugins/bearer/nativewifi/platformdefs.h
+++ b/src/plugins/bearer/nativewifi/platformdefs.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
index 48f5536eda..6bde5d46de 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h
index c38b43ad97..2307538028 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.h
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/networkmanager/main.cpp b/src/plugins/bearer/networkmanager/main.cpp
index 5377bb0d58..01932429b1 100644
--- a/src/plugins/bearer/networkmanager/main.cpp
+++ b/src/plugins/bearer/networkmanager/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index 43c1d28c9b..dd845314f5 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
index 24c170d52f..445c316627 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
index 8ca94b97d8..126d3da891 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
index e8fd0d0284..2c2f35a06c 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/networkmanager/qnmdbushelper.cpp b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp
index e66be4c51a..86b6376ca7 100644
--- a/src/plugins/bearer/networkmanager/qnmdbushelper.cpp
+++ b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/networkmanager/qnmdbushelper.h b/src/plugins/bearer/networkmanager/qnmdbushelper.h
index 0b84c5153a..93f141b7a6 100644
--- a/src/plugins/bearer/networkmanager/qnmdbushelper.h
+++ b/src/plugins/bearer/networkmanager/qnmdbushelper.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/nla/main.cpp b/src/plugins/bearer/nla/main.cpp
index 963fbaa1df..e70a3e381e 100644
--- a/src/plugins/bearer/nla/main.cpp
+++ b/src/plugins/bearer/nla/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp
index c155623140..a9ee4b4bb3 100644
--- a/src/plugins/bearer/nla/qnlaengine.cpp
+++ b/src/plugins/bearer/nla/qnlaengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h
index 72b3db8241..c0b6311f7d 100644
--- a/src/plugins/bearer/nla/qnlaengine.h
+++ b/src/plugins/bearer/nla/qnlaengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/platformdefs_win.h b/src/plugins/bearer/platformdefs_win.h
index 1d8a8426e1..a4c9bac11b 100644
--- a/src/plugins/bearer/platformdefs_win.h
+++ b/src/plugins/bearer/platformdefs_win.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/qbearerengine_impl.h b/src/plugins/bearer/qbearerengine_impl.h
index 6a61c1bee0..01bce7bf72 100644
--- a/src/plugins/bearer/qbearerengine_impl.h
+++ b/src/plugins/bearer/qbearerengine_impl.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp
index 4a14dcc990..ab0c44321e 100644
--- a/src/plugins/bearer/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/qnetworksession_impl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h
index a15ef9a44b..e022c7b7d2 100644
--- a/src/plugins/bearer/qnetworksession_impl.h
+++ b/src/plugins/bearer/qnetworksession_impl.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/cn/cn.pro b/src/plugins/codecs/cn/cn.pro
index fc2e94b5a6..11a3dd0e6c 100644
--- a/src/plugins/codecs/cn/cn.pro
+++ b/src/plugins/codecs/cn/cn.pro
@@ -12,5 +12,3 @@ SOURCES = qgb18030codec.cpp \
target.path += $$[QT_INSTALL_PLUGINS]/codecs
INSTALLS += target
-
-symbian:TARGET.UID3=0x2001E615
diff --git a/src/plugins/codecs/cn/main.cpp b/src/plugins/codecs/cn/main.cpp
index 11be817289..fb1e61a451 100644
--- a/src/plugins/codecs/cn/main.cpp
+++ b/src/plugins/codecs/cn/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/cn/qgb18030codec.cpp b/src/plugins/codecs/cn/qgb18030codec.cpp
index e647c5e78a..28d42e0983 100644
--- a/src/plugins/codecs/cn/qgb18030codec.cpp
+++ b/src/plugins/codecs/cn/qgb18030codec.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/cn/qgb18030codec.h b/src/plugins/codecs/cn/qgb18030codec.h
index 4aacc42c8e..492f59b295 100644
--- a/src/plugins/codecs/cn/qgb18030codec.h
+++ b/src/plugins/codecs/cn/qgb18030codec.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/jp/jp.pro b/src/plugins/codecs/jp/jp.pro
index 834ca31ad6..f2e51cd57d 100644
--- a/src/plugins/codecs/jp/jp.pro
+++ b/src/plugins/codecs/jp/jp.pro
@@ -23,5 +23,3 @@ unix {
target.path += $$[QT_INSTALL_PLUGINS]/codecs
INSTALLS += target
-
-symbian:TARGET.UID3=0x2001E614
diff --git a/src/plugins/codecs/jp/main.cpp b/src/plugins/codecs/jp/main.cpp
index 2891f55671..e4b22935db 100644
--- a/src/plugins/codecs/jp/main.cpp
+++ b/src/plugins/codecs/jp/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/jp/qeucjpcodec.cpp b/src/plugins/codecs/jp/qeucjpcodec.cpp
index 1154f443c4..4ff555220b 100644
--- a/src/plugins/codecs/jp/qeucjpcodec.cpp
+++ b/src/plugins/codecs/jp/qeucjpcodec.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/jp/qeucjpcodec.h b/src/plugins/codecs/jp/qeucjpcodec.h
index e40ba9506c..af02ed95e4 100644
--- a/src/plugins/codecs/jp/qeucjpcodec.h
+++ b/src/plugins/codecs/jp/qeucjpcodec.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/jp/qfontjpcodec.cpp b/src/plugins/codecs/jp/qfontjpcodec.cpp
index e73f67801b..8c9d78087c 100644
--- a/src/plugins/codecs/jp/qfontjpcodec.cpp
+++ b/src/plugins/codecs/jp/qfontjpcodec.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/jp/qfontjpcodec.h b/src/plugins/codecs/jp/qfontjpcodec.h
index 37940440db..1f577498fb 100644
--- a/src/plugins/codecs/jp/qfontjpcodec.h
+++ b/src/plugins/codecs/jp/qfontjpcodec.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/jp/qjiscodec.cpp b/src/plugins/codecs/jp/qjiscodec.cpp
index e9b3691174..99c756e859 100644
--- a/src/plugins/codecs/jp/qjiscodec.cpp
+++ b/src/plugins/codecs/jp/qjiscodec.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/jp/qjiscodec.h b/src/plugins/codecs/jp/qjiscodec.h
index eabbeca786..aaf02a90d0 100644
--- a/src/plugins/codecs/jp/qjiscodec.h
+++ b/src/plugins/codecs/jp/qjiscodec.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/jp/qjpunicode.cpp b/src/plugins/codecs/jp/qjpunicode.cpp
index 8e1c5e52c7..feb0f410c1 100644
--- a/src/plugins/codecs/jp/qjpunicode.cpp
+++ b/src/plugins/codecs/jp/qjpunicode.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/jp/qjpunicode.h b/src/plugins/codecs/jp/qjpunicode.h
index a0ff5a453e..069f49a137 100644
--- a/src/plugins/codecs/jp/qjpunicode.h
+++ b/src/plugins/codecs/jp/qjpunicode.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/jp/qsjiscodec.cpp b/src/plugins/codecs/jp/qsjiscodec.cpp
index 2a732ffc42..ac89b333c4 100644
--- a/src/plugins/codecs/jp/qsjiscodec.cpp
+++ b/src/plugins/codecs/jp/qsjiscodec.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/jp/qsjiscodec.h b/src/plugins/codecs/jp/qsjiscodec.h
index e61cc9136c..c56a103366 100644
--- a/src/plugins/codecs/jp/qsjiscodec.h
+++ b/src/plugins/codecs/jp/qsjiscodec.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/kr/cp949codetbl.h b/src/plugins/codecs/kr/cp949codetbl.h
index f54db8dc3f..25723c7999 100644
--- a/src/plugins/codecs/kr/cp949codetbl.h
+++ b/src/plugins/codecs/kr/cp949codetbl.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef CP949CODETBL_H
+#define CP494CODETBL_H
+
static const unsigned short cp949_icode_to_unicode[] = {
0xac02, 0xac03, 0xac05, 0xac06, 0xac0b, 0xac0c, 0xac0d, 0xac0e, 0xac0f, 0xac18, 0xac1e, 0xac1f, 0xac21, 0xac22, 0xac23,
0xac25, 0xac26, 0xac27, 0xac28, 0xac29, 0xac2a, 0xac2b, 0xac2e, 0xac32, 0xac33, 0xac34, 0xac35, 0xac36, 0xac37, 0xac3a,
@@ -630,3 +633,5 @@ static const unsigned short cp949_icode_to_unicode[] = {
0xd78e, 0xd78f, 0xd791, 0xd792, 0xd793, 0xd794, 0xd795, 0xd796, 0xd797, 0xd79a, 0xd79c, 0xd79e, 0xd79f, 0xd7a0, 0xd7a1,
0xd7a2, 0xd7a3
};
+
+#endif // CP494CODETBL_H
diff --git a/src/plugins/codecs/kr/kr.pro b/src/plugins/codecs/kr/kr.pro
index f5aea6554f..6c0ea3d415 100644
--- a/src/plugins/codecs/kr/kr.pro
+++ b/src/plugins/codecs/kr/kr.pro
@@ -16,5 +16,3 @@ wince*: {
target.path += $$[QT_INSTALL_PLUGINS]/codecs
INSTALLS += target
-
-symbian:TARGET.UID3=0x2001B2E5
diff --git a/src/plugins/codecs/kr/main.cpp b/src/plugins/codecs/kr/main.cpp
index 683dee3f74..16c49b6eea 100644
--- a/src/plugins/codecs/kr/main.cpp
+++ b/src/plugins/codecs/kr/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/kr/qeuckrcodec.cpp b/src/plugins/codecs/kr/qeuckrcodec.cpp
index ec6395adeb..979b9bb8bc 100644
--- a/src/plugins/codecs/kr/qeuckrcodec.cpp
+++ b/src/plugins/codecs/kr/qeuckrcodec.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/kr/qeuckrcodec.h b/src/plugins/codecs/kr/qeuckrcodec.h
index 0a86c274e8..d5be33e74b 100644
--- a/src/plugins/codecs/kr/qeuckrcodec.h
+++ b/src/plugins/codecs/kr/qeuckrcodec.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/tw/main.cpp b/src/plugins/codecs/tw/main.cpp
index cb2792f232..159752cc26 100644
--- a/src/plugins/codecs/tw/main.cpp
+++ b/src/plugins/codecs/tw/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/tw/qbig5codec.cpp b/src/plugins/codecs/tw/qbig5codec.cpp
index 9ec7c75220..f337dd8d8a 100644
--- a/src/plugins/codecs/tw/qbig5codec.cpp
+++ b/src/plugins/codecs/tw/qbig5codec.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/tw/qbig5codec.h b/src/plugins/codecs/tw/qbig5codec.h
index 495e378ef5..c5b649ef6f 100644
--- a/src/plugins/codecs/tw/qbig5codec.h
+++ b/src/plugins/codecs/tw/qbig5codec.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/codecs/tw/tw.pro b/src/plugins/codecs/tw/tw.pro
index f76cba4dbc..d63876c5d8 100644
--- a/src/plugins/codecs/tw/tw.pro
+++ b/src/plugins/codecs/tw/tw.pro
@@ -12,5 +12,3 @@ SOURCES = qbig5codec.cpp \
target.path += $$[QT_INSTALL_PLUGINS]/codecs
INSTALLS += target
-
-symbian:TARGET.UID3=0x2001B2E4
diff --git a/src/plugins/generic/linuxinput/main.cpp b/src/plugins/generic/linuxinput/main.cpp
index 20391901bf..d86fa12543 100644
--- a/src/plugins/generic/linuxinput/main.cpp
+++ b/src/plugins/generic/linuxinput/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/generic/linuxinput/qlinuxinput.cpp b/src/plugins/generic/linuxinput/qlinuxinput.cpp
index 943b213ce0..497ae7d3bf 100644
--- a/src/plugins/generic/linuxinput/qlinuxinput.cpp
+++ b/src/plugins/generic/linuxinput/qlinuxinput.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/generic/linuxinput/qlinuxinput.h b/src/plugins/generic/linuxinput/qlinuxinput.h
index b9475a1bf5..9f35397fd3 100644
--- a/src/plugins/generic/linuxinput/qlinuxinput.h
+++ b/src/plugins/generic/linuxinput/qlinuxinput.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/generic/touchscreen/README b/src/plugins/generic/touchscreen/README
index bed9016329..ac73f5f147 100644
--- a/src/plugins/generic/touchscreen/README
+++ b/src/plugins/generic/touchscreen/README
@@ -1,6 +1,8 @@
-Generic plug-in for evdev touch events
+Generic plug-in for evdev touch events.
-(a) Using as a QPA generic plug-in
+Tested with the following drivers: bcm5974, hid_magicmouse.
+
+(1) Using as a QPA generic plug-in
1. set up and connect the touch device
2. install libudev-dev or similar
@@ -18,26 +20,26 @@ screen. If this is not desired, pass force_window in the plugin
specification as shown in the example above. This will cause mapping
the touch surface to the active window instead.
-Only touch events are generated, mouse events are not. This is because
-on desktop the touch device will usually act as a single-point mouse
-replacement by default. For embedded systems the code could to be
-extended to generate also mouse events (by calling handleMouseEvent
-for the primary touch point for example).
+Only touch events are generated, mouse events are not. Be aware however
+that ignored touch events will generate a mouse event from the first
+touch point by default. See AA_SynthesizeMouseForUnhandledTouchEvents.
-(b) Using in a compositor
+(2) Using in a compositor
The classes (QTouchScreenHandler, QTouchScreenHandlerThread) are also
suitable for direct inclusion into an application, e.g. a Wayland
-compositor. The compositor will then usually register its own
+compositor. The compositor may then register its own
QTouchScreenObserver because relying on the QTouchEvents generated by
-the QPA event sender is often not satisfactory, as some low-level
-details may get lost, and due to performance reasons.
-
+the QPA event sender may not always be satisfactory as some low-level
+details get lost, and due to performance reasons.
-Known issues:
+(3) Possible issues and solutions
The udev rule matches any touchpad device. If there are multiple ones,
specify the device as described above.
-If no evdev events are read, remove 50-synaptics.conf from
-/usr/share/X11/xorg.conf.d and restart X.
+If no evdev events are read, remove 50-synaptics.conf (or similar)
+from /usr/share/X11/xorg.conf.d and restart X. Or at least temporarily
+disable the device by running xinput set-prop <device> <device enabled
+property> 0. Use xinput list and xinput list-props to figure out the
+values.
diff --git a/src/plugins/generic/touchscreen/main.cpp b/src/plugins/generic/touchscreen/main.cpp
index ff476d1648..8ecd924950 100644
--- a/src/plugins/generic/touchscreen/main.cpp
+++ b/src/plugins/generic/touchscreen/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp b/src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp
index 08db058e10..ced72e1599 100644
--- a/src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp
+++ b/src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -47,8 +47,6 @@
QT_BEGIN_NAMESPACE
-//#define POINT_DEBUG
-
QTouchEventSenderQPA::QTouchEventSenderQPA(const QString &spec)
{
m_forceToActiveWindow = spec.split(QLatin1Char(':')).contains(QLatin1String("force_window"));
@@ -58,16 +56,25 @@ QTouchEventSenderQPA::QTouchEventSenderQPA(const QString &spec)
QWindowSystemInterface::registerTouchDevice(m_device);
}
-void QTouchEventSenderQPA::touch_configure(int x_min, int x_max, int y_min, int y_max)
+void QTouchEventSenderQPA::touch_configure(int x_min, int x_max, int y_min, int y_max,
+ int pressure_min, int pressure_max,
+ const QString &dev_name)
{
hw_range_x_min = x_min;
hw_range_x_max = x_max;
hw_range_y_min = y_min;
hw_range_y_max = y_max;
+
+ hw_pressure_min = pressure_min;
+ hw_pressure_max = pressure_max;
+
+ m_device->setName(dev_name);
+
+ if (hw_pressure_max > hw_pressure_min)
+ m_device->setCapabilities(m_device->capabilities() | QTouchDevice::Pressure);
}
-void QTouchEventSenderQPA::touch_point(QEvent::Type state,
- const QList<QWindowSystemInterface::TouchPoint> &points)
+void QTouchEventSenderQPA::touch_point(const QList<QWindowSystemInterface::TouchPoint> &points)
{
QRect winRect;
if (m_forceToActiveWindow) {
@@ -79,35 +86,31 @@ void QTouchEventSenderQPA::touch_point(QEvent::Type state,
winRect = QGuiApplication::primaryScreen()->geometry();
}
-#ifdef POINT_DEBUG
- qDebug() << "QPA: Mapping" << points.size() << "points to" << winRect << state;
-#endif
+ const int hw_w = hw_range_x_max - hw_range_x_min;
+ const int hw_h = hw_range_y_max - hw_range_y_min;
QList<QWindowSystemInterface::TouchPoint> touchPoints = points;
- // Translate the coordinates and set the normalized position. QPA expects
- // 'area' to be in screen coordinates, while the device reports them in its
- // own system with (0, 0) being the center point of the device.
+ // Map the coordinates based on the normalized position. QPA expects 'area'
+ // to be in screen coordinates.
for (int i = 0; i < touchPoints.size(); ++i) {
QWindowSystemInterface::TouchPoint &tp(touchPoints[i]);
- const int hw_w = hw_range_x_max - hw_range_x_min;
- const int hw_h = hw_range_y_max - hw_range_y_min;
-
- qreal nx = tp.normalPosition.x();
- qreal ny = tp.normalPosition.y();
-
- // Generate a screen position that is always inside the active window or the default screen.
- const int wx = winRect.left() + int(nx * winRect.width());
- const int wy = winRect.top() + int(ny * winRect.height());
+ // Generate a screen position that is always inside the active window
+ // or the primary screen.
+ const int wx = winRect.left() + int(tp.normalPosition.x() * winRect.width());
+ const int wy = winRect.top() + int(tp.normalPosition.y() * winRect.height());
const qreal sizeRatio = (winRect.width() + winRect.height()) / qreal(hw_w + hw_h);
- tp.area = QRect(wx, wy, tp.area.width() * sizeRatio, tp.area.height() * sizeRatio);
+ tp.area = QRect(0, 0, tp.area.width() * sizeRatio, tp.area.height() * sizeRatio);
+ tp.area.moveCenter(QPoint(wx, wy));
-#ifdef POINT_DEBUG
- qDebug() << " " << i << tp.area << tp.state << tp.id << tp.isPrimary << tp.pressure;
-#endif
+ // Calculate normalized pressure.
+ if (!hw_pressure_min && !hw_pressure_max)
+ tp.pressure = tp.state == Qt::TouchPointReleased ? 0 : 1;
+ else
+ tp.pressure = (tp.pressure - hw_pressure_min) / qreal(hw_pressure_max - hw_pressure_min);
}
- QWindowSystemInterface::handleTouchEvent(0, state, m_device, touchPoints);
+ QWindowSystemInterface::handleTouchEvent(0, m_device, touchPoints);
}
QT_END_NAMESPACE
diff --git a/src/plugins/generic/touchscreen/qtoucheventsenderqpa.h b/src/plugins/generic/touchscreen/qtoucheventsenderqpa.h
index b6e1613b24..1eee273159 100644
--- a/src/plugins/generic/touchscreen/qtoucheventsenderqpa.h
+++ b/src/plugins/generic/touchscreen/qtoucheventsenderqpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -54,8 +54,9 @@ class QTouchEventSenderQPA : public QTouchScreenObserver
{
public:
QTouchEventSenderQPA(const QString &spec = QString());
- void touch_configure(int x_min, int x_max, int y_min, int y_max);
- void touch_point(QEvent::Type state, const QList<QWindowSystemInterface::TouchPoint> &points);
+ void touch_configure(int x_min, int x_max, int y_min, int y_max,
+ int pressure_min, int pressure_max, const QString &dev_name);
+ void touch_point(const QList<QWindowSystemInterface::TouchPoint> &points);
private:
bool m_forceToActiveWindow;
@@ -63,6 +64,9 @@ private:
int hw_range_x_max;
int hw_range_y_min;
int hw_range_y_max;
+ int hw_pressure_min;
+ int hw_pressure_max;
+ QString hw_dev_name;
QTouchDevice *m_device;
};
diff --git a/src/plugins/generic/touchscreen/qtouchscreen.cpp b/src/plugins/generic/touchscreen/qtouchscreen.cpp
index fd2de62d6b..8f37bab0c4 100644
--- a/src/plugins/generic/touchscreen/qtouchscreen.cpp
+++ b/src/plugins/generic/touchscreen/qtouchscreen.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -41,28 +41,23 @@
#include "qtouchscreen.h"
#include <QStringList>
+#include <QHash>
#include <QSocketNotifier>
-#include <QDebug>
#include <QtCore/private/qcore_unix_p.h>
#include <linux/input.h>
#include <libudev.h>
QT_BEGIN_NAMESPACE
-//#define POINT_DEBUG
-
class QTouchScreenData
{
public:
QTouchScreenData(QTouchScreenHandler *q_ptr, const QStringList &args);
void processInputEvent(input_event *data);
-
- void dump();
+ void assignIds();
QTouchScreenHandler *q;
- QEvent::Type m_state;
- QEvent::Type m_prevState;
int m_lastEventType;
QList<QWindowSystemInterface::TouchPoint> m_touchPoints;
@@ -71,17 +66,24 @@ public:
int x;
int y;
int maj;
+ int pressure;
Qt::TouchPointState state;
- bool primary;
- Contact() : trackingId(0), x(0), y(0), maj(1), state(Qt::TouchPointPressed), primary(false) { }
+ QTouchEvent::TouchPoint::InfoFlags flags;
+ Contact() : trackingId(-1),
+ x(0), y(0), maj(1), pressure(0),
+ state(Qt::TouchPointPressed), flags(0) { }
};
- QMap<int, Contact> m_contacts, m_lastContacts;
+ QHash<int, Contact> m_contacts, m_lastContacts;
Contact m_currentData;
+ int findClosestContact(const QHash<int, Contact> &contacts, int x, int y, int *dist);
+
int hw_range_x_min;
int hw_range_x_max;
int hw_range_y_min;
int hw_range_y_max;
+ int hw_pressure_min;
+ int hw_pressure_max;
QString hw_name;
QList<QTouchScreenObserver *> m_observers;
@@ -89,11 +91,10 @@ public:
QTouchScreenData::QTouchScreenData(QTouchScreenHandler *q_ptr, const QStringList &args)
: q(q_ptr),
- m_state(QEvent::TouchBegin),
- m_prevState(m_state),
m_lastEventType(-1),
hw_range_x_min(0), hw_range_x_max(0),
- hw_range_y_min(0), hw_range_y_max(0)
+ hw_range_y_min(0), hw_range_y_max(0),
+ hw_pressure_min(0), hw_pressure_max(0)
{
Q_UNUSED(args);
}
@@ -101,7 +102,7 @@ QTouchScreenData::QTouchScreenData(QTouchScreenHandler *q_ptr, const QStringList
QTouchScreenHandler::QTouchScreenHandler(const QString &spec)
: m_notify(0), m_fd(-1), d(0)
{
- setObjectName(QLatin1String("LinuxInputSubsystem Touch Handler"));
+ setObjectName(QLatin1String("Linux Touch Handler"));
QString dev = QLatin1String("/dev/input/event5");
try_udev(&dev);
@@ -126,16 +127,23 @@ QTouchScreenHandler::QTouchScreenHandler(const QString &spec)
input_absinfo absInfo;
memset(&absInfo, 0, sizeof(input_absinfo));
- if (!ioctl(m_fd, EVIOCGABS(ABS_X), &absInfo) >= 0) {
+ if (ioctl(m_fd, EVIOCGABS(ABS_MT_POSITION_X), &absInfo) >= 0) {
qDebug("min X: %d max X: %d", absInfo.minimum, absInfo.maximum);
d->hw_range_x_min = absInfo.minimum;
d->hw_range_x_max = absInfo.maximum;
}
- if (!ioctl(m_fd, EVIOCGABS(ABS_Y), &absInfo) >= 0) {
+ if (ioctl(m_fd, EVIOCGABS(ABS_MT_POSITION_Y), &absInfo) >= 0) {
qDebug("min Y: %d max Y: %d", absInfo.minimum, absInfo.maximum);
d->hw_range_y_min = absInfo.minimum;
d->hw_range_y_max = absInfo.maximum;
}
+ if (ioctl(m_fd, EVIOCGABS(ABS_PRESSURE), &absInfo) >= 0) {
+ qDebug("min pressure: %d max pressure: %d", absInfo.minimum, absInfo.maximum);
+ if (absInfo.maximum > absInfo.minimum) {
+ d->hw_pressure_min = absInfo.minimum;
+ d->hw_pressure_max = absInfo.maximum;
+ }
+ }
char name[1024];
if (ioctl(m_fd, EVIOCGNAME(sizeof(name) - 1), name) >= 0) {
d->hw_name = QString::fromLocal8Bit(name);
@@ -157,11 +165,14 @@ void QTouchScreenHandler::addObserver(QTouchScreenObserver *observer)
return;
d->m_observers.append(observer);
observer->touch_configure(d->hw_range_x_min, d->hw_range_x_max,
- d->hw_range_y_min, d->hw_range_y_max);
+ d->hw_range_y_min, d->hw_range_y_max,
+ d->hw_pressure_min, d->hw_pressure_max,
+ d->hw_name);
}
void QTouchScreenHandler::try_udev(QString *path)
{
+ *path = QString();
udev *u = udev_new();
udev_enumerate *ue = udev_enumerate_new(u);
udev_enumerate_add_match_subsystem(ue, "input");
@@ -171,9 +182,10 @@ void QTouchScreenHandler::try_udev(QString *path)
udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(ue)) {
const char *syspath = udev_list_entry_get_name(entry);
udev_device *udevice = udev_device_new_from_syspath(u, syspath);
- *path = QString::fromLocal8Bit(udev_device_get_devnode(udevice));
- qDebug("from udev: %s", qPrintable(*path));
+ QString candidate = QString::fromLocal8Bit(udev_device_get_devnode(udevice));
udev_device_unref(udevice);
+ if (path->isEmpty() && candidate.startsWith("/dev/input/event"))
+ *path = candidate;
}
udev_enumerate_unref(ue);
udev_unref(u);
@@ -213,136 +225,148 @@ void QTouchScreenData::processInputEvent(input_event *data)
{
if (data->type == EV_ABS) {
- if (data->code == ABS_MT_POSITION_X) {
- m_currentData.x = data->value;
- } else if (data->code == ABS_MT_POSITION_Y) {
- m_currentData.y = data->value;
- } else if (data->code == ABS_MT_TRACKING_ID) {
- m_currentData.trackingId = data->value;
- m_currentData.primary = m_contacts.isEmpty();
- } else if (data->code == ABS_MT_TOUCH_MAJOR) {
- m_currentData.maj = data->value;
- if (data->value == 0)
- m_currentData.state = Qt::TouchPointReleased;
- }
+ if (data->code == ABS_MT_POSITION_X) {
+ m_currentData.x = qBound(hw_range_x_min, data->value, hw_range_x_max);
+ } else if (data->code == ABS_MT_POSITION_Y) {
+ m_currentData.y = qBound(hw_range_y_min, data->value, hw_range_y_max);
+ } else if (data->code == ABS_MT_TRACKING_ID) {
+ m_currentData.trackingId = data->value;
+ } else if (data->code == ABS_MT_TOUCH_MAJOR) {
+ m_currentData.maj = data->value;
+ if (data->value == 0)
+ m_currentData.state = Qt::TouchPointReleased;
+ } else if (data->code == ABS_PRESSURE) {
+ m_currentData.pressure = qBound(hw_pressure_min, data->value, hw_pressure_max);
+ }
} else if (data->type == EV_SYN && data->code == SYN_MT_REPORT && m_lastEventType != EV_SYN) {
- m_contacts.insert(m_currentData.trackingId, m_currentData);
+ // If there is no tracking id, one will be generated later.
+ // Until that use a temporary key.
+ int key = m_currentData.trackingId;
+ if (key == -1)
+ key = m_contacts.count();
+
+ m_contacts.insert(key, m_currentData);
m_currentData = Contact();
} else if (data->type == EV_SYN && data->code == SYN_REPORT) {
+ // Ensure valid IDs even when the driver does not report ABS_MT_TRACKING_ID.
+ if (!m_contacts.isEmpty() && m_contacts.constBegin().value().trackingId == -1)
+ assignIds();
+
m_touchPoints.clear();
- for (QMap<int, Contact>::iterator it = m_contacts.begin(), ite = m_contacts.end();
- it != ite; ++it) {
+ Qt::TouchPointStates combinedStates;
+ QMutableHashIterator<int, Contact> it(m_contacts);
+ while (it.hasNext()) {
+ it.next();
QWindowSystemInterface::TouchPoint tp;
- tp.id = it->trackingId;
- tp.isPrimary = it->primary;
- tp.pressure = it->state == Qt::TouchPointReleased ? 0 : 1;
+ Contact &contact(it.value());
+ tp.id = contact.trackingId;
+ tp.flags = contact.flags;
- if (m_lastContacts.contains(it->trackingId)) {
- const Contact &prev(m_lastContacts.value(it->trackingId));
- if (it->state == Qt::TouchPointReleased) {
+ if (m_lastContacts.contains(contact.trackingId)) {
+ const Contact &prev(m_lastContacts.value(contact.trackingId));
+ if (contact.state == Qt::TouchPointReleased) {
// Copy over the previous values for released points, just in case.
- it->x = prev.x;
- it->y = prev.y;
- it->maj = prev.maj;
+ contact.x = prev.x;
+ contact.y = prev.y;
+ contact.maj = prev.maj;
} else {
- it->state = (prev.x == it->x && prev.y == it->y) ? Qt::TouchPointStationary : Qt::TouchPointMoved;
+ contact.state = (prev.x == contact.x && prev.y == contact.y)
+ ? Qt::TouchPointStationary : Qt::TouchPointMoved;
}
}
- tp.state = it->state;
- tp.area = QRectF(it->x, it->y, it->maj, it->maj);
+ // Avoid reporting a contact in released state more than once.
+ if (contact.state == Qt::TouchPointReleased
+ && !m_lastContacts.contains(contact.trackingId)) {
+ it.remove();
+ continue;
+ }
+
+ tp.state = contact.state;
+ combinedStates |= tp.state;
+
+ // Store the HW coordinates. Observers can then map it to screen space or something else.
+ tp.area = QRectF(0, 0, contact.maj, contact.maj);
+ tp.area.moveCenter(QPoint(contact.x, contact.y));
+ tp.pressure = contact.pressure;
- // Translate so that (0, 0) is the top-left corner.
- const int hw_x = qBound(hw_range_x_min, int(tp.area.left()), hw_range_x_max) - hw_range_x_min;
- const int hw_y = qBound(hw_range_y_min, int(tp.area.top()), hw_range_y_max) - hw_range_y_min;
// Get a normalized position in range 0..1.
- const int hw_w = hw_range_x_max - hw_range_x_min;
- const int hw_h = hw_range_y_max - hw_range_y_min;
- tp.normalPosition = QPointF(hw_x / qreal(hw_w),
- hw_y / qreal(hw_h));
+ tp.normalPosition = QPointF((contact.x - hw_range_x_min) / qreal(hw_range_x_max - hw_range_x_min),
+ (contact.y - hw_range_y_min) / qreal(hw_range_y_max - hw_range_y_min));
m_touchPoints.append(tp);
- }
- if (m_contacts.isEmpty())
- m_state = QEvent::TouchEnd;
+ if (contact.state == Qt::TouchPointReleased)
+ it.remove();
+ }
m_lastContacts = m_contacts;
m_contacts.clear();
- // No need to deliver if all points are stationary.
- bool skip = false;
- if (m_state == QEvent::TouchUpdate) {
- skip = true;
- for (int i = 0; i < m_touchPoints.count(); ++i)
- if (m_touchPoints.at(i).state != Qt::TouchPointStationary) {
- skip = false;
- break;
- }
- }
-
-#ifdef POINT_DEBUG
- dump();
-#endif
-
- if (!skip && !(m_state == m_prevState && m_state == QEvent::TouchEnd))
+ if (!m_touchPoints.isEmpty() && combinedStates != Qt::TouchPointStationary) {
for (int i = 0; i < m_observers.count(); ++i)
- m_observers.at(i)->touch_point(m_state, m_touchPoints);
-
- m_prevState = m_state;
- if (m_state == QEvent::TouchBegin)
- m_state = QEvent::TouchUpdate;
- else if (m_state == QEvent::TouchEnd)
- m_state = QEvent::TouchBegin;
+ m_observers.at(i)->touch_point(m_touchPoints);
+ }
}
m_lastEventType = data->type;
}
-void QTouchScreenData::dump()
+int QTouchScreenData::findClosestContact(const QHash<int, Contact> &contacts, int x, int y, int *dist)
{
- const char *eventType;
- switch (m_state) {
- case QEvent::TouchBegin:
- eventType = "TouchBegin";
- break;
- case QEvent::TouchUpdate:
- eventType = "TouchUpdate";
- break;
- case QEvent::TouchEnd:
- eventType = "TouchEnd";
- break;
- default:
- eventType = "unknown";
- break;
+ int minDist = -1, id = -1;
+ for (QHash<int, Contact>::const_iterator it = contacts.constBegin(), ite = contacts.constEnd();
+ it != ite; ++it) {
+ const Contact &contact(it.value());
+ int dx = x - contact.x;
+ int dy = y - contact.y;
+ int dist = dx * dx + dy * dy;
+ if (minDist == -1 || dist < minDist) {
+ minDist = dist;
+ id = contact.trackingId;
+ }
}
- qDebug() << "touch event" << eventType;
- foreach (const QWindowSystemInterface::TouchPoint &tp, m_touchPoints) {
- const char *pointState;
- switch (tp.state & Qt::TouchPointStateMask) {
- case Qt::TouchPointPressed:
- pointState = "pressed";
- break;
- case Qt::TouchPointMoved:
- pointState = "moved";
- break;
- case Qt::TouchPointStationary:
- pointState = "stationary";
- break;
- case Qt::TouchPointReleased:
- pointState = "released";
- break;
- default:
- pointState = "unknown";
- break;
+ if (dist)
+ *dist = minDist;
+ return id;
+}
+
+void QTouchScreenData::assignIds()
+{
+ QHash<int, Contact> candidates = m_lastContacts, pending = m_contacts, newContacts;
+ int maxId = -1;
+ QHash<int, Contact>::iterator it, ite, bestMatch;
+ while (!pending.isEmpty() && !candidates.isEmpty()) {
+ int bestDist = -1, bestId;
+ for (it = pending.begin(), ite = pending.end(); it != ite; ++it) {
+ int dist;
+ int id = findClosestContact(candidates, it->x, it->y, &dist);
+ if (id >= 0 && (bestDist == -1 || dist < bestDist)) {
+ bestDist = dist;
+ bestId = id;
+ bestMatch = it;
+ }
+ }
+ if (bestDist >= 0) {
+ bestMatch->trackingId = bestId;
+ newContacts.insert(bestId, *bestMatch);
+ candidates.remove(bestId);
+ pending.erase(bestMatch);
+ if (bestId > maxId)
+ maxId = bestId;
+ }
+ }
+ if (candidates.isEmpty()) {
+ for (it = pending.begin(), ite = pending.end(); it != ite; ++it) {
+ it->trackingId = ++maxId;
+ newContacts.insert(it->trackingId, *it);
}
- qDebug() << " " << tp.id << tp.area << pointState << tp.normalPosition
- << tp.pressure << tp.isPrimary << tp.area.center();
}
+ m_contacts = newContacts;
}
diff --git a/src/plugins/generic/touchscreen/qtouchscreen.h b/src/plugins/generic/touchscreen/qtouchscreen.h
index 3c35b0012f..546826c8db 100644
--- a/src/plugins/generic/touchscreen/qtouchscreen.h
+++ b/src/plugins/generic/touchscreen/qtouchscreen.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -58,8 +58,9 @@ class QTouchScreenData;
class QTouchScreenObserver
{
public:
- virtual void touch_configure(int x_min, int x_max, int y_min, int y_max) = 0;
- virtual void touch_point(QEvent::Type state, const QList<QWindowSystemInterface::TouchPoint> &points) = 0;
+ virtual void touch_configure(int x_min, int x_max, int y_min, int y_max,
+ int pressure_min, int pressure_max, const QString &dev_name) = 0;
+ virtual void touch_point(const QList<QWindowSystemInterface::TouchPoint> &points) = 0;
};
class QTouchScreenHandler : public QObject
diff --git a/src/plugins/generic/tslib/main.cpp b/src/plugins/generic/tslib/main.cpp
index 9e86e26ece..49bc60a615 100644
--- a/src/plugins/generic/tslib/main.cpp
+++ b/src/plugins/generic/tslib/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/generic/tslib/qtslib.cpp b/src/plugins/generic/tslib/qtslib.cpp
index 1349b9dbba..5b08ec8a34 100644
--- a/src/plugins/generic/tslib/qtslib.cpp
+++ b/src/plugins/generic/tslib/qtslib.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/generic/tslib/qtslib.h b/src/plugins/generic/tslib/qtslib.h
index ea7e227c3c..5e595b5a0c 100644
--- a/src/plugins/generic/tslib/qtslib.h
+++ b/src/plugins/generic/tslib/qtslib.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/imageformats/gif/main.cpp b/src/plugins/imageformats/gif/main.cpp
index 7a7cc0a995..b006d56fd7 100644
--- a/src/plugins/imageformats/gif/main.cpp
+++ b/src/plugins/imageformats/gif/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/imageformats/ico/main.cpp b/src/plugins/imageformats/ico/main.cpp
index 1d572fbe5d..ac9ceb037c 100644
--- a/src/plugins/imageformats/ico/main.cpp
+++ b/src/plugins/imageformats/ico/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp
index da6b8a75bc..c05ee12671 100644
--- a/src/plugins/imageformats/ico/qicohandler.cpp
+++ b/src/plugins/imageformats/ico/qicohandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/imageformats/ico/qicohandler.h b/src/plugins/imageformats/ico/qicohandler.h
index 8a338018bb..d6bf97f319 100644
--- a/src/plugins/imageformats/ico/qicohandler.h
+++ b/src/plugins/imageformats/ico/qicohandler.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/imageformats/jpeg/main.cpp b/src/plugins/imageformats/jpeg/main.cpp
index 785b77b646..ed457ca7ec 100644
--- a/src/plugins/imageformats/jpeg/main.cpp
+++ b/src/plugins/imageformats/jpeg/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/imageformats/mng/main.cpp b/src/plugins/imageformats/mng/main.cpp
index ae4909fa69..9fed507ce4 100644
--- a/src/plugins/imageformats/mng/main.cpp
+++ b/src/plugins/imageformats/mng/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/imageformats/tiff/main.cpp b/src/plugins/imageformats/tiff/main.cpp
index 6323b387f7..4bfd07b836 100644
--- a/src/plugins/imageformats/tiff/main.cpp
+++ b/src/plugins/imageformats/tiff/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforminputcontexts/ibus/main.cpp b/src/plugins/platforminputcontexts/ibus/main.cpp
index 9d2dbc6b2a..c93fef670a 100644
--- a/src/plugins/platforminputcontexts/ibus/main.cpp
+++ b/src/plugins/platforminputcontexts/ibus/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp
index 7adffbc2e2..9d64b78862 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp
@@ -2,7 +2,7 @@
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp -N -p qibusinputcontextproxy -c QIBusInputContextProxy interfaces/org.freedesktop.IBus.InputContext.xml
*
- * qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ * qdbusxml2cpp is Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
diff --git a/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h
index 9a91c4e484..56e194c66b 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h
+++ b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h
@@ -2,7 +2,7 @@
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp -N -p qibusinputcontextproxy -c QIBusInputContextProxy interfaces/org.freedesktop.IBus.InputContext.xml
*
- * qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ * qdbusxml2cpp is Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
index 6ab142ce25..ed858c8853 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -160,6 +160,8 @@ void QIBusPlatformInputContext::cursorRectChanged()
return;
QWindow *inputWindow = qApp->inputPanel()->inputWindow();
+ if (!inputWindow)
+ return;
r.moveTopLeft(inputWindow->mapToGlobal(r.topLeft()));
if (debug)
qDebug() << "microFocus" << r;
diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
index 5f0b4d4691..0f57bcd5a5 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
+++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforminputcontexts/ibus/qibusproxy.cpp b/src/plugins/platforminputcontexts/ibus/qibusproxy.cpp
index 9d64b603f3..c177c4f04a 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusproxy.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibusproxy.cpp
@@ -2,7 +2,7 @@
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp -N -p qibusproxy -c QIBusProxy interfaces/org.freedesktop.IBus.xml
*
- * qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ * qdbusxml2cpp is Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
diff --git a/src/plugins/platforminputcontexts/ibus/qibusproxy.h b/src/plugins/platforminputcontexts/ibus/qibusproxy.h
index 389eec3175..7d7d174162 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusproxy.h
+++ b/src/plugins/platforminputcontexts/ibus/qibusproxy.h
@@ -2,7 +2,7 @@
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp -N -p qibusproxy -c QIBusProxy interfaces/org.freedesktop.IBus.xml
*
- * qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ * qdbusxml2cpp is Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
diff --git a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
index c6dcfb10b9..424ea02fe3 100644
--- a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforminputcontexts/ibus/qibustypes.h b/src/plugins/platforminputcontexts/ibus/qibustypes.h
index 6848149c8b..1c9c33e159 100644
--- a/src/plugins/platforminputcontexts/ibus/qibustypes.h
+++ b/src/plugins/platforminputcontexts/ibus/qibustypes.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforminputcontexts/meego/contextadaptor.cpp b/src/plugins/platforminputcontexts/meego/contextadaptor.cpp
index 45b1102a98..da5920c396 100644
--- a/src/plugins/platforminputcontexts/meego/contextadaptor.cpp
+++ b/src/plugins/platforminputcontexts/meego/contextadaptor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforminputcontexts/meego/contextadaptor.h b/src/plugins/platforminputcontexts/meego/contextadaptor.h
index 8f134a5cb0..2150cd1e57 100644
--- a/src/plugins/platforminputcontexts/meego/contextadaptor.h
+++ b/src/plugins/platforminputcontexts/meego/contextadaptor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforminputcontexts/meego/main.cpp b/src/plugins/platforminputcontexts/meego/main.cpp
index f8558b498d..5c87a9caed 100644
--- a/src/plugins/platforminputcontexts/meego/main.cpp
+++ b/src/plugins/platforminputcontexts/meego/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.cpp b/src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.cpp
index c66ea4a178..cab0be4067 100644
--- a/src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.cpp
+++ b/src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.h b/src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.h
index 04eb28eab2..4e6e724bdc 100644
--- a/src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.h
+++ b/src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforminputcontexts/meego/serverproxy.cpp b/src/plugins/platforminputcontexts/meego/serverproxy.cpp
index 5715d8f19a..8f20238405 100644
--- a/src/plugins/platforminputcontexts/meego/serverproxy.cpp
+++ b/src/plugins/platforminputcontexts/meego/serverproxy.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforminputcontexts/meego/serverproxy.h b/src/plugins/platforminputcontexts/meego/serverproxy.h
index 3ad589409c..31cb82ba07 100644
--- a/src/plugins/platforminputcontexts/meego/serverproxy.h
+++ b/src/plugins/platforminputcontexts/meego/serverproxy.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro
index d59a0f1a0d..09b708d9a1 100644
--- a/src/plugins/platforms/cocoa/cocoa.pro
+++ b/src/plugins/platforms/cocoa/cocoa.pro
@@ -66,3 +66,6 @@ contains(QT_CONFIG,release):CONFIG -= debug
# Acccessibility debug support
# DEFINES += QT_COCOA_ENABLE_ACCESSIBILITY_INSPECTOR
# include ($$PWD/../../../../util/accessibilityinspector/accessibilityinspector.pri)
+
+# Window debug support
+#DEFINES += QT_COCOA_ENABLE_WINDOW_DEBUG
diff --git a/src/plugins/platforms/cocoa/main.mm b/src/plugins/platforms/cocoa/main.mm
index 0be6ebd682..f88e1b7786 100644
--- a/src/plugins/platforms/cocoa/main.mm
+++ b/src/plugins/platforms/cocoa/main.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.h b/src/plugins/platforms/cocoa/qcocoaaccessibility.h
index 7f4a840b15..c3376ad5c5 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibility.h
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -45,6 +45,8 @@
#include <QtGui>
+namespace QCocoaAccessible {
+
/*
Qt Cocoa Accessibility Overview
@@ -64,5 +66,11 @@
*/
NSString *macRole(QAccessible::Role);
+bool shouldBeIgnrored(QAccessibleInterface *interface);
+NSString *getTranslatedAction(const QString &qtAction);
+NSMutableArray *createTranslatedActionsList(const QStringList &qtActions);
+QString translateAction(NSString *nsAction);
+
+}
#endif
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
index a2ce743804..436d27eddf 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
- ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -40,6 +40,8 @@
****************************************************************************/
#include "qcocoaaccessibility.h"
+namespace QCocoaAccessible {
+
typedef QMap<QAccessible::Role, NSString *> QMacAccessibiltyRoleMap;
Q_GLOBAL_STATIC(QMacAccessibiltyRoleMap, qMacAccessibiltyRoleMap);
@@ -111,3 +113,109 @@ NSString *macRole(QAccessible::Role qtRole)
return NSAccessibilityUnknownRole;
}
+/*
+ Mac accessibility supports ignoring elements, which means that
+ the elements are still present in the accessibility tree but is
+ not used by the screen reader.
+*/
+bool shouldBeIgnrored(QAccessibleInterface *interface)
+{
+ // Mac accessibility does not have an attribute that corresponds to the Invisible/Offscreen
+ // state. Ignore interfaces with those flags set.
+ const QAccessible::State state = interface->state();
+ if (state.invisible ||
+ state.offscreen)
+ return true;
+
+ // Some roles are not interesting. In particular, container roles should be
+ // ignored in order to flatten the accessibility tree as seen by the user.
+ const QAccessible::Role role = interface->role();
+ if (role == QAccessible::Border || // QFrame
+ role == QAccessible::Application || // We use the system-provided application element.
+ role == QAccessible::MenuItem || // The system also provides the menu items.
+ role == QAccessible::ToolBar) // Access the tool buttons directly.
+ return true;
+
+ NSString *mac_role = macRole(interface->role());
+ if (mac_role == NSAccessibilityWindowRole || // We use the system-provided window elements.
+ mac_role == NSAccessibilityGroupRole ||
+ mac_role == NSAccessibilityUnknownRole)
+ return true;
+
+ // Client is a generic role returned by plain QWidgets or other
+ // widgets that does not have separate QAccessible interface, such
+ // as the TabWidget. Return false unless macRole gives the interface
+ // a special role.
+ if (role == QAccessible::Client && mac_role == NSAccessibilityUnknownRole)
+ return true;
+
+ if (QObject * const object = interface->object()) {
+ const QString className = QLatin1String(object->metaObject()->className());
+
+ // VoiceOver focusing on tool tips can be confusing. The contents of the
+ // tool tip is available through the description attribute anyway, so
+ // we disable accessibility for tool tips.
+ if (className == QLatin1String("QTipLabel"))
+ return true;
+ }
+
+ return false;
+}
+
+/*
+ Translates a predefined QAccessibleActionInterface action to a Mac action constant.
+ Returns 0 if the Qt Action has no mac equivalent. Ownership of the NSString is
+ not transferred.
+*/
+NSString *getTranslatedAction(const QString &qtAction)
+{
+ if (qtAction == QAccessibleActionInterface::pressAction())
+ return NSAccessibilityPressAction;
+ else if (qtAction == QAccessibleActionInterface::increaseAction())
+ return NSAccessibilityIncrementAction;
+ else if (qtAction == QAccessibleActionInterface::decreaseAction())
+ return NSAccessibilityDecrementAction;
+ else if (qtAction == QAccessibleActionInterface::showMenuAction())
+ return NSAccessibilityShowMenuAction;
+ else if (qtAction == QAccessibleActionInterface::setFocusAction()) // Not 100% sure on this one
+ return NSAccessibilityRaiseAction;
+
+ // Not translated:
+ //
+ // Qt:
+ // static const QString &checkAction();
+ // static const QString &uncheckAction();
+ //
+ // Cocoa:
+ // NSAccessibilityConfirmAction;
+ // NSAccessibilityPickAction;
+ // NSAccessibilityCancelAction;
+ // NSAccessibilityDeleteAction;
+
+ return 0;
+}
+
+
+/*
+ Translates between a Mac action constant and a QAccessibleActionInterface action
+ Returns an empty QString if there is no Qt predefined equivalent.
+*/
+QString translateAction(NSString *nsAction)
+{
+ if ([nsAction compare: NSAccessibilityPressAction] == NSOrderedSame)
+ return QAccessibleActionInterface::pressAction();
+ else if ([nsAction compare: NSAccessibilityIncrementAction] == NSOrderedSame)
+ return QAccessibleActionInterface::increaseAction();
+ else if ([nsAction compare: NSAccessibilityDecrementAction] == NSOrderedSame)
+ return QAccessibleActionInterface::decreaseAction();
+ else if ([nsAction compare: NSAccessibilityShowMenuAction] == NSOrderedSame)
+ return QAccessibleActionInterface::showMenuAction();
+ else if ([nsAction compare: NSAccessibilityRaiseAction] == NSOrderedSame)
+ return QAccessibleActionInterface::setFocusAction();
+
+ // See getTranslatedAction for not matched translations.
+
+ return QString();
+}
+
+} // namespace QCocoaAccessible
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h
index 76509f9e43..2136d6628a 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
index 332577d6e9..830e6860b7 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
- ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -60,7 +60,7 @@ static QAccessibleInterface *acast(void *ptr)
if (self) {
index = aIndex;
accessibleInterface = anQAccessibleInterface;
- role = macRole(acast(accessibleInterface)->role());
+ role = QCocoaAccessible::macRole(acast(accessibleInterface)->role());
parent = aParent;
}
@@ -177,41 +177,62 @@ static QAccessibleInterface *acast(void *ptr)
// actions
- (NSArray *)accessibilityActionNames {
- return [NSArray arrayWithObject:NSAccessibilityPressAction];
+ NSMutableArray * nsActions = [NSMutableArray new];
+
+ QAccessibleActionInterface *actionInterface = acast(accessibleInterface)->actionInterface();
+ if (actionInterface) {
+ QStringList supportedActionNames = actionInterface->actionNames();
+
+ foreach (const QString &qtAction, supportedActionNames) {
+ NSString *nsAction = QCocoaAccessible::getTranslatedAction(qtAction);
+ if (nsAction)
+ [nsActions addObject : nsAction];
+ }
+ }
+
+ return nsActions;
}
- (NSString *)accessibilityActionDescription:(NSString *)action {
+ QAccessibleActionInterface *actionInterface = acast(accessibleInterface)->actionInterface();
+ if (actionInterface) {
+ QString qtAction = QCocoaAccessible::translateAction(action);
+ QString description = actionInterface->localizedActionDescription(qtAction);
+ if (!description.isEmpty())
+ return qt_mac_QStringToNSString(description);
+ }
+
return NSAccessibilityActionDescription(action);
}
- (void)accessibilityPerformAction:(NSString *)action {
- Q_UNUSED(action);
- if (acast(accessibleInterface)->actionInterface())
- acast(accessibleInterface)->actionInterface()->doAction(0);
+ QAccessibleActionInterface *actionInterface = acast(accessibleInterface)->actionInterface();
+ if (actionInterface) {
+ QString qtAction = QCocoaAccessible::translateAction(action);
+ actionInterface->doAction(QAccessibleActionInterface::pressAction());
+ }
}
// misc
- (BOOL)accessibilityIsIgnored {
- return NO;
+ return QCocoaAccessible::shouldBeIgnrored(acast(accessibleInterface));
}
- (id)accessibilityHitTest:(NSPoint)point {
- int index = acast(accessibleInterface)->childAt(point.x, qt_mac_flipYCoordinate(point.y));
- // hit outside
- if (index == -1) {
- return 0;
- }
+ if (!accessibleInterface)
+ return NSAccessibilityUnignoredAncestor(self);
+ QAccessibleInterface *childInterface = acast(accessibleInterface)->childAt(point.x, qt_mac_flipYCoordinate(point.y));
- // hit this element
- if (index == 0) {
+ // No child found, meaning we hit this element.
+ if (!childInterface) {
return NSAccessibilityUnignoredAncestor(self);
}
// hit a child, forward to child accessible interface.
- QAccessibleInterface *childInterface = acast(accessibleInterface)->child(index - 1);
- QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement elementWithIndex:index - 1 parent:self accessibleInterface: childInterface];
+ int childIndex = acast(accessibleInterface)->indexOfChild(childInterface);
+ QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement elementWithIndex:childIndex parent:self accessibleInterface: childInterface];
return [accessibleElement accessibilityHitTest:point];
}
diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.h b/src/plugins/platforms/cocoa/qcocoaapplication.h
index 5b6b2f48f2..edd50958de 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplication.h
+++ b/src/plugins/platforms/cocoa/qcocoaapplication.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.mm b/src/plugins/platforms/cocoa/qcocoaapplication.mm
index 388e56db8e..b389635eaa 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplication.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplication.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -143,7 +143,7 @@ QT_USE_NAMESPACE
{
Q_UNUSED(event);
/*
- if (qApp->macEventFilter(0, reinterpret_cast<EventRef>(event)))
+ if (qApp && qApp->macEventFilter(0, reinterpret_cast<EventRef>(event)))
return true;
if ([event type] == NSApplicationDefined) {
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h
index 7f8d1dfacd..00546d6fe5 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index debda91243..26928d0df5 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoaautoreleasepool.h b/src/plugins/platforms/cocoa/qcocoaautoreleasepool.h
index 359b5d34d0..1ce2c1bd05 100644
--- a/src/plugins/platforms/cocoa/qcocoaautoreleasepool.h
+++ b/src/plugins/platforms/cocoa/qcocoaautoreleasepool.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoaautoreleasepool.mm b/src/plugins/platforms/cocoa/qcocoaautoreleasepool.mm
index d97793634e..e6d7ecc82b 100644
--- a/src/plugins/platforms/cocoa/qcocoaautoreleasepool.mm
+++ b/src/plugins/platforms/cocoa/qcocoaautoreleasepool.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.h b/src/plugins/platforms/cocoa/qcocoabackingstore.h
index 938e27347c..70ac8e109c 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.h
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index 0cde19644e..8f7b0aafde 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qcocoabackingstore.h"
+#include "qcocoaautoreleasepool.h"
#include <QtCore/qdebug.h>
#include <QtGui/QPainter>
@@ -80,6 +81,7 @@ void QCocoaBackingStore::flush(QWindow *widget, const QRegion &region, const QPo
{
Q_UNUSED(widget);
Q_UNUSED(offset);
+ QCocoaAutoReleasePool pool;
QRect geo = region.boundingRect();
diff --git a/src/plugins/platforms/cocoa/qcocoacursor.h b/src/plugins/platforms/cocoa/qcocoacursor.h
index dd66185f70..2c58994119 100644
--- a/src/plugins/platforms/cocoa/qcocoacursor.h
+++ b/src/plugins/platforms/cocoa/qcocoacursor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm
index 67386c78e1..cd0a173596 100644
--- a/src/plugins/platforms/cocoa/qcocoacursor.mm
+++ b/src/plugins/platforms/cocoa/qcocoacursor.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
index 7184db84fa..823a5626fe 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -87,10 +87,12 @@
// We mean it.
//
+#include <QtCore/qabstracteventdispatcher.h>
#include <QtCore/qhash.h>
#include <QtCore/qstack.h>
#include <QtGui/qwindowdefs.h>
-#include <QtCore/private/qeventdispatcher_unix_p.h>
+#include <QtCore/private/qabstracteventdispatcher_p.h>
+#include <QtCore/private/qtimerinfo_unix_p.h>
#include <CoreFoundation/CoreFoundation.h>
@@ -104,7 +106,7 @@ typedef struct _QCocoaModalSessionInfo {
} QCocoaModalSessionInfo;
class QCocoaEventDispatcherPrivate;
-class QCocoaEventDispatcher : public QEventDispatcherUNIX
+class QCocoaEventDispatcher : public QAbstractEventDispatcher
{
Q_OBJECT
Q_DECLARE_PRIVATE(QCocoaEventDispatcher)
@@ -121,31 +123,15 @@ public:
void registerSocketNotifier(QSocketNotifier *notifier);
void unregisterSocketNotifier(QSocketNotifier *notifier);
- void registerTimer(int timerId, int interval, QObject *object);
+ void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object);
bool unregisterTimer(int timerId);
bool unregisterTimers(QObject *object);
QList<TimerInfo> registeredTimers(QObject *object) const;
void wakeUp();
void interrupt();
-
-private:
- //friend void qt_mac_select_timer_callbk(__EventLoopTimer*, void*);
- friend class QApplicationPrivate;
-};
-
-struct MacTimerInfo {
- int id;
- int interval;
- QObject *obj;
- bool pending;
- CFRunLoopTimerRef runLoopTimer;
- bool operator==(const MacTimerInfo &other)
- {
- return (id == other.id);
- }
+ void flush();
};
-typedef QHash<int, MacTimerInfo *> MacTimerHash;
struct MacSocketInfo {
MacSocketInfo() : socket(0), runloop(0), readNotifier(0), writeNotifier(0) {}
@@ -156,33 +142,39 @@ struct MacSocketInfo {
};
typedef QHash<int, MacSocketInfo *> MacSocketHash;
-class QCocoaEventDispatcherPrivate : public QEventDispatcherUNIXPrivate
+class QCocoaEventDispatcherPrivate : public QAbstractEventDispatcherPrivate
{
Q_DECLARE_PUBLIC(QCocoaEventDispatcher)
public:
QCocoaEventDispatcherPrivate();
- static MacTimerHash macTimerHash;
+ // timer handling
+ QTimerInfoList timerInfoList;
+ CFRunLoopTimerRef runLoopTimerRef;
+ void maybeStartCFRunLoopTimer();
+ void maybeStopCFRunLoopTimer();
+ static void activateTimer(CFRunLoopTimerRef, void *info);
+
// Set 'blockSendPostedEvents' to true if you _really_ need
// to make sure that qt events are not posted while calling
// low-level cocoa functions (like beginModalForWindow). And
// use a QBoolBlocker to be safe:
- static bool blockSendPostedEvents;
+ bool blockSendPostedEvents;
// The following variables help organizing modal sessions:
- static QStack<QCocoaModalSessionInfo> cocoaModalSessionStack;
- static bool currentExecIsNSAppRun;
- static bool nsAppRunCalledByQt;
- static bool cleanupModalSessionsNeeded;
- static NSModalSession currentModalSessionCached;
- static NSModalSession currentModalSession();
- static void updateChildrenWorksWhenModal();
- static void temporarilyStopAllModalSessions();
- static void beginModalSession(QWindow *widget);
- static void endModalSession(QWindow *widget);
- static void cancelWaitForMoreEvents();
- static void cleanupModalSessions();
- static void ensureNSAppInitialized();
+ QStack<QCocoaModalSessionInfo> cocoaModalSessionStack;
+ bool currentExecIsNSAppRun;
+ bool nsAppRunCalledByQt;
+ bool cleanupModalSessionsNeeded;
+ NSModalSession currentModalSessionCached;
+ NSModalSession currentModalSession();
+ void updateChildrenWorksWhenModal();
+ void temporarilyStopAllModalSessions();
+ void beginModalSession(QWindow *widget);
+ void endModalSession(QWindow *widget);
+ void cancelWaitForMoreEvents();
+ void cleanupModalSessions();
+ void ensureNSAppInitialized();
MacSocketHash macSockets;
QList<void *> queuedUserInputEvents; // NSEvent *
@@ -191,15 +183,14 @@ public:
CFRunLoopObserverRef firstTimeObserver;
QAtomicInt serialNumber;
int lastSerial;
- static bool interrupt;
-private:
+ bool interrupt;
+
static Boolean postedEventSourceEqualCallback(const void *info1, const void *info2);
static void postedEventsSourcePerformCallback(void *info);
- static void activateTimer(CFRunLoopTimerRef, void *info);
static void waitingObserverCallback(CFRunLoopObserverRef observer,
CFRunLoopActivity activity, void *info);
static void firstLoopEntry(CFRunLoopObserverRef ref, CFRunLoopActivity activity, void *info);
- friend void processPostedEvents(QCocoaEventDispatcherPrivate *const d, const bool blockSendPostedEvents);
+ void processPostedEvents();
};
class QtCocoaInterruptDispatcher : public QObject
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
index 8cdf40be78..5c22050711 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -111,39 +111,79 @@ static inline CFRunLoopRef mainRunLoop()
/* timer call back */
void QCocoaEventDispatcherPrivate::activateTimer(CFRunLoopTimerRef, void *info)
{
- int timerID =
-#ifdef Q_OS_MAC64
- qint64(info);
-#else
- int(info);
-#endif
+ QCocoaEventDispatcherPrivate *d = static_cast<QCocoaEventDispatcherPrivate *>(info);
+ (void) d->timerInfoList.activateTimers();
+ d->maybeStartCFRunLoopTimer();
+}
+
+void QCocoaEventDispatcherPrivate::maybeStartCFRunLoopTimer()
+{
+ if (timerInfoList.isEmpty()) {
+ // no active timers, so the CFRunLoopTimerRef should not be active either
+ Q_ASSERT(runLoopTimerRef == 0);
+ return;
+ }
- MacTimerInfo *tmr;
- tmr = macTimerHash.value(timerID);
- if (tmr == 0 || tmr->pending == true)
- return; // Can't send another timer event if it's pending.
+ if (runLoopTimerRef == 0) {
+ // start the CFRunLoopTimer
+ CFAbsoluteTime ttf = CFAbsoluteTimeGetCurrent();
+ CFTimeInterval interval;
+ CFTimeInterval oneyear = CFTimeInterval(3600. * 24. * 365.);
+
+ // Q: when should the CFRunLoopTimer fire for the first time?
+ struct timeval tv;
+ if (timerInfoList.timerWait(tv)) {
+ // A: when we have timers to fire, of course
+ interval = qMax(tv.tv_sec + tv.tv_usec / 1000000., 0.0000001);
+ } else {
+ // this shouldn't really happen, but in case it does, set the timer to fire a some point in the distant future
+ interval = oneyear;
+ }
+ ttf += interval;
+ CFRunLoopTimerContext info = { 0, this, 0, 0, 0 };
+ // create the timer with a large interval, as recommended by the CFRunLoopTimerSetNextFireDate()
+ // documentation, since we will adjust the timer's time-to-fire as needed to keep Qt timers working
+ runLoopTimerRef = CFRunLoopTimerCreate(0, ttf, oneyear, 0, 0, QCocoaEventDispatcherPrivate::activateTimer, &info);
+ Q_ASSERT(runLoopTimerRef != 0);
- if (blockSendPostedEvents) {
- QCoreApplication::postEvent(tmr->obj, new QTimerEvent(tmr->id));
+ CFRunLoopAddTimer(mainRunLoop(), runLoopTimerRef, kCFRunLoopCommonModes);
} else {
- tmr->pending = true;
- QTimerEvent e(tmr->id);
-
- QCoreApplication::sendSpontaneousEvent(tmr->obj, &e);
- // Get the value again in case the timer gets unregistered during the sendEvent.
- tmr = macTimerHash.value(timerID);
- if (tmr != 0)
- tmr->pending = false;
+ // calculate when we need to wake up to process timers again
+ CFAbsoluteTime ttf = CFAbsoluteTimeGetCurrent();
+ CFTimeInterval interval;
+
+ // Q: when should the timer first next?
+ struct timeval tv;
+ if (timerInfoList.timerWait(tv)) {
+ // A: when we have timers to fire, of course
+ interval = qMax(tv.tv_sec + tv.tv_usec / 1000000., 0.0000001);
+ } else {
+ // no timers can fire, but we cannot stop the CFRunLoopTimer, set the timer to fire at some
+ // point in the distant future (the timer interval is one year)
+ interval = CFRunLoopTimerGetInterval(runLoopTimerRef);
+ }
+
+ ttf += interval;
+ CFRunLoopTimerSetNextFireDate(runLoopTimerRef, ttf);
}
+}
+void QCocoaEventDispatcherPrivate::maybeStopCFRunLoopTimer()
+{
+ if (runLoopTimerRef == 0)
+ return;
+
+ CFRunLoopTimerInvalidate(runLoopTimerRef);
+ CFRelease(runLoopTimerRef);
+ runLoopTimerRef = 0;
}
-void QCocoaEventDispatcher::registerTimer(int timerId, int interval, QObject *obj)
+void QCocoaEventDispatcher::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *obj)
{
#ifndef QT_NO_DEBUG
if (timerId < 1 || interval < 0 || !obj) {
- qWarning("QEventDispatcherMac::registerTimer: invalid arguments");
+ qWarning("QCocoaEventDispatcher::registerTimer: invalid arguments");
return;
} else if (obj->thread() != thread() || thread() != QThread::currentThread()) {
qWarning("QObject::startTimer: timers cannot be started from another thread");
@@ -151,58 +191,37 @@ void QCocoaEventDispatcher::registerTimer(int timerId, int interval, QObject *ob
}
#endif
- MacTimerInfo *t = new MacTimerInfo();
- t->id = timerId;
- t->interval = interval;
- t->obj = obj;
- t->runLoopTimer = 0;
- t->pending = false;
-
- CFAbsoluteTime fireDate = CFAbsoluteTimeGetCurrent();
- CFTimeInterval cfinterval = qMax(CFTimeInterval(interval) / 1000, 0.0000001);
- fireDate += cfinterval;
- QCocoaEventDispatcherPrivate::macTimerHash.insert(timerId, t);
- CFRunLoopTimerContext info = { 0, (void *)timerId, 0, 0, 0 };
- t->runLoopTimer = CFRunLoopTimerCreate(0, fireDate, cfinterval, 0, 0,
- QCocoaEventDispatcherPrivate::activateTimer, &info);
- if (t->runLoopTimer == 0) {
- qFatal("QEventDispatcherMac::registerTimer: Cannot create timer");
- }
- CFRunLoopAddTimer(mainRunLoop(), t->runLoopTimer, kCFRunLoopCommonModes);
+ Q_D(QCocoaEventDispatcher);
+ d->timerInfoList.registerTimer(timerId, interval, timerType, obj);
+ d->maybeStartCFRunLoopTimer();
}
-bool QCocoaEventDispatcher::unregisterTimer(int identifier)
+bool QCocoaEventDispatcher::unregisterTimer(int timerId)
{
#ifndef QT_NO_DEBUG
- if (identifier < 1) {
- qWarning("QEventDispatcherMac::unregisterTimer: invalid argument");
+ if (timerId < 1) {
+ qWarning("QCocoaEventDispatcher::unregisterTimer: invalid argument");
return false;
} else if (thread() != QThread::currentThread()) {
qWarning("QObject::killTimer: timers cannot be stopped from another thread");
return false;
}
#endif
- if (identifier <= 0)
- return false; // not init'd or invalid timer
-
- MacTimerInfo *timerInfo = QCocoaEventDispatcherPrivate::macTimerHash.take(identifier);
- if (timerInfo == 0)
- return false;
-
- if (!QObjectPrivate::get(timerInfo->obj)->inThreadChangeEvent)
- QAbstractEventDispatcherPrivate::releaseTimerId(identifier);
- CFRunLoopTimerInvalidate(timerInfo->runLoopTimer);
- CFRelease(timerInfo->runLoopTimer);
- delete timerInfo;
- return true;
+ Q_D(QCocoaEventDispatcher);
+ bool returnValue = d->timerInfoList.unregisterTimer(timerId);
+ if (!d->timerInfoList.isEmpty())
+ d->maybeStartCFRunLoopTimer();
+ else
+ d->maybeStopCFRunLoopTimer();
+ return returnValue;
}
bool QCocoaEventDispatcher::unregisterTimers(QObject *obj)
{
#ifndef QT_NO_DEBUG
if (!obj) {
- qWarning("QEventDispatcherMac::unregisterTimers: invalid argument");
+ qWarning("QCocoaEventDispatcher::unregisterTimers: invalid argument");
return false;
} else if (obj->thread() != thread() || thread() != QThread::currentThread()) {
qWarning("QObject::killTimers: timers cannot be stopped from another thread");
@@ -210,41 +229,27 @@ bool QCocoaEventDispatcher::unregisterTimers(QObject *obj)
}
#endif
- MacTimerHash::iterator it = QCocoaEventDispatcherPrivate::macTimerHash.begin();
- while (it != QCocoaEventDispatcherPrivate::macTimerHash.end()) {
- MacTimerInfo *timerInfo = it.value();
- if (timerInfo->obj != obj) {
- ++it;
- } else {
- if (!QObjectPrivate::get(timerInfo->obj)->inThreadChangeEvent)
- QAbstractEventDispatcherPrivate::releaseTimerId(timerInfo->id);
- CFRunLoopTimerInvalidate(timerInfo->runLoopTimer);
- CFRelease(timerInfo->runLoopTimer);
- delete timerInfo;
- it = QCocoaEventDispatcherPrivate::macTimerHash.erase(it);
- }
- }
- return true;
+ Q_D(QCocoaEventDispatcher);
+ bool returnValue = d->timerInfoList.unregisterTimers(obj);
+ if (!d->timerInfoList.isEmpty())
+ d->maybeStartCFRunLoopTimer();
+ else
+ d->maybeStopCFRunLoopTimer();
+ return returnValue;
}
QList<QCocoaEventDispatcher::TimerInfo>
QCocoaEventDispatcher::registeredTimers(QObject *object) const
{
+#ifndef QT_NO_DEBUG
if (!object) {
- qWarning("QEventDispatcherMac:registeredTimers: invalid argument");
+ qWarning("QCocoaEventDispatcher:registeredTimers: invalid argument");
return QList<TimerInfo>();
}
+#endif
- QList<TimerInfo> list;
-
- MacTimerHash::const_iterator it = QCocoaEventDispatcherPrivate::macTimerHash.constBegin();
- while (it != QCocoaEventDispatcherPrivate::macTimerHash.constEnd()) {
- MacTimerInfo *t = it.value();
- if (t->obj == object)
- list << TimerInfo(t->id, t->interval);
- ++it;
- }
- return list;
+ Q_D(const QCocoaEventDispatcher);
+ return d->timerInfoList.registeredTimers(object);
}
/**************************************************************************
@@ -692,16 +697,6 @@ void QCocoaEventDispatcher::wakeUp()
/*****************************************************************************
QEventDispatcherMac Implementation
*****************************************************************************/
-MacTimerHash QCocoaEventDispatcherPrivate::macTimerHash;
-bool QCocoaEventDispatcherPrivate::blockSendPostedEvents = false;
-bool QCocoaEventDispatcherPrivate::interrupt = false;
-
-
-QStack<QCocoaModalSessionInfo> QCocoaEventDispatcherPrivate::cocoaModalSessionStack;
-bool QCocoaEventDispatcherPrivate::currentExecIsNSAppRun = false;
-bool QCocoaEventDispatcherPrivate::nsAppRunCalledByQt = false;
-bool QCocoaEventDispatcherPrivate::cleanupModalSessionsNeeded = false;
-NSModalSession QCocoaEventDispatcherPrivate::currentModalSessionCached = 0;
void QCocoaEventDispatcherPrivate::ensureNSAppInitialized()
{
@@ -899,11 +894,18 @@ void QCocoaEventDispatcherPrivate::endModalSession(QWindow *window)
}
QCocoaEventDispatcherPrivate::QCocoaEventDispatcherPrivate()
+ : runLoopTimerRef(0),
+ blockSendPostedEvents(false),
+ currentExecIsNSAppRun(false),
+ nsAppRunCalledByQt(false),
+ cleanupModalSessionsNeeded(false),
+ currentModalSessionCached(0),
+ interrupt(false)
{
}
QCocoaEventDispatcher::QCocoaEventDispatcher(QObject *parent)
- : QEventDispatcherUNIX(*new QCocoaEventDispatcherPrivate, parent)
+ : QAbstractEventDispatcher(*new QCocoaEventDispatcherPrivate, parent)
{
Q_D(QCocoaEventDispatcher);
CFRunLoopSourceContext context;
@@ -955,38 +957,38 @@ Boolean QCocoaEventDispatcherPrivate::postedEventSourceEqualCallback(const void
return info1 == info2;
}
-void processPostedEvents(QCocoaEventDispatcherPrivate *const d, const bool blockSendPostedEvents)
+void QCocoaEventDispatcherPrivate::processPostedEvents()
{
if (blockSendPostedEvents) {
// We're told to not send posted events (because the event dispatcher
// is currently working on setting up the correct session to run). But
// we still need to make sure that we don't fall asleep until pending events
// are sendt, so we just signal this need, and return:
- CFRunLoopSourceSignal(d->postedEventsSource);
+ CFRunLoopSourceSignal(postedEventsSource);
return;
}
- if (d->cleanupModalSessionsNeeded)
- d->cleanupModalSessions();
+ if (cleanupModalSessionsNeeded)
+ cleanupModalSessions();
- if (d->interrupt) {
- if (d->currentExecIsNSAppRun) {
+ if (interrupt) {
+ if (currentExecIsNSAppRun) {
// The event dispatcher has been interrupted. But since
// [NSApplication run] is running the event loop, we
// delayed stopping it until now (to let cocoa process
// pending cocoa events first).
- if (d->currentModalSessionCached)
- d->temporarilyStopAllModalSessions();
+ if (currentModalSessionCached)
+ temporarilyStopAllModalSessions();
[NSApp stop:NSApp];
- d->cancelWaitForMoreEvents();
+ cancelWaitForMoreEvents();
}
return;
}
- int serial = d->serialNumber.load();
- if (!d->threadData->canWait || (serial != d->lastSerial)) {
- d->lastSerial = serial;
- QWindowSystemInterface::sendWindowSystemEvents(d->q_func(), QEventLoop::AllEvents);
+ int serial = serialNumber.load();
+ if (!threadData->canWait || (serial != lastSerial)) {
+ lastSerial = serial;
+ QWindowSystemInterface::sendWindowSystemEvents(q_func(), QEventLoop::AllEvents);
}
}
@@ -1016,12 +1018,12 @@ void QCocoaEventDispatcherPrivate::firstLoopEntry(CFRunLoopObserverRef ref,
forEventClass:kInternetEventClass andEventID:kAEGetURL];
*/
- processPostedEvents(static_cast<QCocoaEventDispatcherPrivate *>(info), blockSendPostedEvents);
+ static_cast<QCocoaEventDispatcherPrivate *>(info)->processPostedEvents();
}
void QCocoaEventDispatcherPrivate::postedEventsSourcePerformCallback(void *info)
{
- processPostedEvents(static_cast<QCocoaEventDispatcherPrivate *>(info), blockSendPostedEvents);
+ static_cast<QCocoaEventDispatcherPrivate *>(info)->processPostedEvents();
}
void QCocoaEventDispatcherPrivate::cancelWaitForMoreEvents()
@@ -1050,21 +1052,15 @@ void QCocoaEventDispatcher::interrupt()
d->cancelWaitForMoreEvents();
}
+void QCocoaEventDispatcher::flush()
+{ }
+
QCocoaEventDispatcher::~QCocoaEventDispatcher()
{
Q_D(QCocoaEventDispatcher);
- //timer cleanup
- MacTimerHash::iterator it = QCocoaEventDispatcherPrivate::macTimerHash.begin();
- while (it != QCocoaEventDispatcherPrivate::macTimerHash.end()) {
- MacTimerInfo *t = it.value();
- if (t->runLoopTimer) {
- CFRunLoopTimerInvalidate(t->runLoopTimer);
- CFRelease(t->runLoopTimer);
- }
- delete t;
- ++it;
- }
- QCocoaEventDispatcherPrivate::macTimerHash.clear();
+
+ qDeleteAll(d->timerInfoList);
+ d->maybeStopCFRunLoopTimer();
// Remove CFSockets from the runloop.
for (MacSocketHash::ConstIterator it = d->macSockets.constBegin(); it != d->macSockets.constEnd(); ++it) {
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
index c5c40c69a1..e99fe58570 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -62,7 +62,7 @@ public:
bool defaultNameFilterDisables() const;
void deleteNativeDialog_sys();
- bool show_sys(QWindow *parent);
+ bool show_sys(ShowFlags flags, Qt::WindowFlags windowFlags, QWindow *parent);
void hide_sys();
QPlatformFileDialogHelper::DialogCode dialogResultCode_sys();
void setDirectory_sys(const QString &directory);
@@ -70,12 +70,11 @@ public:
void selectFile_sys(const QString &filename);
QStringList selectedFiles_sys() const;
void setFilter_sys();
- void setNameFilters_sys(const QStringList &filters);
void selectNameFilter_sys(const QString &filter);
QString selectedNameFilter_sys() const;
public:
- bool showCocoaFilePanel();
+ bool showCocoaFilePanel(QWindow *parent);
bool hideCocoaFilePanel();
void createNSOpenSavePanelDelegate();
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index 820a5dcbd0..a513237977 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -72,8 +72,11 @@ QT_FORWARD_DECLARE_CLASS(QStringList)
QT_FORWARD_DECLARE_CLASS(QWidget)
QT_FORWARD_DECLARE_CLASS(QAction)
QT_FORWARD_DECLARE_CLASS(QFileInfo)
+QT_FORWARD_DECLARE_CLASS(QWindow)
QT_USE_NAMESPACE
+typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
+
@class QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate);
@interface QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate)
@@ -92,14 +95,10 @@ QT_USE_NAMESPACE
QFileDialog *mFileDialog;
QCocoaFileDialogHelper *mHelper;
NSString *mCurrentDir;
- bool mConfirmOverwrite;
- int mReturnCode;
- QT_PREPEND_NAMESPACE(QFileDialog::AcceptMode) mAcceptMode;
- QT_PREPEND_NAMESPACE(QDir::Filters) *mQDirFilter;
- QT_PREPEND_NAMESPACE(QFileDialog::FileMode) mFileMode;
- QT_PREPEND_NAMESPACE(QFileDialog::Options) *mFileOptions;
+ int mReturnCode;
+ SharedPointerFileDialogOptions mOptions;
QString *mLastFilterCheckPath;
QString *mCurrentSelection;
QStringList *mQDirFilterEntryList;
@@ -112,7 +111,7 @@ QT_USE_NAMESPACE
- (void)filterChanged:(id)sender;
- (void)showModelessPanel;
- (BOOL)runApplicationModalPanel;
-- (void)showWindowModalSheet:(QWidget *)docWidget;
+- (void)showWindowModalSheet:(QWindow *)docWidget;
- (void)updateProperties;
- (QStringList)acceptableExtensionsForSave;
- (QString)removeExtensions:(const QString &)filter;
@@ -125,39 +124,31 @@ QT_USE_NAMESPACE
@implementation QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate)
-- (id)initWithAcceptMode:(QT_PREPEND_NAMESPACE(QFileDialog::AcceptMode))acceptMode
- title:(const QString &)title
- hideNameFilterDetails:(bool)hideNameFilterDetails
- qDirFilter:(QT_PREPEND_NAMESPACE(QDir::Filters))qDirFilter
- fileOptions:(QT_PREPEND_NAMESPACE(QFileDialog::Options))fileOptions
- fileMode:(QT_PREPEND_NAMESPACE(QFileDialog::FileMode))fileMode
- selectFile:(const QString &)selectFile
- confirmOverwrite:(bool)confirm
+- (id)initWithAcceptMode:
+ (const QString &)selectFile
fileDialog:(QFileDialog *)fileDialog
+ options:(SharedPointerFileDialogOptions)options
helper:(QCocoaFileDialogHelper *)helper
{
self = [super init];
mFileDialog = fileDialog;
- mAcceptMode = acceptMode;
- if (mAcceptMode == QT_PREPEND_NAMESPACE(QFileDialog::AcceptOpen)){
+ mOptions = options;
+ if (mOptions->acceptMode() == QT_PREPEND_NAMESPACE(QFileDialogOptions::AcceptOpen)){
mOpenPanel = [NSOpenPanel openPanel];
mSavePanel = mOpenPanel;
} else {
mSavePanel = [NSSavePanel savePanel];
+ [mSavePanel setCanSelectHiddenExtension:YES];
mOpenPanel = 0;
}
[mSavePanel setLevel:NSModalPanelWindowLevel];
[mSavePanel setDelegate:self];
- mQDirFilter = new QT_PREPEND_NAMESPACE(QDir::Filters)(qDirFilter);
- mFileOptions = new QT_PREPEND_NAMESPACE(QFileDialog::Options)(fileOptions);
- mFileMode = fileMode;
- mConfirmOverwrite = confirm;
mReturnCode = -1;
mHelper = helper;
mLastFilterCheckPath = new QString;
mQDirFilterEntryList = new QStringList;
- mNameFilterDropDownList = new QStringList(mFileDialog->nameFilters());
+ mNameFilterDropDownList = new QStringList(mOptions->nameFilters());
QString selectedVisualNameFilter = mFileDialog->selectedNameFilter();
mSelectedNameFilter = new QStringList([self findStrippedFilterWithVisualFilterName:selectedVisualNameFilter]);
@@ -170,16 +161,17 @@ QT_USE_NAMESPACE
mCurrentSelection = new QString(sel.absoluteFilePath());
}
- [mSavePanel setTitle:qt_mac_QStringToNSString(title)];
- [self createPopUpButton:selectedVisualNameFilter hideDetails:hideNameFilterDetails];
+ [mSavePanel setTitle:qt_mac_QStringToNSString(options->windowTitle())];
+ [self createPopUpButton:selectedVisualNameFilter hideDetails:options->testOption(QFileDialogOptions::HideNameFilterDetails)];
[self createTextField];
[self createAccessory];
[mSavePanel setAccessoryView:mNameFilterDropDownList->size() > 1 ? mAccessoryView : nil];
- [mSavePanel setPrompt:[self strip:mFileDialog->labelText(QFileDialog::Accept)]];
- if (false) // ### fixme mPriv->fileNameLabelExplicitlySat)
- [mSavePanel setNameFieldLabel:[self strip:mFileDialog->labelText(QFileDialog::FileName)]];
+ if (mOptions->isLabelExplicitlySet(QFileDialogOptions::Accept))
+ [mSavePanel setPrompt:[self strip:options->labelText(QFileDialogOptions::Accept)]];
+ if (mOptions->isLabelExplicitlySet(QFileDialogOptions::FileName))
+ [mSavePanel setNameFieldLabel:[self strip:options->labelText(QFileDialogOptions::FileName)]];
[self updateProperties];
[mSavePanel retain];
@@ -188,8 +180,6 @@ QT_USE_NAMESPACE
- (void)dealloc
{
- delete mQDirFilter;
- delete mFileOptions;
delete mLastFilterCheckPath;
delete mQDirFilterEntryList;
delete mNameFilterDropDownList;
@@ -225,7 +215,7 @@ QT_USE_NAMESPACE
QFileInfo info(*mCurrentSelection);
NSString *filename = QT_PREPEND_NAMESPACE(qt_mac_QStringToNSString)(info.fileName());
NSString *filepath = QT_PREPEND_NAMESPACE(qt_mac_QStringToNSString)(info.filePath());
- bool selectable = (mAcceptMode == QFileDialog::AcceptSave)
+ bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|| [self panel:nil shouldShowFilename:filepath];
[mOpenPanel
beginForDirectory:mCurrentDir
@@ -242,7 +232,7 @@ QT_USE_NAMESPACE
QFileInfo info(*mCurrentSelection);
NSString *filename = QT_PREPEND_NAMESPACE(qt_mac_QStringToNSString)(info.fileName());
NSString *filepath = QT_PREPEND_NAMESPACE(qt_mac_QStringToNSString)(info.filePath());
- bool selectable = (mAcceptMode == QFileDialog::AcceptSave)
+ bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|| [self panel:nil shouldShowFilename:filepath];
mReturnCode = [mSavePanel
runModalForDirectory:mCurrentDir
@@ -257,13 +247,13 @@ QT_USE_NAMESPACE
return (mReturnCode == NSOKButton) ? QT_PREPEND_NAMESPACE(QPlatformDialogHelper::Accepted) : QT_PREPEND_NAMESPACE(QPlatformDialogHelper::Rejected);
}
-- (void)showWindowModalSheet:(QWidget *)docWidget
+- (void)showWindowModalSheet:(QWindow *)docWidget
{
Q_UNUSED(docWidget);
QFileInfo info(*mCurrentSelection);
NSString *filename = QT_PREPEND_NAMESPACE(qt_mac_QStringToNSString)(info.fileName());
NSString *filepath = QT_PREPEND_NAMESPACE(qt_mac_QStringToNSString)(info.filePath());
- bool selectable = (mAcceptMode == QFileDialog::AcceptSave)
+ bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|| [self panel:nil shouldShowFilename:filepath];
[mSavePanel
beginSheetForDirectory:mCurrentDir
@@ -295,7 +285,7 @@ QT_USE_NAMESPACE
QString path = info.absolutePath();
if (path != *mLastFilterCheckPath){
*mLastFilterCheckPath = path;
- *mQDirFilterEntryList = info.dir().entryList(*mQDirFilter);
+ *mQDirFilterEntryList = info.dir().entryList(mOptions->filter());
}
// Check if the QDir filter accepts the file:
if (!mQDirFilterEntryList->contains(info.fileName()))
@@ -317,7 +307,7 @@ QT_USE_NAMESPACE
Q_UNUSED(sender);
if (!okFlag)
return filename;
- if (mConfirmOverwrite)
+ if (!mOptions->testOption(QFileDialogOptions::DontConfirmOverwrite))
return filename;
// User has clicked save, and no overwrite confirmation should occur.
@@ -376,20 +366,21 @@ QT_USE_NAMESPACE
// Call this functions if mFileMode, mFileOptions,
// mNameFilterDropDownList or mQDirFilter changes.
// The savepanel does not contain the neccessary functions for this.
- bool chooseFilesOnly = mFileMode == QT_PREPEND_NAMESPACE(QFileDialog::ExistingFile)
- || mFileMode == QT_PREPEND_NAMESPACE(QFileDialog::ExistingFiles);
- bool chooseDirsOnly = mFileMode == QT_PREPEND_NAMESPACE(QFileDialog::Directory)
- || mFileMode == QT_PREPEND_NAMESPACE(QFileDialog::DirectoryOnly)
- || *mFileOptions & QT_PREPEND_NAMESPACE(QFileDialog::ShowDirsOnly);
+ const QT_PREPEND_NAMESPACE(QFileDialogOptions::FileMode) fileMode = mOptions->fileMode();
+ bool chooseFilesOnly = fileMode == QT_PREPEND_NAMESPACE(QFileDialogOptions::ExistingFile)
+ || fileMode == QT_PREPEND_NAMESPACE(QFileDialogOptions::ExistingFiles);
+ bool chooseDirsOnly = fileMode == QT_PREPEND_NAMESPACE(QFileDialogOptions::Directory)
+ || fileMode == QT_PREPEND_NAMESPACE(QFileDialogOptions::DirectoryOnly)
+ || mOptions->testOption(QT_PREPEND_NAMESPACE(QFileDialogOptions::ShowDirsOnly));
[mOpenPanel setCanChooseFiles:!chooseDirsOnly];
[mOpenPanel setCanChooseDirectories:!chooseFilesOnly];
- [mSavePanel setCanCreateDirectories:!(*mFileOptions & QT_PREPEND_NAMESPACE(QFileDialog::ReadOnly))];
- [mOpenPanel setAllowsMultipleSelection:(mFileMode == QT_PREPEND_NAMESPACE(QFileDialog::ExistingFiles))];
- [mOpenPanel setResolvesAliases:!(*mFileOptions & QT_PREPEND_NAMESPACE(QFileDialog::DontResolveSymlinks))];
+ [mSavePanel setCanCreateDirectories:!(mOptions->testOption(QT_PREPEND_NAMESPACE(QFileDialogOptions::ReadOnly)))];
+ [mOpenPanel setAllowsMultipleSelection:(fileMode == QT_PREPEND_NAMESPACE(QFileDialogOptions::ExistingFiles))];
+ [mOpenPanel setResolvesAliases:!(mOptions->testOption(QT_PREPEND_NAMESPACE(QFileDialogOptions::DontResolveSymlinks)))];
QStringList ext = [self acceptableExtensionsForSave];
- const QString defaultSuffix = mFileDialog->defaultSuffix();
+ const QString defaultSuffix = mOptions->defaultSuffix();
if (!ext.isEmpty() && !defaultSuffix.isEmpty())
ext.prepend(defaultSuffix);
[mSavePanel setAllowedFileTypes:ext.isEmpty() ? nil : QT_PREPEND_NAMESPACE(qt_mac_QStringListToNSMutableArray(ext))];
@@ -473,7 +464,8 @@ QT_USE_NAMESPACE
[mTextField setSelectable:false];
[mTextField setBordered:false];
[mTextField setDrawsBackground:false];
- [mTextField setStringValue:[self strip:mFileDialog->labelText(QFileDialog::FileType)]];
+ if (mOptions->isLabelExplicitlySet(QFileDialogOptions::FileType))
+ [mTextField setStringValue:[self strip:mOptions->labelText(QFileDialogOptions::FileType)]];
}
- (void)createPopUpButton:(const QString &)selectedFilter hideDetails:(BOOL)hideDetails
@@ -538,15 +530,16 @@ QCocoaFileDialogHelper::~QCocoaFileDialogHelper()
void QCocoaFileDialogHelper::QNSOpenSavePanelDelegate_selectionChanged(const QString &newPath)
{
- qtFileDialog->metaObject()->invokeMethod(qtFileDialog, "currentChanged", Q_ARG(QString, newPath));
+ emit currentChanged(newPath);
}
void QCocoaFileDialogHelper::QNSOpenSavePanelDelegate_panelClosed(bool accepted)
{
- if (accepted)
- qtFileDialog->metaObject()->invokeMethod(qtFileDialog, "accept");
- else
- qtFileDialog->metaObject()->invokeMethod(qtFileDialog, "reject");
+ if (accepted) {
+ emit accept();
+ } else {
+ emit reject();
+ }
}
void QCocoaFileDialogHelper::QNSOpenSavePanelDelegate_directoryEntered(const QString &newDir)
@@ -557,7 +550,7 @@ void QCocoaFileDialogHelper::QNSOpenSavePanelDelegate_directoryEntered(const QSt
void QCocoaFileDialogHelper::QNSOpenSavePanelDelegate_filterSelected(int menuIndex)
{
- const QStringList filters = qtFileDialog->nameFilters();
+ const QStringList filters = options()->nameFilters();
emit filterSelected(menuIndex >= 0 && menuIndex < filters.size() ? filters.at(menuIndex) : QString());
}
@@ -593,29 +586,22 @@ QStringList QCocoaFileDialogHelper::selectedFiles_sys() const
return [delegate selectedFiles];
}
-void QCocoaFileDialogHelper::setNameFilters_sys(const QStringList &filters)
-{
- QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
- bool hideDetails = qtFileDialog->testOption(QFileDialog::HideNameFilterDetails);
- [delegate setNameFilters:filters hideDetails:hideDetails];
-}
-
void QCocoaFileDialogHelper::setFilter_sys()
{
QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
- *(delegate->mQDirFilter) = qtFileDialog->filter();
- delegate->mFileMode = qtFileDialog->fileMode();
- [delegate->mSavePanel setTitle:qt_mac_QStringToNSString(qtFileDialog->windowTitle())];
- [delegate->mSavePanel setPrompt:[delegate strip:qtFileDialog->labelText(QFileDialog::Accept)]];
- if (false) // ### fixme priv->fileNameLabelExplicitlySat)
- [delegate->mSavePanel setNameFieldLabel:[delegate strip:qtFileDialog->labelText(QFileDialog::FileName)]];
+ const SharedPointerFileDialogOptions &opts = options();
+ [delegate->mSavePanel setTitle:qt_mac_QStringToNSString(opts->windowTitle())];
+ if (opts->isLabelExplicitlySet(QFileDialogOptions::Accept))
+ [delegate->mSavePanel setPrompt:[delegate strip:opts->labelText(QFileDialogOptions::Accept)]];
+ if (opts->isLabelExplicitlySet(QFileDialogOptions::FileName))
+ [delegate->mSavePanel setNameFieldLabel:[delegate strip:opts->labelText(QFileDialogOptions::FileName)]];
[delegate updateProperties];
}
void QCocoaFileDialogHelper::selectNameFilter_sys(const QString &filter)
{
- const int index = qtFileDialog->nameFilters().indexOf(filter);
+ const int index = options()->nameFilters().indexOf(filter);
if (index != -1) {
QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
[delegate->mPopUpButton selectItemAtIndex:index];
@@ -627,7 +613,7 @@ QString QCocoaFileDialogHelper::selectedNameFilter_sys() const
{
QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
int index = [delegate->mPopUpButton indexOfSelectedItem];
- return index != -1 ? qtFileDialog->nameFilters().at(index) : QString();
+ return index != -1 ? options()->nameFilters().at(index) : QString();
}
void QCocoaFileDialogHelper::deleteNativeDialog_sys()
@@ -642,13 +628,13 @@ void QCocoaFileDialogHelper::hide_sys()
hideCocoaFilePanel();
}
-bool QCocoaFileDialogHelper::show_sys(QWindow * /* parent */)
+bool QCocoaFileDialogHelper::show_sys(ShowFlags /* flags */, Qt::WindowFlags windowFlags, QWindow *parent)
{
// Q_Q(QFileDialog);
if (!qtFileDialog->isHidden())
return false;
- if (qtFileDialog->windowFlags() & Qt::WindowStaysOnTopHint) {
+ if (windowFlags & Qt::WindowStaysOnTopHint) {
// The native file dialog tries all it can to stay
// on the NSModalPanel level. And it might also show
// its own "create directory" dialog that we cannot control.
@@ -656,38 +642,35 @@ bool QCocoaFileDialogHelper::show_sys(QWindow * /* parent */)
return false;
}
- return showCocoaFilePanel();
+ return showCocoaFilePanel(parent);
}
void QCocoaFileDialogHelper::createNSOpenSavePanelDelegate()
{
if (mDelegate)
return;
-
- bool selectDir = qtFileDialog->selectedFiles().isEmpty();
- QString selection(selectDir ? qtFileDialog->directory().absolutePath() : qtFileDialog->selectedFiles().value(0));
+ const SharedPointerFileDialogOptions &opts = options();
+ const QStringList selectedFiles = opts->initiallySelectedFiles();
+ const QString directory = opts->initialDirectory();
+ const bool selectDir = selectedFiles.isEmpty();
+ QString selection(selectDir ? directory : selectedFiles.front());
QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) alloc]
- initWithAcceptMode:qtFileDialog->acceptMode()
- title:qtFileDialog->windowTitle()
- hideNameFilterDetails:qtFileDialog->testOption(QFileDialog::HideNameFilterDetails)
- qDirFilter:qtFileDialog->filter()
- fileOptions:qtFileDialog->options()
- fileMode:qtFileDialog->fileMode()
- selectFile:selection
- confirmOverwrite:!qtFileDialog->testOption(QFileDialog::DontConfirmOverwrite)
- fileDialog:qtFileDialog
- helper:this];
+ initWithAcceptMode:
+ selection
+ fileDialog:qtFileDialog
+ options:opts
+ helper:this];
mDelegate = delegate;
}
-bool QCocoaFileDialogHelper::showCocoaFilePanel()
+bool QCocoaFileDialogHelper::showCocoaFilePanel(QWindow *parent)
{
// Q_Q(QFileDialog);
createNSOpenSavePanelDelegate();
QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
if (qt_mac_is_macsheet(qtFileDialog))
- [delegate showWindowModalSheet:qtFileDialog->parentWidget()];
+ [delegate showWindowModalSheet:parent];
else
[delegate showModelessPanel];
return true;
@@ -717,7 +700,7 @@ void QCocoaFileDialogHelper::platformNativeDialogModalHelp()
// running (which is the case if e.g a top-most QEventLoop has been
// interrupted, and the second-most event loop has not yet been reactivated (regardless
// if [NSApp run] is still on the stack)), showing a native modal dialog will fail.
- QTimer::singleShot(1, qtFileDialog, SLOT(_q_platformRunNativeAppModalPanel()));
+ QTimer::singleShot(1, this, SIGNAL(launchNativeAppModalPanel()));
}
void QCocoaFileDialogHelper::_q_platformRunNativeAppModalPanel()
@@ -729,9 +712,9 @@ void QCocoaFileDialogHelper::_q_platformRunNativeAppModalPanel()
QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
[delegate runApplicationModalPanel];
if (dialogResultCode_sys() == QPlatformDialogHelper::Accepted)
- qtFileDialog->metaObject()->invokeMethod(qtFileDialog, "accept");
+ emit accept();
else
- qtFileDialog->metaObject()->invokeMethod(qtFileDialog, "reject");
+ emit reject();
}
QPlatformDialogHelper::DialogCode QCocoaFileDialogHelper::dialogResultCode_sys()
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h
index dc8a428a91..652c3b33c8 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.h
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index 2b21f08601..08c0ce61a8 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h
index 4ab19ee3fd..61076aadd4 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.h
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
- ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index 1ac6911461..45aa90c296 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
- ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -45,6 +45,7 @@
#include <QtCore>
#include <QtGui>
+#include <private/qguiapplication_p.h>
QT_BEGIN_NAMESPACE
@@ -264,7 +265,7 @@ Qt::Key qt_mac_cocoaKey2QtKey(QChar keyCode)
{
const KeyPair *i = qBinaryFind(entries, end, keyCode);
if (i == end)
- return Qt::Key(keyCode.unicode());
+ return Qt::Key(keyCode.toUpper().unicode());
return i->qtKey;
}
@@ -441,7 +442,7 @@ QString qt_mac_applicationName()
appName = QCFString::toQString(static_cast<CFStringRef>(string));
if (appName.isEmpty()) {
- QString arg0 = qApp->arguments().at(0);
+ QString arg0 = QGuiApplicationPrivate::instance()->appName();
if (arg0.contains("/")) {
QStringList parts = arg0.split("/");
appName = parts.at(parts.count() - 1);
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h
index 1852173b5b..46e8925ba7 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.h
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -47,6 +47,7 @@
#include "qcocoaautoreleasepool.h"
#include "qcocoacursor.h"
+#include <QtCore/QScopedPointer>
#include <QtGui/QPlatformIntegration>
QT_BEGIN_NAMESPACE
@@ -90,11 +91,12 @@ public:
QPlatformTheme *platformTheme() const;
private:
- QPlatformFontDatabase *mFontDb;
+
+ QScopedPointer<QPlatformFontDatabase> mFontDb;
QAbstractEventDispatcher *mEventDispatcher;
- QPlatformAccessibility *mAccessibility;
- QPlatformTheme *mPlatformTheme;
+ QScopedPointer<QPlatformAccessibility> mAccessibility;
+ QScopedPointer<QPlatformTheme> mPlatformTheme;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 6d7770fecc..685b640843 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -89,7 +89,12 @@ QCocoaScreen::~QCocoaScreen()
QCocoaIntegration::QCocoaIntegration()
: mFontDb(new QCoreTextFontDatabase())
, mEventDispatcher(new QCocoaEventDispatcher())
+ , mAccessibility(new QPlatformAccessibility)
+ , mPlatformTheme(new QCocoaTheme)
+
{
+ QCocoaAutoReleasePool pool;
+
qApp->setAttribute(Qt::AA_DontUseNativeMenuBar, false);
NSApplication *cocoaApplication = [NSApplication sharedApplication];
@@ -132,13 +137,11 @@ QCocoaIntegration::QCocoaIntegration()
screenAdded(screen);
}
- mAccessibility = new QPlatformAccessibility;
- mPlatformTheme = new QCocoaTheme;
}
QCocoaIntegration::~QCocoaIntegration()
{
- delete mAccessibility;
+ [[NSApplication sharedApplication] setDelegate: 0];
}
bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) const
@@ -175,7 +178,7 @@ QAbstractEventDispatcher *QCocoaIntegration::guiThreadEventDispatcher() const
QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const
{
- return mFontDb;
+ return mFontDb.data();
}
QPlatformNativeInterface *QCocoaIntegration::nativeInterface() const
@@ -185,12 +188,12 @@ QPlatformNativeInterface *QCocoaIntegration::nativeInterface() const
QPlatformAccessibility *QCocoaIntegration::accessibility() const
{
- return mAccessibility;
+ return mAccessibility.data();
}
QPlatformTheme *QCocoaIntegration::platformTheme() const
{
- return mPlatformTheme;
+ return mPlatformTheme.data();
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.h b/src/plugins/platforms/cocoa/qcocoamenu.h
index 4e8ce20580..e0ba8a116f 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.h
+++ b/src/plugins/platforms/cocoa/qcocoamenu.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm
index 1bb5f45a94..5f695eb07a 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.h b/src/plugins/platforms/cocoa/qcocoamenuloader.h
index 2fcda512f0..c4b56a6d19 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuloader.h
+++ b/src/plugins/platforms/cocoa/qcocoamenuloader.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
index 353808655f..3c7d3c8bff 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.h b/src/plugins/platforms/cocoa/qcocoanativeinterface.h
index f8216d8e61..3c190aedb2 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.h
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
index c6aa0d39e6..426ac1e494 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -52,8 +52,15 @@
void *QCocoaNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window)
{
+ if (!window->handle()) {
+ qWarning("QCocoaNativeInterface::nativeResourceForWindow: Native window has not been created.");
+ return 0;
+ }
+
if (resourceString == "nsopenglcontext") {
return static_cast<QCocoaWindow *>(window->handle())->currentContext()->nsOpenGLContext();
+ } else if (resourceString == "nsview") {
+ return static_cast<QCocoaWindow *>(window->handle())->m_contentView;
}
return 0;
}
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.h b/src/plugins/platforms/cocoa/qcocoatheme.h
index 8a7add73a8..901f6443f9 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.h
+++ b/src/plugins/platforms/cocoa/qcocoatheme.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm
index ef73cc2abe..db333417a9 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ b/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 9fa04a0ca2..d3dc7d5f91 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -65,6 +65,25 @@
@end
QT_BEGIN_NAMESPACE
+// QCocoaWindow
+//
+// QCocoaWindow is an NSView (not an NSWindow!) in the sense
+// that it relies on a NSView for all event handling and
+// graphics output and does not require a NSWindow, except for
+// for the window-related functions like setWindowTitle.
+//
+// As a consequence of this it is possible to embed the QCocoaWindow
+// in an NSView hierarchy by getting a pointer to the "backing"
+// NSView and not calling QCocoaWindow::show():
+//
+// QWindow *qtWindow = new MyWindow();
+// qtWindow->create();
+// QPlatformNativeInterface *platformNativeInterface = QGuiApplication::platformNativeInterface();
+// NSView *qtView = (NSView *)platformNativeInterface->nativeResourceForWindow("nsview", qtWindow);
+// [parentView addSubview:qtView];
+//
+// See the qt_on_cocoa manual tests for a working example, located
+// in tests/manual/cocoa at the time of writing.
class QCocoaWindow : public QPlatformWindow
{
@@ -97,12 +116,17 @@ protected:
QRect windowGeometry() const;
QCocoaWindow *parentCocoaWindow() const;
-private:
+// private:
+public: // for QNSView
friend class QCocoaBackingStore;
- NSWindow *m_nsWindow;
+ friend class QCocoaNativeInterface;
+
QNSView *m_contentView;
+ QNSWindow *m_nsWindow;
+
quint32 m_windowAttributes;
quint32 m_windowClass;
+ bool m_inConstructor;
QCocoaGLContext *m_glContext;
};
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index de38db5fab..66f4b602d9 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -81,6 +81,7 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
, m_windowAttributes(0)
, m_windowClass(0)
, m_glContext(0)
+ , m_inConstructor(true)
{
QCocoaAutoReleasePool pool;
@@ -97,7 +98,17 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
// QCocoaWindow is deleted by Qt.
[m_nsWindow setReleasedWhenClosed : NO];
- m_contentView = [[QNSView alloc] initWithQWindow:tlw];
+ m_contentView = [[QNSView alloc] initWithQWindow:tlw platformWindow:this];
+
+ [[NSNotificationCenter defaultCenter] addObserver:m_contentView
+ selector:@selector(windowDidBecomeKey)
+ name:NSWindowDidBecomeKeyNotification
+ object:m_nsWindow];
+
+ [[NSNotificationCenter defaultCenter] addObserver:m_contentView
+ selector:@selector(windowDidResignKey)
+ name:NSWindowDidResignKeyNotification
+ object:m_nsWindow];
// ### Accept touch events by default.
// Beware that enabling touch events has a negative impact on the overall performance.
@@ -107,10 +118,13 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
setGeometry(tlw->geometry());
[m_nsWindow setContentView:m_contentView];
+ m_inConstructor = false;
}
QCocoaWindow::~QCocoaWindow()
{
+ [[NSNotificationCenter defaultCenter] removeObserver:m_contentView];
+ [m_contentView release];
[m_nsWindow release];
}
@@ -118,17 +132,22 @@ void QCocoaWindow::setGeometry(const QRect &rect)
{
if (geometry() == rect)
return;
+#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
+ qDebug() << "QCocoaWindow::setGeometry" << this << rect;
+#endif
QPlatformWindow::setGeometry(rect);
NSRect bounds = qt_mac_flipRect(rect, window());
-
- [[m_nsWindow contentView] setFrameSize:bounds.size];
[m_nsWindow setContentSize : bounds.size];
[m_nsWindow setFrameOrigin : bounds.origin];
}
void QCocoaWindow::setVisible(bool visible)
{
+ QCocoaAutoReleasePool pool;
+#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
+ qDebug() << "QCocoaWindow::setVisible" << this << visible;
+#endif
if (visible) {
// The parent window might have moved while this window was hidden,
// update the window geometry if there is a parent.
@@ -146,6 +165,8 @@ void QCocoaWindow::setVisible(bool visible)
void QCocoaWindow::setWindowTitle(const QString &title)
{
+ QCocoaAutoReleasePool pool;
+
CFStringRef windowTitle = QCFString::toCFStringRef(title);
[m_nsWindow setTitle: const_cast<NSString *>(reinterpret_cast<const NSString *>(windowTitle))];
CFRelease(windowTitle);
@@ -164,21 +185,24 @@ void QCocoaWindow::lower()
void QCocoaWindow::propagateSizeHints()
{
+ QCocoaAutoReleasePool pool;
+
[m_nsWindow setMinSize : qt_mac_toNSSize(window()->minimumSize())];
[m_nsWindow setMaxSize : qt_mac_toNSSize(window()->maximumSize())];
+#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
+ qDebug() << "QCocoaWindow::propagateSizeHints" << this;
+ qDebug() << " min/max " << window()->minimumSize() << window()->maximumSize();
+ qDebug() << " basesize" << window()->baseSize();
+ qDebug() << " geometry" << geometry();
+#endif
+
if (!window()->sizeIncrement().isNull())
[m_nsWindow setResizeIncrements : qt_mac_toNSSize(window()->sizeIncrement())];
- // We must set the window frame after setting the minimum size to prevent the window
- // from being resized to the minimum size. Use QWindow::baseSize if set, otherwise
- // use the current size.
QSize baseSize = window()->baseSize();
- QRect rect = geometry();
if (!baseSize.isNull()) {
- [m_nsWindow setFrame : NSMakeRect(rect.x(), rect.y(), baseSize.width(), baseSize.height()) display : YES];
- } else {
- [m_nsWindow setFrame : NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height()) display : YES];
+ [m_nsWindow setFrameSize : NSMakeSize(baseSize.width(), baseSize.height()) display : YES];
}
}
@@ -212,25 +236,16 @@ NSView *QCocoaWindow::contentView() const
void QCocoaWindow::windowDidMove()
{
- NSRect rect = [[m_nsWindow contentView]frame];
- NSRect windowRect = [m_nsWindow frame];
-
- QRect geo(windowRect.origin.x, qt_mac_flipYCoordinate(windowRect.origin.y + rect.size.height), rect.size.width, rect.size.height);
- setGeometry(geo);
- QWindowSystemInterface::handleSynchronousGeometryChange(window(), geo);
+ [m_contentView updateGeometry];
}
void QCocoaWindow::windowDidResize()
{
NSRect rect = [[m_nsWindow contentView]frame];
- NSRect windowRect = [m_nsWindow frame];
-
- QRect geo(windowRect.origin.x, qt_mac_flipYCoordinate(windowRect.origin.y + rect.size.height), rect.size.width, rect.size.height);
- setGeometry(geo);
- QWindowSystemInterface::handleSynchronousGeometryChange(window(), geo);
+ // Call setFrameSize which will trigger a frameDidChangeNotification on QNSView.
+ [[m_nsWindow contentView] setFrameSize:rect.size];
}
-
void QCocoaWindow::windowWillClose()
{
QWindowSystemInterface::handleSynchronousCloseEvent(window());
diff --git a/src/plugins/platforms/cocoa/qmenu_mac.h b/src/plugins/platforms/cocoa/qmenu_mac.h
index 0bca25ff5f..1e72b2fa41 100644
--- a/src/plugins/platforms/cocoa/qmenu_mac.h
+++ b/src/plugins/platforms/cocoa/qmenu_mac.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qmenu_mac.mm b/src/plugins/platforms/cocoa/qmenu_mac.mm
index dde6464392..db6dda79f1 100644
--- a/src/plugins/platforms/cocoa/qmenu_mac.mm
+++ b/src/plugins/platforms/cocoa/qmenu_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qmultitouch_mac.mm b/src/plugins/platforms/cocoa/qmultitouch_mac.mm
index 855bfc2a06..43767b09b2 100644
--- a/src/plugins/platforms/cocoa/qmultitouch_mac.mm
+++ b/src/plugins/platforms/cocoa/qmultitouch_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -73,7 +73,6 @@ QCocoaTouch::~QCocoaTouch()
void QCocoaTouch::updateTouchData(NSTouch *nstouch, NSTouchPhase phase)
{
_touchPoint.state = toTouchPointState(phase);
- _touchPoint.isPrimary = (_touchCount == 1);
// From the normalized position on the trackpad, calculate
// where on screen the touchpoint should be according to the
diff --git a/src/plugins/platforms/cocoa/qmultitouch_mac_p.h b/src/plugins/platforms/cocoa/qmultitouch_mac_p.h
index 811813c963..146c21d53c 100644
--- a/src/plugins/platforms/cocoa/qmultitouch_mac_p.h
+++ b/src/plugins/platforms/cocoa/qmultitouch_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index eddc1aa7e9..73c8030e1d 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -47,18 +47,23 @@
#include <QtGui/QImage>
#include <QtGui/QAccessible>
+class QCocoaWindow;
@interface QNSView : NSView {
CGImageRef m_cgImage;
QWindow *m_window;
+ QCocoaWindow *m_platformWindow;
Qt::MouseButtons m_buttons;
QAccessibleInterface *m_accessibleRoot;
}
- (id)init;
-- (id)initWithQWindow:(QWindow *)window;
+- (id)initWithQWindow:(QWindow *)window platformWindow:(QCocoaWindow *) platformWindow;
- (void)setImage:(QImage *)image;
- (void)drawRect:(NSRect)dirtyRect;
+- (void)updateGeometry;
+- (void)windowDidBecomeKey;
+- (void)windowDidResignKey;
- (BOOL)isFlipped;
- (BOOL)acceptsFirstResponder;
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 4ae268dda5..26ddd44aa6 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -44,6 +44,7 @@
#include <Carbon/Carbon.h>
#include "qnsview.h"
+#include "qcocoawindow.h"
#include "qcocoahelpers.h"
#include "qmultitouch_mac_p.h"
@@ -81,12 +82,14 @@ static QTouchDevice *touchDevice = 0;
return self;
}
-- (id)initWithQWindow:(QWindow *)window {
+- (id)initWithQWindow:(QWindow *)window platformWindow:(QCocoaWindow *) platformWindow
+{
self = [self init];
if (!self)
return 0;
m_window = window;
+ m_platformWindow = platformWindow;
m_accessibleRoot = 0;
#ifdef QT_COCOA_ENABLE_ACCESSIBILITY_INSPECTOR
@@ -106,9 +109,45 @@ static QTouchDevice *touchDevice = 0;
m_accessibleRoot = window->accessibleRoot();
#endif
+ [self setPostsFrameChangedNotifications : YES];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(updateGeometry)
+ name:NSViewFrameDidChangeNotification
+ object:self];
+
return self;
}
+- (void)updateGeometry
+{
+ NSRect rect = [self frame];
+ NSRect windowRect = [[self window] frame];
+ QRect geo(windowRect.origin.x, qt_mac_flipYCoordinate(windowRect.origin.y + rect.size.height), rect.size.width, rect.size.height);
+
+#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
+ qDebug() << "QNSView::udpateGeometry" << geo;
+#endif
+
+ // Call setGeometry on QPlatformWindow. (not on QCocoaWindow,
+ // doing that will initiate a geometry change it and possibly create
+ // an infinite loop when this notification is triggered again.)
+ m_platformWindow->QPlatformWindow::setGeometry(geo);
+
+ // Send a geometry change event to Qt, if it's ready to handle events
+ if (!m_platformWindow->m_inConstructor)
+ QWindowSystemInterface::handleSynchronousGeometryChange(m_window, geo);
+}
+
+- (void)windowDidBecomeKey
+{
+ QWindowSystemInterface::handleWindowActivated(m_window);
+}
+
+- (void)windowDidResignKey
+{
+ QWindowSystemInterface::handleWindowActivated(0);
+}
+
- (void) setImage:(QImage *)image
{
CGImageRelease(m_cgImage);
@@ -178,6 +217,11 @@ static QTouchDevice *touchDevice = 0;
return YES;
}
+- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
+{
+ return YES;
+}
+
- (void)handleMouseEvent:(NSEvent *)theEvent
{
// Calculate the mouse position in the QWindow and Qt screen coordinate system,
@@ -204,14 +248,19 @@ static QTouchDevice *touchDevice = 0;
QPoint qtWindowPoint(nsViewPoint.x, nsViewPoint.y); // NSView/QWindow coordinates
QPoint qtScreenPoint;
-#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_6
- NSRect screenRect = [[self window] convertRectToScreen : NSMakeRect(nsWindowPoint.x, nsWindowPoint.y, 0, 0)]; // OS X screen coordinates
- qtScreenPoint = QPoint(screenRect.origin.x, qt_mac_flipYCoordinate(screenRect.origin.y)); // Qt screen coordinates
-#else
- NSPoint screenPoint = [[self window] convertBaseToScreen : NSMakePoint(nsWindowPoint.x, nsWindowPoint.y)];
- qtScreenPoint = QPoint(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y));
-#endif
+ NSWindow *window = [self window];
+ // Use convertRectToScreen if available (added in 10.7).
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ if ([window respondsToSelector:@selector(convertRectToScreen:)]) {
+ NSRect screenRect = [window convertRectToScreen : NSMakeRect(nsWindowPoint.x, nsWindowPoint.y, 0, 0)]; // OS X screen coordinates
+ qtScreenPoint = QPoint(screenRect.origin.x, qt_mac_flipYCoordinate(screenRect.origin.y)); // Qt screen coordinates
+ } else
+#endif
+ {
+ NSPoint screenPoint = [window convertBaseToScreen : NSMakePoint(nsWindowPoint.x, nsWindowPoint.y)];
+ qtScreenPoint = QPoint(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y));
+ }
ulong timestamp = [theEvent timestamp] * 1000;
QWindowSystemInterface::handleMouseEvent(m_window, timestamp, qtWindowPoint, qtScreenPoint, m_buttons);
@@ -295,28 +344,28 @@ static QTouchDevice *touchDevice = 0;
{
const NSTimeInterval timestamp = [event timestamp];
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, /*acceptSingleTouch= ### true or false?*/false);
- QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchBegin, touchDevice, points);
+ QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, touchDevice, points);
}
- (void)touchesMovedWithEvent:(NSEvent *)event
{
const NSTimeInterval timestamp = [event timestamp];
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, /*acceptSingleTouch= ### true or false?*/false);
- QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchUpdate, touchDevice, points);
+ QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, touchDevice, points);
}
- (void)touchesEndedWithEvent:(NSEvent *)event
{
const NSTimeInterval timestamp = [event timestamp];
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, /*acceptSingleTouch= ### true or false?*/false);
- QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchEnd, touchDevice, points);
+ QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, touchDevice, points);
}
- (void)touchesCancelledWithEvent:(NSEvent *)event
{
const NSTimeInterval timestamp = [event timestamp];
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, /*acceptSingleTouch= ### true or false?*/false);
- QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchEnd, touchDevice, points);
+ QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, touchDevice, points);
}
#ifndef QT_NO_WHEELEVENT
@@ -337,9 +386,20 @@ static QTouchDevice *touchDevice = 0;
// It looks like 1/4 degrees per pixel behaves most native.
// (NB: Qt expects the unit for delta to be 8 per degree):
const int pixelsToDegrees = 2; // 8 * 1/4
- deltaX = [theEvent deviceDeltaX] * pixelsToDegrees;
- deltaY = [theEvent deviceDeltaY] * pixelsToDegrees;
- deltaZ = [theEvent deviceDeltaZ] * pixelsToDegrees;
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ if ([theEvent respondsToSelector:@selector(scrollingDeltaX)]) {
+ deltaX = [theEvent scrollingDeltaX] * pixelsToDegrees;
+ deltaY = [theEvent scrollingDeltaY] * pixelsToDegrees;
+ // scrollingDeltaZ API is missing.
+ } else
+#endif
+ {
+ deltaX = [theEvent deviceDeltaX] * pixelsToDegrees;
+ deltaY = [theEvent deviceDeltaY] * pixelsToDegrees;
+ deltaZ = [theEvent deviceDeltaZ] * pixelsToDegrees;
+ }
+
} else {
// carbonEventKind == kEventMouseWheelMoved
// Remove acceleration, and use either -120 or 120 as delta:
diff --git a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
index 327bace123..da6e4d0481 100644
--- a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
+++ b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -53,14 +53,16 @@
@implementation QNSView (QNSViewAccessibility)
+// The QNSView is a container that the user does not interact directly with:
+// Remove it from the user-visible accessibility tree.
- (BOOL)accessibilityIsIgnored {
- return NO;
+ return YES;
}
- (id)accessibilityAttributeValue:(NSString *)attribute {
if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) {
if (m_accessibleRoot)
- return macRole(m_accessibleRoot->role());
+ return QCocoaAccessible::macRole(m_accessibleRoot->role());
return NSAccessibilityUnknownRole;
} else if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) {
return NSAccessibilityRoleDescriptionForUIElement(self);
@@ -83,34 +85,19 @@
}
- (id)accessibilityHitTest:(NSPoint)point {
+ if (!m_accessibleRoot)
+ return [super accessibilityHitTest:point];
NSPoint windowPoint = [[self window] convertScreenToBase:point];
- NSPoint localPoint = [self convertPoint:windowPoint fromView:nil];
-
- int index = -1;
- if (m_accessibleRoot) {
- index = m_accessibleRoot->childAt(point.x, qt_mac_flipYCoordinate(point.y));
-
- // qDebug() << "root rect" << m_accessibleRoot->rect();
- // qDebug() << "hit screen" << point.x << qt_mac_flipYCoordinate(point.y) << index;
- // if (index > 0) {
- // qDebug() << "child name" << m_accessibleRoot->child(index - 1)->text(QAccessible::Name);
- // qDebug() << "child rect" << m_accessibleRoot->child(index - 1)->rect();
- // }
- }
- // hit outside
- if (index == -1) {
+ QAccessibleInterface *childInterface = m_accessibleRoot->childAt(point.x, qt_mac_flipYCoordinate(point.y));
+ // No child found, meaning we hit the NSView
+ if (!childInterface) {
return [super accessibilityHitTest:point];
}
- // hit the NSView / top-level window
- if (index == 0) {
- QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement elementWithIndex:index parent:self accessibleInterface:(void*)m_accessibleRoot];
- return [accessibleElement accessibilityHitTest:point];
- }
-
- // hit a child, forward to child accessible interface.
- QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement elementWithIndex:index - 1 parent:self accessibleInterface:(void*)m_accessibleRoot->child(index -1)];
+ // Hit a child, forward to child accessible interface.
+ int childIndex = m_accessibleRoot->indexOfChild(childInterface);
+ QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement elementWithIndex:childIndex -1 parent:self accessibleInterface: childInterface];
return [accessibleElement accessibilityHitTest:point];
}
diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.h b/src/plugins/platforms/cocoa/qnswindowdelegate.h
index 5cd226a71d..c41477cc49 100644
--- a/src/plugins/platforms/cocoa/qnswindowdelegate.h
+++ b/src/plugins/platforms/cocoa/qnswindowdelegate.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
index 869ef7840b..ddbff031c9 100644
--- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm
+++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/main.cpp b/src/plugins/platforms/directfb/main.cpp
index 1a254e4fe7..77d8a7e519 100644
--- a/src/plugins/platforms/directfb/main.cpp
+++ b/src/plugins/platforms/directfb/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfb_egl.cpp b/src/plugins/platforms/directfb/qdirectfb_egl.cpp
index 958a3be5e3..0736b284c9 100644
--- a/src/plugins/platforms/directfb/qdirectfb_egl.cpp
+++ b/src/plugins/platforms/directfb/qdirectfb_egl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfb_egl.h b/src/plugins/platforms/directfb/qdirectfb_egl.h
index 9e53939232..652a5b53da 100644
--- a/src/plugins/platforms/directfb/qdirectfb_egl.h
+++ b/src/plugins/platforms/directfb/qdirectfb_egl.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp b/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp
index 9666deb1c7..8e03cde101 100644
--- a/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfbbackingstore.h b/src/plugins/platforms/directfb/qdirectfbbackingstore.h
index 2b129d547e..d51237e7e8 100644
--- a/src/plugins/platforms/directfb/qdirectfbbackingstore.h
+++ b/src/plugins/platforms/directfb/qdirectfbbackingstore.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.cpp b/src/plugins/platforms/directfb/qdirectfbblitter.cpp
index 63b98a3fcb..bb5fa0b288 100644
--- a/src/plugins/platforms/directfb/qdirectfbblitter.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbblitter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.h b/src/plugins/platforms/directfb/qdirectfbblitter.h
index d1c6a0d6ee..99120dd25f 100644
--- a/src/plugins/platforms/directfb/qdirectfbblitter.h
+++ b/src/plugins/platforms/directfb/qdirectfbblitter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
index a448cc7f6f..9df56ac66a 100644
--- a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.h b/src/plugins/platforms/directfb/qdirectfbconvenience.h
index 3a6176a216..1dfce81eab 100644
--- a/src/plugins/platforms/directfb/qdirectfbconvenience.h
+++ b/src/plugins/platforms/directfb/qdirectfbconvenience.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.cpp b/src/plugins/platforms/directfb/qdirectfbcursor.cpp
index 1d3b2b37a3..3967630fde 100644
--- a/src/plugins/platforms/directfb/qdirectfbcursor.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbcursor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.h b/src/plugins/platforms/directfb/qdirectfbcursor.h
index ec0c7446fa..8a95f03d61 100644
--- a/src/plugins/platforms/directfb/qdirectfbcursor.h
+++ b/src/plugins/platforms/directfb/qdirectfbcursor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp
index 7c888ddcac..91ae24d976 100644
--- a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfbglcontext.h b/src/plugins/platforms/directfb/qdirectfbglcontext.h
index 2311ff2d04..4a6018a99a 100644
--- a/src/plugins/platforms/directfb/qdirectfbglcontext.h
+++ b/src/plugins/platforms/directfb/qdirectfbglcontext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfbinput.cpp b/src/plugins/platforms/directfb/qdirectfbinput.cpp
index 3b803537ba..bcb291cdde 100644
--- a/src/plugins/platforms/directfb/qdirectfbinput.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbinput.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfbinput.h b/src/plugins/platforms/directfb/qdirectfbinput.h
index 5641943970..ab9aa912a1 100644
--- a/src/plugins/platforms/directfb/qdirectfbinput.h
+++ b/src/plugins/platforms/directfb/qdirectfbinput.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp
index b40e64e25a..6c579f0dc7 100644
--- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.h b/src/plugins/platforms/directfb/qdirectfbintegration.h
index 42a085261d..58372b4178 100644
--- a/src/plugins/platforms/directfb/qdirectfbintegration.h
+++ b/src/plugins/platforms/directfb/qdirectfbintegration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfbscreen.cpp b/src/plugins/platforms/directfb/qdirectfbscreen.cpp
index c903a2995c..6b9855e489 100644
--- a/src/plugins/platforms/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbscreen.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfbscreen.h b/src/plugins/platforms/directfb/qdirectfbscreen.h
index b9d53beaa5..a3e1f1eebf 100644
--- a/src/plugins/platforms/directfb/qdirectfbscreen.h
+++ b/src/plugins/platforms/directfb/qdirectfbscreen.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.cpp b/src/plugins/platforms/directfb/qdirectfbwindow.cpp
index 4648ed42f0..b18970cb50 100644
--- a/src/plugins/platforms/directfb/qdirectfbwindow.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbwindow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -82,7 +82,7 @@ QDirectFbWindow::QDirectFbWindow(QWindow *tlw, QDirectFbInput *inputhandler)
DFBResult result = layer->CreateWindow(layer, &description, m_dfbWindow.outPtr());
if (result != DFB_OK) {
- DirectFBError("QDirectFbGraphicsSystemScreen: failed to create window",result);
+ DirectFBError("QDirectFbWindow: failed to create window", result);
}
m_dfbWindow->SetOpacity(m_dfbWindow.data(), 0xff);
diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.h b/src/plugins/platforms/directfb/qdirectfbwindow.h
index 35b44ca8df..bf009a1441 100644
--- a/src/plugins/platforms/directfb/qdirectfbwindow.h
+++ b/src/plugins/platforms/directfb/qdirectfbwindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/eglfs/main.cpp b/src/plugins/platforms/eglfs/main.cpp
index 050dc62ac7..f88ef1c928 100644
--- a/src/plugins/platforms/eglfs/main.cpp
+++ b/src/plugins/platforms/eglfs/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp b/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp
index 1d27be7fb3..448958758a 100644
--- a/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -79,18 +79,18 @@ QEglFSBackingStore::QEglFSBackingStore(QWindow *window)
: QPlatformBackingStore(window)
{
#ifdef QEGL_EXTRA_DEBUG
- qWarning("QEglBackingStore %p, %p", window, screen);
+ qWarning("QEglBackingStore %p, %p", window, window->screen());
#endif
m_paintDevice = new QEglFSPaintDevice(static_cast<QEglFSScreen *>(window->screen()->handle()));
}
-void QEglFSBackingStore::flush(QWindow *widget, const QRegion &region, const QPoint &offset)
+void QEglFSBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{
- Q_UNUSED(widget);
+ Q_UNUSED(window);
Q_UNUSED(region);
Q_UNUSED(offset);
#ifdef QEGL_EXTRA_DEBUG
- qWarning("QEglBackingStore::flush %p",widget);
+ qWarning("QEglBackingStore::flush %p", window);
#endif
static_cast<QEglFSPaintDevice *>(m_paintDevice)->context()->swapBuffers();
}
diff --git a/src/plugins/platforms/eglfs/qeglfsbackingstore.h b/src/plugins/platforms/eglfs/qeglfsbackingstore.h
index d6a28a7665..7057544174 100644
--- a/src/plugins/platforms/eglfs/qeglfsbackingstore.h
+++ b/src/plugins/platforms/eglfs/qeglfsbackingstore.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index 57579e8fef..47d5bd49eb 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -90,7 +90,7 @@ QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWindow *window) const
QPlatformBackingStore *QEglFSIntegration::createPlatformBackingStore(QWindow *window) const
{
#ifdef QEGL_EXTRA_DEBUG
- qWarning("QEglIntegration::createWindowSurface %p\n",widget);
+ qWarning("QEglIntegration::createWindowSurface %p\n", window);
#endif
return new QEglFSBackingStore(window);
}
@@ -110,4 +110,12 @@ QAbstractEventDispatcher *QEglFSIntegration::guiThreadEventDispatcher() const
return createUnixEventDispatcher();
}
+QVariant QEglFSIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
+{
+ if (hint == QPlatformIntegration::ShowIsFullScreen)
+ return true;
+
+ return QPlatformIntegration::styleHint(hint);
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h
index 9538850faf..58af1462b0 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.h
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -66,6 +66,8 @@ public:
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
+ QVariant styleHint(QPlatformIntegration::StyleHint hint) const;
+
private:
QPlatformFontDatabase *mFontDb;
};
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
index abbe0d951f..ad1db3cd1c 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/qeglfsscreen.h
index 41465d871c..c9b9ecd442 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.h
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp
index a6115cc829..7c5df8b197 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h
index 09f553d3b7..83ad7886b3 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.h
+++ b/src/plugins/platforms/eglfs/qeglfswindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/kms/main.cpp b/src/plugins/platforms/kms/main.cpp
index a07f1645dc..743b82dbf4 100644
--- a/src/plugins/platforms/kms/main.cpp
+++ b/src/plugins/platforms/kms/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/kms/qkmsbackingstore.cpp b/src/plugins/platforms/kms/qkmsbackingstore.cpp
index eb682e8ab3..7d6e709c4d 100644
--- a/src/plugins/platforms/kms/qkmsbackingstore.cpp
+++ b/src/plugins/platforms/kms/qkmsbackingstore.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/kms/qkmsbackingstore.h b/src/plugins/platforms/kms/qkmsbackingstore.h
index e270d04db0..6d06697cf1 100644
--- a/src/plugins/platforms/kms/qkmsbackingstore.h
+++ b/src/plugins/platforms/kms/qkmsbackingstore.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/kms/qkmsbuffermanager.cpp b/src/plugins/platforms/kms/qkmsbuffermanager.cpp
index 0c2eec0f3b..743c592383 100644
--- a/src/plugins/platforms/kms/qkmsbuffermanager.cpp
+++ b/src/plugins/platforms/kms/qkmsbuffermanager.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/kms/qkmsbuffermanager.h b/src/plugins/platforms/kms/qkmsbuffermanager.h
index 59db7ebeb1..1a0a41cf47 100644
--- a/src/plugins/platforms/kms/qkmsbuffermanager.h
+++ b/src/plugins/platforms/kms/qkmsbuffermanager.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/kms/qkmscontext.cpp b/src/plugins/platforms/kms/qkmscontext.cpp
index f27673a24d..5a966deca4 100644
--- a/src/plugins/platforms/kms/qkmscontext.cpp
+++ b/src/plugins/platforms/kms/qkmscontext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/kms/qkmscontext.h b/src/plugins/platforms/kms/qkmscontext.h
index 2f4f44c3d0..e1c636d925 100644
--- a/src/plugins/platforms/kms/qkmscontext.h
+++ b/src/plugins/platforms/kms/qkmscontext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/kms/qkmscursor.cpp b/src/plugins/platforms/kms/qkmscursor.cpp
index 91c23b0f1c..825c884a98 100644
--- a/src/plugins/platforms/kms/qkmscursor.cpp
+++ b/src/plugins/platforms/kms/qkmscursor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/kms/qkmscursor.h b/src/plugins/platforms/kms/qkmscursor.h
index 96be88e991..b4276c7b0c 100644
--- a/src/plugins/platforms/kms/qkmscursor.h
+++ b/src/plugins/platforms/kms/qkmscursor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/kms/qkmsdevice.cpp b/src/plugins/platforms/kms/qkmsdevice.cpp
index e0fac5611d..ed33829baa 100644
--- a/src/plugins/platforms/kms/qkmsdevice.cpp
+++ b/src/plugins/platforms/kms/qkmsdevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/kms/qkmsdevice.h b/src/plugins/platforms/kms/qkmsdevice.h
index 4868a72ede..5b4583a03b 100644
--- a/src/plugins/platforms/kms/qkmsdevice.h
+++ b/src/plugins/platforms/kms/qkmsdevice.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/kms/qkmsintegration.cpp b/src/plugins/platforms/kms/qkmsintegration.cpp
index d0055f258a..5d219d7327 100644
--- a/src/plugins/platforms/kms/qkmsintegration.cpp
+++ b/src/plugins/platforms/kms/qkmsintegration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/kms/qkmsintegration.h b/src/plugins/platforms/kms/qkmsintegration.h
index 15bbd1b827..4b3f5dc74b 100644
--- a/src/plugins/platforms/kms/qkmsintegration.h
+++ b/src/plugins/platforms/kms/qkmsintegration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/kms/qkmsscreen.cpp b/src/plugins/platforms/kms/qkmsscreen.cpp
index 9ea20ae505..26189b2d13 100644
--- a/src/plugins/platforms/kms/qkmsscreen.cpp
+++ b/src/plugins/platforms/kms/qkmsscreen.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/kms/qkmsscreen.h b/src/plugins/platforms/kms/qkmsscreen.h
index 5807366f8b..f78663dbf4 100644
--- a/src/plugins/platforms/kms/qkmsscreen.h
+++ b/src/plugins/platforms/kms/qkmsscreen.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/kms/qkmswindow.cpp b/src/plugins/platforms/kms/qkmswindow.cpp
index 63271c4ef5..5d540a8eb6 100644
--- a/src/plugins/platforms/kms/qkmswindow.cpp
+++ b/src/plugins/platforms/kms/qkmswindow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/kms/qkmswindow.h b/src/plugins/platforms/kms/qkmswindow.h
index 789d42e6f8..6433ab7fd9 100644
--- a/src/plugins/platforms/kms/qkmswindow.h
+++ b/src/plugins/platforms/kms/qkmswindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/linuxfb/main.cpp b/src/plugins/platforms/linuxfb/main.cpp
index aca8110c77..99efc68a32 100644
--- a/src/plugins/platforms/linuxfb/main.cpp
+++ b/src/plugins/platforms/linuxfb/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
index 1c098a0ffc..7f76b045de 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
+++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
index f972a30452..1c10a6b8fc 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
+++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/minimal/main.cpp b/src/plugins/platforms/minimal/main.cpp
index 2627855ea0..4d9b24edc1 100644
--- a/src/plugins/platforms/minimal/main.cpp
+++ b/src/plugins/platforms/minimal/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/minimal/qminimalbackingstore.cpp b/src/plugins/platforms/minimal/qminimalbackingstore.cpp
index 08281405a4..c564e8eff0 100644
--- a/src/plugins/platforms/minimal/qminimalbackingstore.cpp
+++ b/src/plugins/platforms/minimal/qminimalbackingstore.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/minimal/qminimalbackingstore.h b/src/plugins/platforms/minimal/qminimalbackingstore.h
index 9b61275e9d..717474cd27 100644
--- a/src/plugins/platforms/minimal/qminimalbackingstore.h
+++ b/src/plugins/platforms/minimal/qminimalbackingstore.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp
index 7d882caecf..05fd28a08b 100644
--- a/src/plugins/platforms/minimal/qminimalintegration.cpp
+++ b/src/plugins/platforms/minimal/qminimalintegration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h
index 0835c39ab6..01118c32ee 100644
--- a/src/plugins/platforms/minimal/qminimalintegration.h
+++ b/src/plugins/platforms/minimal/qminimalintegration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openkode/main.cpp b/src/plugins/platforms/openkode/main.cpp
index a93ee780f8..7b857d288c 100644
--- a/src/plugins/platforms/openkode/main.cpp
+++ b/src/plugins/platforms/openkode/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openkode/openkodekeytranslator.h b/src/plugins/platforms/openkode/openkodekeytranslator.h
index cd99daf1fa..37f697a787 100644
--- a/src/plugins/platforms/openkode/openkodekeytranslator.h
+++ b/src/plugins/platforms/openkode/openkodekeytranslator.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp
index 418b3d7ae6..c4808790e0 100644
--- a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp
+++ b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h
index 7dadc29148..1e9960f011 100644
--- a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h
+++ b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp
index 38c4325bb4..c882cb96c7 100644
--- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp
+++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h
index 43961add6d..c10aecb821 100644
--- a/src/plugins/platforms/openkode/qopenkodeintegration.h
+++ b/src/plugins/platforms/openkode/qopenkodeintegration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp
index e20904470f..14f7438b99 100644
--- a/src/plugins/platforms/openkode/qopenkodewindow.cpp
+++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openkode/qopenkodewindow.h b/src/plugins/platforms/openkode/qopenkodewindow.h
index f48c3a2bc0..3142aa2faa 100644
--- a/src/plugins/platforms/openkode/qopenkodewindow.h
+++ b/src/plugins/platforms/openkode/qopenkodewindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openkode/shaders/frag.glslf b/src/plugins/platforms/openkode/shaders/frag.glslf
index 2d54d90e46..a48a342679 100644
--- a/src/plugins/platforms/openkode/shaders/frag.glslf
+++ b/src/plugins/platforms/openkode/shaders/frag.glslf
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openkode/shaders/vert.glslv b/src/plugins/platforms/openkode/shaders/vert.glslv
index 22dee8c8ac..3eb8010773 100644
--- a/src/plugins/platforms/openkode/shaders/vert.glslv
+++ b/src/plugins/platforms/openkode/shaders/vert.glslv
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openvglite/main.cpp b/src/plugins/platforms/openvglite/main.cpp
index 19220a6574..de6b2e38b3 100644
--- a/src/plugins/platforms/openvglite/main.cpp
+++ b/src/plugins/platforms/openvglite/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp
index d8e4cc984c..29a02fedb5 100644
--- a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp
+++ b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h
index 6dc6a38439..c661ad8ffe 100644
--- a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h
+++ b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp b/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp
index dad23c1638..17136b88a1 100644
--- a/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp
+++ b/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openvglite/qwindowsurface_vglite.h b/src/plugins/platforms/openvglite/qwindowsurface_vglite.h
index b6e22d820c..2bd7b9e417 100644
--- a/src/plugins/platforms/openvglite/qwindowsurface_vglite.h
+++ b/src/plugins/platforms/openvglite/qwindowsurface_vglite.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/main.cpp b/src/plugins/platforms/openwfd/main.cpp
index c0159e7218..c7c05718ad 100644
--- a/src/plugins/platforms/openwfd/main.cpp
+++ b/src/plugins/platforms/openwfd/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdbackingstore.cpp b/src/plugins/platforms/openwfd/qopenwfdbackingstore.cpp
index 9e2d86a618..b166d6e7f9 100644
--- a/src/plugins/platforms/openwfd/qopenwfdbackingstore.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdbackingstore.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdbackingstore.h b/src/plugins/platforms/openwfd/qopenwfdbackingstore.h
index c173de6c19..f7b2bb9734 100644
--- a/src/plugins/platforms/openwfd/qopenwfdbackingstore.h
+++ b/src/plugins/platforms/openwfd/qopenwfdbackingstore.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfddevice.cpp b/src/plugins/platforms/openwfd/qopenwfddevice.cpp
index d3ff6d45d8..5c3049cfe4 100644
--- a/src/plugins/platforms/openwfd/qopenwfddevice.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfddevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfddevice.h b/src/plugins/platforms/openwfd/qopenwfddevice.h
index 83a5539124..32c3c0f74b 100644
--- a/src/plugins/platforms/openwfd/qopenwfddevice.h
+++ b/src/plugins/platforms/openwfd/qopenwfddevice.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdevent.cpp b/src/plugins/platforms/openwfd/qopenwfdevent.cpp
index 748dde65e7..3a54210bf8 100644
--- a/src/plugins/platforms/openwfd/qopenwfdevent.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdevent.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdevent.h b/src/plugins/platforms/openwfd/qopenwfdevent.h
index 3010fdb55b..e807afbe36 100644
--- a/src/plugins/platforms/openwfd/qopenwfdevent.h
+++ b/src/plugins/platforms/openwfd/qopenwfdevent.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdglcontext.cpp b/src/plugins/platforms/openwfd/qopenwfdglcontext.cpp
index 0db717c4d6..e83c0da42c 100644
--- a/src/plugins/platforms/openwfd/qopenwfdglcontext.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdglcontext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdglcontext.h b/src/plugins/platforms/openwfd/qopenwfdglcontext.h
index 3287a853c7..bef8739fcb 100644
--- a/src/plugins/platforms/openwfd/qopenwfdglcontext.h
+++ b/src/plugins/platforms/openwfd/qopenwfdglcontext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdintegration.cpp b/src/plugins/platforms/openwfd/qopenwfdintegration.cpp
index 3d57759183..ad9afb345d 100644
--- a/src/plugins/platforms/openwfd/qopenwfdintegration.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdintegration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdintegration.h b/src/plugins/platforms/openwfd/qopenwfdintegration.h
index b5315b31da..0359dc60d6 100644
--- a/src/plugins/platforms/openwfd/qopenwfdintegration.h
+++ b/src/plugins/platforms/openwfd/qopenwfdintegration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdnativeinterface.cpp b/src/plugins/platforms/openwfd/qopenwfdnativeinterface.cpp
index 758e0c4398..b9647ac9c4 100644
--- a/src/plugins/platforms/openwfd/qopenwfdnativeinterface.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdnativeinterface.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdnativeinterface.h b/src/plugins/platforms/openwfd/qopenwfdnativeinterface.h
index cff49dc8b0..5311d75f0e 100644
--- a/src/plugins/platforms/openwfd/qopenwfdnativeinterface.h
+++ b/src/plugins/platforms/openwfd/qopenwfdnativeinterface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp b/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp
index fb3292c31a..da144b841e 100644
--- a/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.h b/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.h
index 1697f076a9..b852286061 100644
--- a/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.h
+++ b/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdport.cpp b/src/plugins/platforms/openwfd/qopenwfdport.cpp
index 5f38e48eed..7da54acbb7 100644
--- a/src/plugins/platforms/openwfd/qopenwfdport.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdport.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdport.h b/src/plugins/platforms/openwfd/qopenwfdport.h
index 497c43749e..9378c3bc6a 100644
--- a/src/plugins/platforms/openwfd/qopenwfdport.h
+++ b/src/plugins/platforms/openwfd/qopenwfdport.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdportmode.cpp b/src/plugins/platforms/openwfd/qopenwfdportmode.cpp
index 4e507a42a1..669ace68c3 100644
--- a/src/plugins/platforms/openwfd/qopenwfdportmode.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdportmode.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdportmode.h b/src/plugins/platforms/openwfd/qopenwfdportmode.h
index dd95339404..93297d5673 100644
--- a/src/plugins/platforms/openwfd/qopenwfdportmode.h
+++ b/src/plugins/platforms/openwfd/qopenwfdportmode.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdscreen.cpp b/src/plugins/platforms/openwfd/qopenwfdscreen.cpp
index 0d3361899b..0c6c888164 100644
--- a/src/plugins/platforms/openwfd/qopenwfdscreen.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdscreen.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdscreen.h b/src/plugins/platforms/openwfd/qopenwfdscreen.h
index fc65e504ac..5bd6cf243d 100644
--- a/src/plugins/platforms/openwfd/qopenwfdscreen.h
+++ b/src/plugins/platforms/openwfd/qopenwfdscreen.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdwindow.cpp b/src/plugins/platforms/openwfd/qopenwfdwindow.cpp
index 15dc4b11c4..00f452a226 100644
--- a/src/plugins/platforms/openwfd/qopenwfdwindow.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdwindow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/openwfd/qopenwfdwindow.h b/src/plugins/platforms/openwfd/qopenwfdwindow.h
index 3c97b014b1..10cdda650e 100644
--- a/src/plugins/platforms/openwfd/qopenwfdwindow.h
+++ b/src/plugins/platforms/openwfd/qopenwfdwindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/qvfb/main.cpp b/src/plugins/platforms/qvfb/main.cpp
index 1c6b3907f4..a603f7a414 100644
--- a/src/plugins/platforms/qvfb/main.cpp
+++ b/src/plugins/platforms/qvfb/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/qvfb/qvfbintegration.cpp b/src/plugins/platforms/qvfb/qvfbintegration.cpp
index 1ddf934ee9..ae9b3ffebf 100644
--- a/src/plugins/platforms/qvfb/qvfbintegration.cpp
+++ b/src/plugins/platforms/qvfb/qvfbintegration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/qvfb/qvfbintegration.h b/src/plugins/platforms/qvfb/qvfbintegration.h
index c6bfcc519c..cea8fe0594 100644
--- a/src/plugins/platforms/qvfb/qvfbintegration.h
+++ b/src/plugins/platforms/qvfb/qvfbintegration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp b/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp
index 3fdfe29cb1..94b743ba16 100644
--- a/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp
+++ b/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/qvfb/qvfbwindowsurface.h b/src/plugins/platforms/qvfb/qvfbwindowsurface.h
index 2759fae848..450f87c646 100644
--- a/src/plugins/platforms/qvfb/qvfbwindowsurface.h
+++ b/src/plugins/platforms/qvfb/qvfbwindowsurface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/uikit/examples/qmltest/main.mm b/src/plugins/platforms/uikit/examples/qmltest/main.mm
index 662354e13c..33d10091d8 100644
--- a/src/plugins/platforms/uikit/examples/qmltest/main.mm
+++ b/src/plugins/platforms/uikit/examples/qmltest/main.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/uikit/examples/qmltest/qml/main.qml b/src/plugins/platforms/uikit/examples/qmltest/qml/main.qml
index 889a6d063f..9f787b79dd 100644
--- a/src/plugins/platforms/uikit/examples/qmltest/qml/main.qml
+++ b/src/plugins/platforms/uikit/examples/qmltest/qml/main.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp
index a5c02becf1..cdc4c78bae 100644
--- a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp
+++ b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp
index 47d08702ac..dca4013ee8 100644
--- a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h
index d7d9fe2307..cde3bba4e4 100644
--- a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h
+++ b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/uikit/main.mm b/src/plugins/platforms/uikit/main.mm
index a0aa110508..812de5ab05 100644
--- a/src/plugins/platforms/uikit/main.mm
+++ b/src/plugins/platforms/uikit/main.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/uikit/quikiteventloop.h b/src/plugins/platforms/uikit/quikiteventloop.h
index 893ab233e9..4519f8b645 100644
--- a/src/plugins/platforms/uikit/quikiteventloop.h
+++ b/src/plugins/platforms/uikit/quikiteventloop.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/uikit/quikiteventloop.mm b/src/plugins/platforms/uikit/quikiteventloop.mm
index 8884f63475..eef5976aa9 100644
--- a/src/plugins/platforms/uikit/quikiteventloop.mm
+++ b/src/plugins/platforms/uikit/quikiteventloop.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/uikit/quikitintegration.h b/src/plugins/platforms/uikit/quikitintegration.h
index b8a15b3807..53ade53d48 100644
--- a/src/plugins/platforms/uikit/quikitintegration.h
+++ b/src/plugins/platforms/uikit/quikitintegration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/uikit/quikitintegration.mm b/src/plugins/platforms/uikit/quikitintegration.mm
index 37ba2b9a02..6d616a5317 100644
--- a/src/plugins/platforms/uikit/quikitintegration.mm
+++ b/src/plugins/platforms/uikit/quikitintegration.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/uikit/quikitscreen.h b/src/plugins/platforms/uikit/quikitscreen.h
index bde4f89a1e..ca26b3d5f9 100644
--- a/src/plugins/platforms/uikit/quikitscreen.h
+++ b/src/plugins/platforms/uikit/quikitscreen.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/uikit/quikitscreen.mm b/src/plugins/platforms/uikit/quikitscreen.mm
index b938542df4..3955ba7e85 100644
--- a/src/plugins/platforms/uikit/quikitscreen.mm
+++ b/src/plugins/platforms/uikit/quikitscreen.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/uikit/quikitsoftwareinputhandler.h b/src/plugins/platforms/uikit/quikitsoftwareinputhandler.h
index 7e4f8e9ddc..9093e26049 100644
--- a/src/plugins/platforms/uikit/quikitsoftwareinputhandler.h
+++ b/src/plugins/platforms/uikit/quikitsoftwareinputhandler.h
@@ -2,7 +2,7 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/uikit/quikitwindow.h b/src/plugins/platforms/uikit/quikitwindow.h
index 67f0242a48..b38cb877c9 100644
--- a/src/plugins/platforms/uikit/quikitwindow.h
+++ b/src/plugins/platforms/uikit/quikitwindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/uikit/quikitwindow.mm b/src/plugins/platforms/uikit/quikitwindow.mm
index cc17dbcbfb..ddf52a8ed6 100644
--- a/src/plugins/platforms/uikit/quikitwindow.mm
+++ b/src/plugins/platforms/uikit/quikitwindow.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/uikit/quikitwindowsurface.h b/src/plugins/platforms/uikit/quikitwindowsurface.h
index be3f608c59..c0f486a4dd 100644
--- a/src/plugins/platforms/uikit/quikitwindowsurface.h
+++ b/src/plugins/platforms/uikit/quikitwindowsurface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/uikit/quikitwindowsurface.mm b/src/plugins/platforms/uikit/quikitwindowsurface.mm
index 54723f8a1a..a78a47c2ea 100644
--- a/src/plugins/platforms/uikit/quikitwindowsurface.mm
+++ b/src/plugins/platforms/uikit/quikitwindowsurface.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/vnc/main.cpp b/src/plugins/platforms/vnc/main.cpp
index 333c09fc80..9fd77ea87c 100644
--- a/src/plugins/platforms/vnc/main.cpp
+++ b/src/plugins/platforms/vnc/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/vnc/qvnccursor.cpp b/src/plugins/platforms/vnc/qvnccursor.cpp
index 5073f534d8..44f3bf45fa 100644
--- a/src/plugins/platforms/vnc/qvnccursor.cpp
+++ b/src/plugins/platforms/vnc/qvnccursor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/vnc/qvnccursor.h b/src/plugins/platforms/vnc/qvnccursor.h
index 5ca603a2da..af9d6816e9 100644
--- a/src/plugins/platforms/vnc/qvnccursor.h
+++ b/src/plugins/platforms/vnc/qvnccursor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp
index 7506bff307..06eb52529a 100644
--- a/src/plugins/platforms/vnc/qvncintegration.cpp
+++ b/src/plugins/platforms/vnc/qvncintegration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/vnc/qvncintegration.h b/src/plugins/platforms/vnc/qvncintegration.h
index 9787a59f0f..c594ffb142 100644
--- a/src/plugins/platforms/vnc/qvncintegration.h
+++ b/src/plugins/platforms/vnc/qvncintegration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/vnc/qvncserver.cpp b/src/plugins/platforms/vnc/qvncserver.cpp
index 37412b6bd1..832206c2ea 100644
--- a/src/plugins/platforms/vnc/qvncserver.cpp
+++ b/src/plugins/platforms/vnc/qvncserver.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/vnc/qvncserver.h b/src/plugins/platforms/vnc/qvncserver.h
index 1ff8945f44..c3042410f4 100644
--- a/src/plugins/platforms/vnc/qvncserver.h
+++ b/src/plugins/platforms/vnc/qvncserver.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/array.h b/src/plugins/platforms/windows/array.h
index 699bff5ac1..f098a77d00 100644
--- a/src/plugins/platforms/windows/array.h
+++ b/src/plugins/platforms/windows/array.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/main.cpp b/src/plugins/platforms/windows/main.cpp
index 69ef24be72..4d8d4e732e 100644
--- a/src/plugins/platforms/windows/main.cpp
+++ b/src/plugins/platforms/windows/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qtwindows_additional.h b/src/plugins/platforms/windows/qtwindows_additional.h
index 770da9e9c6..abb38a1bfd 100644
--- a/src/plugins/platforms/windows/qtwindows_additional.h
+++ b/src/plugins/platforms/windows/qtwindows_additional.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h
index 254463e445..599fb0d201 100644
--- a/src/plugins/platforms/windows/qtwindowsglobal.h
+++ b/src/plugins/platforms/windows/qtwindowsglobal.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/qwindowsaccessibility.cpp
index aa4507484d..fdf6c9116e 100644
--- a/src/plugins/platforms/windows/qwindowsaccessibility.cpp
+++ b/src/plugins/platforms/windows/qwindowsaccessibility.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -92,184 +92,9 @@ QT_BEGIN_INCLUDE_NAMESPACE
#include <qdebug.h>
QT_END_INCLUDE_NAMESPACE
-static const char *roleString(QAccessible::Role role)
-{
- static const char *roles[] = {
- "NoRole" /* = 0x00000000 */,
- "TitleBar" /* = 0x00000001 */,
- "MenuBar" /* = 0x00000002 */,
- "ScrollBar" /* = 0x00000003 */,
- "Grip" /* = 0x00000004 */,
- "Sound" /* = 0x00000005 */,
- "Cursor" /* = 0x00000006 */,
- "Caret" /* = 0x00000007 */,
- "AlertMessage" /* = 0x00000008 */,
- "Window" /* = 0x00000009 */,
- "Client" /* = 0x0000000A */,
- "PopupMenu" /* = 0x0000000B */,
- "MenuItem" /* = 0x0000000C */,
- "ToolTip" /* = 0x0000000D */,
- "Application" /* = 0x0000000E */,
- "Document" /* = 0x0000000F */,
- "Pane" /* = 0x00000010 */,
- "Chart" /* = 0x00000011 */,
- "Dialog" /* = 0x00000012 */,
- "Border" /* = 0x00000013 */,
- "Grouping" /* = 0x00000014 */,
- "Separator" /* = 0x00000015 */,
- "ToolBar" /* = 0x00000016 */,
- "StatusBar" /* = 0x00000017 */,
- "Table" /* = 0x00000018 */,
- "ColumnHeader" /* = 0x00000019 */,
- "RowHeader" /* = 0x0000001A */,
- "Column" /* = 0x0000001B */,
- "Row" /* = 0x0000001C */,
- "Cell" /* = 0x0000001D */,
- "Link" /* = 0x0000001E */,
- "HelpBalloon" /* = 0x0000001F */,
- "Assistant" /* = 0x00000020 */,
- "List" /* = 0x00000021 */,
- "ListItem" /* = 0x00000022 */,
- "Tree" /* = 0x00000023 */,
- "TreeItem" /* = 0x00000024 */,
- "PageTab" /* = 0x00000025 */,
- "PropertyPage" /* = 0x00000026 */,
- "Indicator" /* = 0x00000027 */,
- "Graphic" /* = 0x00000028 */,
- "StaticText" /* = 0x00000029 */,
- "EditableText" /* = 0x0000002A */, // Editable, selectable, etc.
- "PushButton" /* = 0x0000002B */,
- "CheckBox" /* = 0x0000002C */,
- "RadioButton" /* = 0x0000002D */,
- "ComboBox" /* = 0x0000002E */,
- "DropList" /* = 0x0000002F */, // commented out
- "ProgressBar" /* = 0x00000030 */,
- "Dial" /* = 0x00000031 */,
- "HotkeyField" /* = 0x00000032 */,
- "Slider" /* = 0x00000033 */,
- "SpinBox" /* = 0x00000034 */,
- "Canvas" /* = 0x00000035 */,
- "Animation" /* = 0x00000036 */,
- "Equation" /* = 0x00000037 */,
- "ButtonDropDown" /* = 0x00000038 */,
- "ButtonMenu" /* = 0x00000039 */,
- "ButtonDropGrid" /* = 0x0000003A */,
- "Whitespace" /* = 0x0000003B */,
- "PageTabList" /* = 0x0000003C */,
- "Clock" /* = 0x0000003D */,
- "Splitter" /* = 0x0000003E */,
- "LayeredPane" /* = 0x0000003F */,
- "UserRole" /* = 0x0000ffff*/
- };
-
- if (role >=0x40)
- role = QAccessible::UserRole;
- return roles[int(role)];
-}
-
-static const char *eventString(QAccessible::Event ev)
-{
- static const char *events[] = {
- "null", // 0
- "SoundPlayed" /*= 0x0001*/,
- "Alert" /*= 0x0002*/,
- "ForegroundChanged" /*= 0x0003*/,
- "MenuStart" /*= 0x0004*/,
- "MenuEnd" /*= 0x0005*/,
- "PopupMenuStart" /*= 0x0006*/,
- "PopupMenuEnd" /*= 0x0007*/,
- "ContextHelpStart" /*= 0x000C*/, // 8
- "ContextHelpEnd" /*= 0x000D*/,
- "DragDropStart" /*= 0x000E*/,
- "DragDropEnd" /*= 0x000F*/,
- "DialogStart" /*= 0x0010*/,
- "DialogEnd" /*= 0x0011*/,
- "ScrollingStart" /*= 0x0012*/,
- "ScrollingEnd" /*= 0x0013*/,
- "MenuCommand" /*= 0x0018*/, // 16
-
- // Values from IAccessible2
- "ActionChanged" /*= 0x0101*/, // 17
- "ActiveDescendantChanged",
- "AttributeChanged",
- "DocumentContentChanged",
- "DocumentLoadComplete",
- "DocumentLoadStopped",
- "DocumentReload",
- "HyperlinkEndIndexChanged",
- "HyperlinkNumberOfAnchorsChanged",
- "HyperlinkSelectedLinkChanged",
- "HypertextLinkActivated",
- "HypertextLinkSelected",
- "HyperlinkStartIndexChanged",
- "HypertextChanged",
- "HypertextNLinksChanged",
- "ObjectAttributeChanged",
- "PageChanged",
- "SectionChanged",
- "TableCaptionChanged",
- "TableColumnDescriptionChanged",
- "TableColumnHeaderChanged",
- "TableModelChanged",
- "TableRowDescriptionChanged",
- "TableRowHeaderChanged",
- "TableSummaryChanged",
- "TextAttributeChanged",
- "TextCaretMoved",
- // TextChanged, deprecated, use TextUpdated
- //TextColumnChanged = TextCaretMoved + 2,
- "TextInserted",
- "TextRemoved",
- "TextUpdated",
- "TextSelectionChanged",
- "VisibleDataChanged", /*= 0x0101+32*/
- "ObjectCreated" /*= 0x8000*/, // 49
- "ObjectDestroyed" /*= 0x8001*/,
- "ObjectShow" /*= 0x8002*/,
- "ObjectHide" /*= 0x8003*/,
- "ObjectReorder" /*= 0x8004*/,
- "Focus" /*= 0x8005*/,
- "Selection" /*= 0x8006*/,
- "SelectionAdd" /*= 0x8007*/,
- "SelectionRemove" /*= 0x8008*/,
- "SelectionWithin" /*= 0x8009*/,
- "StateChanged" /*= 0x800A*/,
- "LocationChanged" /*= 0x800B*/,
- "NameChanged" /*= 0x800C*/,
- "DescriptionChanged" /*= 0x800D*/,
- "ValueChanged" /*= 0x800E*/,
- "ParentChanged" /*= 0x800F*/,
- "HelpChanged" /*= 0x80A0*/,
- "DefaultActionChanged" /*= 0x80B0*/,
- "AcceleratorChanged" /*= 0x80C0*/
- };
- int e = int(ev);
- if (e <= 0x80c0) {
- const int last = sizeof(events)/sizeof(char*) - 1;
-
- if (e <= 0x07)
- return events[e];
- else if (e <= 0x13)
- return events[e - 0x0c + 8];
- else if (e == 0x18)
- return events[16];
- else if (e <= 0x0101 + 32)
- return events[e - 0x101 + 17];
- else if (e <= 0x800f)
- return events[e - 0x8000 + 49];
- else if (e == 0x80a0)
- return events[last - 2];
- else if (e == 0x80b0)
- return events[last - 1];
- else if (e == 0x80c0)
- return events[last];
- }
- return "unknown";
-};
-
void showDebug(const char* funcName, const QAccessibleInterface *iface)
{
- qDebug() << "Role:" << roleString(iface->role(0))
+ qDebug() << "Role:" << qAccessibleRoleString(iface->role(0))
<< "Name:" << iface->text(QAccessible::Name, 0)
<< "State:" << QString::number(int(iface->state(0)), 16)
<< QLatin1String(funcName);
@@ -746,38 +571,52 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::Invoke(long dispIdMember, const _G
/*
IAccessible
+
+IAccessible::accHitTest documents the value returned in pvarID like this:
+
+| *Point location* | *vt member* | *Value member* |
++========================================================+=============+=========================+
+| Outside of the object's boundaries, and either inside | VT_EMPTY | None. |
+| or outside of the object's bounding rectangle. | | |
++--------------------------------------------------------+-------------+-------------------------+
+| Within the object but not within a child element or a | VT_I4 | lVal is CHILDID_SELF |
+| child object. | | |
++--------------------------------------------------------+-------------+-------------------------+
+| Within a child element. | VT_I4 | lVal contains |
+| | | the child ID. |
++--------------------------------------------------------+-------------+-------------------------+
+| Within a child object. | VT_DISPATCH | pdispVal is set to the |
+| | | child object's IDispatch|
+| | | interface pointer |
++--------------------------------------------------------+-------------+-------------------------+
*/
HRESULT STDMETHODCALLTYPE QWindowsAccessible::accHitTest(long xLeft, long yTop, VARIANT *pvarID)
{
+
showDebug(__FUNCTION__, accessible);
if (!accessible->isValid())
return E_FAIL;
- int control = accessible->childAt(xLeft, yTop);
- if (control == -1) {
- (*pvarID).vt = VT_EMPTY;
- return S_FALSE;
- }
- QAccessibleInterface *acc = 0;
- if (control)
- accessible->navigate(QAccessible::Child, control, &acc);
- if (!acc) {
- (*pvarID).vt = VT_I4;
- (*pvarID).lVal = control;
- return S_OK;
- }
-
- QWindowsAccessible* wacc = new QWindowsAccessible(acc);
- IDispatch *iface = 0;
- wacc->QueryInterface(IID_IDispatch, (void**)&iface);
- if (iface) {
- (*pvarID).vt = VT_DISPATCH;
- (*pvarID).pdispVal = iface;
- return S_OK;
+ QAccessibleInterface *child = accessible->childAt(xLeft, yTop);
+ if (child == 0) {
+ // no child found, return this item if it contains the coordinates
+ if (accessible->rect().contains(xLeft, yTop)) {
+ (*pvarID).vt = VT_I4;
+ (*pvarID).lVal = CHILDID_SELF;
+ return S_OK;
+ }
} else {
- delete wacc;
+ QWindowsAccessible* wacc = new QWindowsAccessible(child);
+ IDispatch *iface = 0;
+ wacc->QueryInterface(IID_IDispatch, (void**)&iface);
+ if (iface) {
+ (*pvarID).vt = VT_DISPATCH;
+ (*pvarID).pdispVal = iface;
+ return S_OK;
+ }
}
+ // Did not find anything
(*pvarID).vt = VT_EMPTY;
return S_FALSE;
}
@@ -823,13 +662,12 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::accNavigate(long navDir, VARIANT v
return E_FAIL;
QAccessibleInterface *acc = 0;
- int control = -1;
switch (navDir) {
case NAVDIR_FIRSTCHILD:
- control = accessible->navigate(QAccessible::Child, 1, &acc);
+ acc = accessible->child(0);
break;
case NAVDIR_LASTCHILD:
- control = accessible->navigate(QAccessible::Child, accessible->childCount(), &acc);
+ acc = accessible->child(accessible->childCount() - 1);
break;
case NAVDIR_NEXT:
case NAVDIR_PREVIOUS:
@@ -838,42 +676,108 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::accNavigate(long navDir, VARIANT v
if (parent) {
int index = parent->indexOfChild(accessible);
index += (navDir == NAVDIR_NEXT) ? 1 : -1;
- if (index > 0 && index <= parent->childCount())
- control = parent->navigate(QAccessible::Child, index, &acc);
+ if (index >= 0 && index < parent->childCount())
+ acc = parent->child(index);
delete parent;
}
} else {
int index = varStart.lVal;
index += (navDir == NAVDIR_NEXT) ? 1 : -1;
if (index > 0 && index <= accessible->childCount())
- control = accessible->navigate(QAccessible::Child, index, &acc);
+ acc = accessible->child(index - 1);
}
break;
+
+ // Geometrical
case NAVDIR_UP:
- control = accessible->navigate(QAccessible::Up, varStart.lVal, &acc);
- break;
case NAVDIR_DOWN:
- control = accessible->navigate(QAccessible::Down, varStart.lVal, &acc);
- break;
case NAVDIR_LEFT:
- control = accessible->navigate(QAccessible::Left, varStart.lVal, &acc);
- break;
case NAVDIR_RIGHT:
- control = accessible->navigate(QAccessible::Right, varStart.lVal, &acc);
+ if (QAccessibleInterface *pIface = accessible->parent()) {
+
+ QRect startg = accessible->rect();
+ QPoint startc = startg.center();
+ QAccessibleInterface *candidate = 0;
+ unsigned mindist = UINT_MAX; // will work on screen sizes at least up to 46340x46340
+ const int sibCount = pIface->childCount();
+ for (int i = 0; i < sibCount; ++i) {
+ QAccessibleInterface *sibling = 0;
+ sibling = pIface->child(i);
+ Q_ASSERT(sibling);
+ if ((accessible->relationTo(sibling) & QAccessible::Self) || sibling->state().invisible) {
+ //ignore ourself and invisible siblings
+ delete sibling;
+ continue;
+ }
+
+ QRect sibg = sibling->rect();
+ QPoint sibc = sibg.center();
+ QPoint sibp;
+ QPoint startp;
+ QPoint distp;
+ switch (navDir) {
+ case NAVDIR_LEFT:
+ startp = QPoint(startg.left(), startg.top() + startg.height() / 2);
+ sibp = QPoint(sibg.right(), sibg.top() + sibg.height() / 2);
+ if (QPoint(sibc - startc).x() >= 0) {
+ delete sibling;
+ continue;
+ }
+ distp = sibp - startp;
+ break;
+ case NAVDIR_RIGHT:
+ startp = QPoint(startg.right(), startg.top() + startg.height() / 2);
+ sibp = QPoint(sibg.left(), sibg.top() + sibg.height() / 2);
+ if (QPoint(sibc - startc).x() <= 0) {
+ delete sibling;
+ continue;
+ }
+ distp = sibp - startp;
+ break;
+ case NAVDIR_UP:
+ startp = QPoint(startg.left() + startg.width() / 2, startg.top());
+ sibp = QPoint(sibg.left() + sibg.width() / 2, sibg.bottom());
+ if (QPoint(sibc - startc).y() >= 0) {
+ delete sibling;
+ continue;
+ }
+ distp = sibp - startp;
+ break;
+ case NAVDIR_DOWN:
+ startp = QPoint(startg.left() + startg.width() / 2, startg.bottom());
+ sibp = QPoint(sibg.left() + sibg.width() / 2, sibg.top());
+ if (QPoint(sibc - startc).y() <= 0) {
+ delete sibling;
+ continue;
+ }
+ distp = sibp - startp;
+ break;
+ default:
+ break;
+ }
+
+ // Since we're *comparing* (and not measuring) distances, we can compare the
+ // squared distance, (thus, no need to take the sqrt()).
+ unsigned dist = distp.x() * distp.x() + distp.y() * distp.y();
+ if (dist < mindist) {
+ delete candidate;
+ candidate = sibling;
+ mindist = dist;
+ } else {
+ delete sibling;
+ }
+ }
+ delete pIface;
+ acc = candidate;
+ }
break;
default:
break;
}
- if (control == -1) {
+ if (!acc) {
(*pvarEnd).vt = VT_EMPTY;
return S_FALSE;
}
- if (!acc) {
- (*pvarEnd).vt = VT_I4;
- (*pvarEnd).lVal = control;
- return S_OK;
- }
-
QWindowsAccessible* wacc = new QWindowsAccessible(acc);
IDispatch *iface = 0;
@@ -911,18 +815,27 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accChild(VARIANT varChildID, I
acc = QAccessible::queryAccessibleInterface(ref.first);
if (acc && ref.second) {
if (ref.second) {
- QAccessibleInterface *res;
- int index = acc->navigate(QAccessible::Child, ref.second, &res);
+ QAccessibleInterface *res = acc->child(ref.second - 1);
delete acc;
- if (index == -1)
+ if (!res)
return E_INVALIDARG;
acc = res;
}
}
}
} else {
- QAccessible::RelationFlag rel = childIndex ? QAccessible::Child : QAccessible::Self;
- accessible->navigate(rel, childIndex, &acc);
+ if (childIndex) {
+ acc = accessible->child(childIndex - 1);
+ } else {
+ // Yes, some AT clients (Active Accessibility Object Inspector)
+ // actually ask for the same object. As a consequence, we need to clone ourselves:
+ if (QAccessibleInterface *par = accessible->parent()) {
+ const int indexOf = par->indexOfChild(accessible);
+ QAccessibleInterface *clone = par->child(indexOf);
+ delete par;
+ acc = clone;
+ }
+ }
}
if (acc) {
@@ -1151,8 +1064,62 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accState(VARIANT varID, VARIAN
state = accessible->state();
}
+ LONG st = 0;
+ if (state.animated)
+ st |= STATE_SYSTEM_ANIMATED;
+ if (state.busy)
+ st |= STATE_SYSTEM_BUSY;
+ if (state.checked)
+ st |= STATE_SYSTEM_CHECKED;
+ if (state.collapsed)
+ st |= STATE_SYSTEM_COLLAPSED;
+ if (state.defaultButton)
+ st |= STATE_SYSTEM_DEFAULT;
+ if (state.expanded)
+ st |= STATE_SYSTEM_EXPANDED;
+ if (state.extSelectable)
+ st |= STATE_SYSTEM_EXTSELECTABLE;
+ if (state.focusable)
+ st |= STATE_SYSTEM_FOCUSABLE;
+ if (state.focused)
+ st |= STATE_SYSTEM_FOCUSED;
+ if (state.hasPopup)
+ st |= STATE_SYSTEM_HASPOPUP;
+ if (state.hotTracked)
+ st |= STATE_SYSTEM_HOTTRACKED;
+ if (state.invisible)
+ st |= STATE_SYSTEM_INVISIBLE;
+ if (state.linked)
+ st |= STATE_SYSTEM_LINKED;
+ if (state.marqueed)
+ st |= STATE_SYSTEM_MARQUEED;
+ if (state.checkStateMixed)
+ st |= STATE_SYSTEM_MIXED;
+ if (state.movable)
+ st |= STATE_SYSTEM_MOVEABLE;
+ if (state.multiSelectable)
+ st |= STATE_SYSTEM_MULTISELECTABLE;
+ if (state.offscreen)
+ st |= STATE_SYSTEM_OFFSCREEN;
+ if (state.pressed)
+ st |= STATE_SYSTEM_PRESSED;
+ if (state.passwordEdit)
+ st |= STATE_SYSTEM_PROTECTED;
+ if (state.readOnly)
+ st |= STATE_SYSTEM_READONLY;
+ if (state.selectable)
+ st |= STATE_SYSTEM_SELECTABLE;
+ if (state.selected)
+ st |= STATE_SYSTEM_SELECTED;
+ if (state.selfVoicing)
+ st |= STATE_SYSTEM_SELFVOICING;
+ if (state.sizeable)
+ st |= STATE_SYSTEM_SIZEABLE;
+ if (state.traversed)
+ st |= STATE_SYSTEM_TRAVERSED;
+
(*pvarState).vt = VT_I4;
- (*pvarState).lVal = state;
+ (*pvarState).lVal = st;
return S_OK;
}
@@ -1187,6 +1154,8 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::put_accValue(VARIANT, BSTR)
// moz: [important]
HRESULT STDMETHODCALLTYPE QWindowsAccessible::accSelect(long flagsSelect, VARIANT varID)
{
+ Q_UNUSED(flagsSelect);
+ Q_UNUSED(varID);
showDebug(__FUNCTION__, accessible);
if (!accessible->isValid())
return E_FAIL;
@@ -1260,7 +1229,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accSelection(VARIANT *pvarChil
bool isSelected = false;
QAccessibleInterface *child = accessible->child(i);
if (child) {
- isSelected = child->state() & QAccessible::Selected;
+ isSelected = child->state().selected;
delete child;
}
if (isSelected)
@@ -1402,7 +1371,7 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QObject *o, int who, QAcce
// An event has to be associated with a window,
// so find the first parent that is a widget and that has a WId
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(o);
- QWindow *window = window_helper(iface);
+ QWindow *window = iface ? window_helper(iface) : 0;
if (!window) {
window = QGuiApplication::activeWindow();
diff --git a/src/plugins/platforms/windows/qwindowsaccessibility.h b/src/plugins/platforms/windows/qwindowsaccessibility.h
index aec3ffd4b1..892480ecf4 100644
--- a/src/plugins/platforms/windows/qwindowsaccessibility.h
+++ b/src/plugins/platforms/windows/qwindowsaccessibility.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
index ecabdcfcc7..56e74c5587 100644
--- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp
+++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.h b/src/plugins/platforms/windows/qwindowsbackingstore.h
index 72120abb34..60cc5ad787 100644
--- a/src/plugins/platforms/windows/qwindowsbackingstore.h
+++ b/src/plugins/platforms/windows/qwindowsbackingstore.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp
index bc70307015..e5edab3f4b 100644
--- a/src/plugins/platforms/windows/qwindowsclipboard.cpp
+++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -311,6 +311,8 @@ QMimeData *QWindowsClipboard::mimeData(QClipboard::Mode mode)
qDebug() << __FUNCTION__ << mode;
if (mode != QClipboard::Clipboard)
return 0;
+ if (ownsClipboard())
+ return m_data->mimeData();
return &m_retrievalData;
}
@@ -329,7 +331,8 @@ void QWindowsClipboard::setMimeData(QMimeData *mimeData, QClipboard::Mode mode)
const HRESULT src = OleSetClipboard(m_data);
if (src != S_OK) {
- qErrnoWarning("OleSetClipboard: Failed to set data on clipboard: %s",
+ qErrnoWarning("OleSetClipboard: Failed to set mime data (%s) on clipboard: %s",
+ qPrintable(mimeData->formats().join(QStringLiteral(", "))),
QWindowsContext::comErrorString(src).constData());
releaseIData();
return;
diff --git a/src/plugins/platforms/windows/qwindowsclipboard.h b/src/plugins/platforms/windows/qwindowsclipboard.h
index ffe441f732..321db201e8 100644
--- a/src/plugins/platforms/windows/qwindowsclipboard.h
+++ b/src/plugins/platforms/windows/qwindowsclipboard.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index f620cf8724..5e101d1869 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -164,11 +164,10 @@ void QWindowsUser32DLL::init()
// MinGW (g++ 3.4.5) accepts only C casts.
setLayeredWindowAttributes = (SetLayeredWindowAttributes)(library.resolve("SetLayeredWindowAttributes"));
updateLayeredWindow = (UpdateLayeredWindow)(library.resolve("UpdateLayeredWindow"));
- updateLayeredWindowIndirect = (UpdateLayeredWindowIndirect)(library.resolve("UpdateLayeredWindowIndirect"));
-
- Q_ASSERT(setLayeredWindowAttributes && updateLayeredWindow
- && updateLayeredWindowIndirect);
+ if (!setLayeredWindowAttributes || !updateLayeredWindow)
+ qFatal("This version of Windows is not supported (User32.dll is missing the symbols 'SetLayeredWindowAttributes', 'UpdateLayeredWindow').");
+ updateLayeredWindowIndirect = (UpdateLayeredWindowIndirect)(library.resolve("UpdateLayeredWindowIndirect"));
isHungAppWindow = (IsHungAppWindow)library.resolve("IsHungAppWindow");
}
@@ -543,8 +542,8 @@ QWindowsMimeConverter &QWindowsContext::mimeConverter() const
}
/*!
- \brief Convenience to create a non-visible dummy window
- for example used as clipboard watcher or for GL.
+ \brief Convenience to create a non-visible, message-only dummy
+ window for example used as clipboard watcher or for GL.
*/
HWND QWindowsContext::createDummyWindow(const QString &classNameIn,
@@ -558,7 +557,7 @@ HWND QWindowsContext::createDummyWindow(const QString &classNameIn,
windowName, style,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- 0, NULL, (HINSTANCE)GetModuleHandle(0), NULL);
+ HWND_MESSAGE, NULL, (HINSTANCE)GetModuleHandle(0), NULL);
}
/*!
diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h
index 1ff93e2d88..9a8acbbb51 100644
--- a/src/plugins/platforms/windows/qwindowscontext.h
+++ b/src/plugins/platforms/windows/qwindowscontext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -77,9 +77,9 @@ struct QWindowsUser32DLL
// Functions missing in Q_CC_GNU stub libraries.
SetLayeredWindowAttributes setLayeredWindowAttributes;
UpdateLayeredWindow updateLayeredWindow;
- UpdateLayeredWindowIndirect updateLayeredWindowIndirect;
// Functions missing in older versions of Windows
+ UpdateLayeredWindowIndirect updateLayeredWindowIndirect;
IsHungAppWindow isHungAppWindow;
// Touch functions from Windows 7 onwards (also for use with Q_CC_MSVC).
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index a3edd785d3..2b228e9fb8 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowscursor.h b/src/plugins/platforms/windows/qwindowscursor.h
index 261aacc09e..61ed170af2 100644
--- a/src/plugins/platforms/windows/qwindowscursor.h
+++ b/src/plugins/platforms/windows/qwindowscursor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 58352470a6..9023769b8b 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -416,8 +416,7 @@ protected:
*/
template <class BaseClass>
-QWindowsDialogHelperBase<BaseClass>::QWindowsDialogHelperBase(QDialog *dialog) :
- m_dialog(dialog),
+QWindowsDialogHelperBase<BaseClass>::QWindowsDialogHelperBase() :
m_nativeDialog(0),
m_ownerWindow(0)
{
@@ -437,11 +436,8 @@ template <class BaseClass>
QWindowsNativeDialogBase *QWindowsDialogHelperBase<BaseClass>::ensureNativeDialog()
{
// Create dialog and apply common settings.
- if (!m_nativeDialog) {
+ if (!m_nativeDialog)
m_nativeDialog = createNativeDialog();
- if (m_nativeDialog)
- m_nativeDialog->setWindowTitle(m_dialog->windowTitle());
- }
return m_nativeDialog;
}
@@ -487,9 +483,11 @@ void QWindowsDialogThread::run()
}
template <class BaseClass>
-bool QWindowsDialogHelperBase<BaseClass>::show_sys(QWindow *parent)
+bool QWindowsDialogHelperBase<BaseClass>::show_sys(QPlatformDialogHelper::ShowFlags flags,
+ Qt::WindowFlags,
+ QWindow *parent)
{
- const bool modal = m_dialog->isModal();
+ const bool modal = flags & QPlatformDialogHelper::ShowModal;
if (parent) {
m_ownerWindow = QWindowsWindow::handleOf(parent);
} else {
@@ -523,7 +521,8 @@ void QWindowsDialogHelperBase<BaseClass>::platformNativeDialogModalHelp()
if (QWindowsContext::verboseDialogs)
qDebug("%s" , __FUNCTION__);
if (QWindowsNativeDialogBase *nd =nativeDialog())
- nd->metaObject()->invokeMethod(m_dialog, "_q_platformRunNativeAppModalPanel",
+ nd->metaObject()->invokeMethod(this,
+ "emitLaunchNativeAppModalPanel",
Qt::QueuedConnection);
}
@@ -650,10 +649,10 @@ class QWindowsNativeFileDialogBase : public QWindowsNativeDialogBase
public:
~QWindowsNativeFileDialogBase();
- inline static QWindowsNativeFileDialogBase *create(QFileDialog::AcceptMode am);
+ inline static QWindowsNativeFileDialogBase *create(QFileDialogOptions::AcceptMode am);
virtual void setWindowTitle(const QString &title);
- inline void setMode(QFileDialog::FileMode mode, QFileDialog::Options options);
+ inline void setMode(QFileDialogOptions::FileMode mode, QFileDialogOptions::FileDialogOptions options);
inline void setDirectory(const QString &directory);
inline QString directory() const;
virtual void exec(HWND owner = 0);
@@ -662,6 +661,8 @@ public:
inline QString selectedNameFilter() const;
bool hideFiltersDetails() const { return m_hideFiltersDetails; }
void setHideFiltersDetails(bool h) { m_hideFiltersDetails = h; }
+ void setDefaultSuffix(const QString &s);
+ inline void setLabelText(QFileDialogOptions::DialogLabel l, const QString &text);
virtual QPlatformDialogHelper::DialogCode result() const
{ return fileResult(); }
@@ -785,25 +786,25 @@ void QWindowsNativeFileDialogBase::exec(HWND owner)
}
}
-void QWindowsNativeFileDialogBase::setMode(QFileDialog::FileMode mode, QFileDialog::Options options)
+void QWindowsNativeFileDialogBase::setMode(QFileDialogOptions::FileMode mode, QFileDialogOptions::FileDialogOptions options)
{
DWORD flags = FOS_PATHMUSTEXIST | FOS_FORCESHOWHIDDEN;
- if (options & QFileDialog::DontResolveSymlinks)
+ if (options & QFileDialogOptions::DontResolveSymlinks)
flags |= FOS_NODEREFERENCELINKS;
switch (mode) {
- case QFileDialog::AnyFile:
+ case QFileDialogOptions::AnyFile:
flags |= FOS_NOREADONLYRETURN;
- if (!(options & QFileDialog::DontConfirmOverwrite))
+ if (!(options & QFileDialogOptions::DontConfirmOverwrite))
flags |= FOS_OVERWRITEPROMPT;
break;
- case QFileDialog::ExistingFile:
+ case QFileDialogOptions::ExistingFile:
flags |= FOS_FILEMUSTEXIST;
break;
- case QFileDialog::Directory:
- case QFileDialog::DirectoryOnly:
+ case QFileDialogOptions::Directory:
+ case QFileDialogOptions::DirectoryOnly:
flags |= FOS_PICKFOLDERS | FOS_FILEMUSTEXIST;
break;
- case QFileDialog::ExistingFiles:
+ case QFileDialogOptions::ExistingFiles:
flags |= FOS_FILEMUSTEXIST | FOS_ALLOWMULTISELECT;
break;
}
@@ -905,6 +906,31 @@ void QWindowsNativeFileDialogBase::setNameFilters(const QStringList &filters)
m_fileDialog->SetFileTypes(size, comFilterSpec.data());
}
+void QWindowsNativeFileDialogBase::setDefaultSuffix(const QString &s)
+{
+ wchar_t *wSuffix = const_cast<wchar_t *>(reinterpret_cast<const wchar_t *>(s.utf16()));
+ m_fileDialog->SetDefaultExtension(wSuffix);
+}
+
+void QWindowsNativeFileDialogBase::setLabelText(QFileDialogOptions::DialogLabel l, const QString &text)
+{
+ wchar_t *wText = const_cast<wchar_t *>(reinterpret_cast<const wchar_t *>(text.utf16()));
+ switch (l) {
+ break;
+ case QFileDialogOptions::FileName:
+ m_fileDialog->SetFileNameLabel(wText);
+ break;
+ case QFileDialogOptions::Accept:
+ m_fileDialog->SetOkButtonLabel(wText);
+ break;
+ case QFileDialogOptions::LookIn:
+ case QFileDialogOptions::Reject:
+ case QFileDialogOptions::FileType:
+ case QFileDialogOptions::DialogLabelCount:
+ break;
+ }
+}
+
void QWindowsNativeFileDialogBase::selectNameFilter(const QString &filter)
{
const int index = m_nameFilters.indexOf(filter);
@@ -1052,10 +1078,10 @@ QStringList QWindowsNativeOpenFileDialog::selectedFiles() const
QFileDialog::AcceptMode.
*/
-QWindowsNativeFileDialogBase *QWindowsNativeFileDialogBase::create(QFileDialog::AcceptMode am)
+QWindowsNativeFileDialogBase *QWindowsNativeFileDialogBase::create(QFileDialogOptions::AcceptMode am)
{
QWindowsNativeFileDialogBase *result = 0;
- if (am == QFileDialog::AcceptOpen) {
+ if (am == QFileDialogOptions::AcceptOpen) {
result = new QWindowsNativeOpenFileDialog;
if (!result->init(CLSID_FileOpenDialog, IID_IFileOpenDialog)) {
delete result;
@@ -1081,10 +1107,7 @@ QWindowsNativeFileDialogBase *QWindowsNativeFileDialogBase::create(QFileDialog::
class QWindowsFileDialogHelper : public QWindowsDialogHelperBase<QPlatformFileDialogHelper>
{
public:
- explicit QWindowsFileDialogHelper(QDialog *dialog) :
- QWindowsDialogHelperBase<QPlatformFileDialogHelper>(dialog),
- m_fileDialog(qobject_cast<QFileDialog *>(dialog))
- { Q_ASSERT(m_fileDialog); }
+ QWindowsFileDialogHelper() {}
virtual bool defaultNameFilterDisables() const
{ return true; }
@@ -1101,18 +1124,16 @@ private:
virtual QWindowsNativeDialogBase *createNativeDialog();
inline QWindowsNativeFileDialogBase *nativeFileDialog() const
{ return static_cast<QWindowsNativeFileDialogBase *>(nativeDialog()); }
-
- QFileDialog *m_fileDialog;
};
QWindowsNativeDialogBase *QWindowsFileDialogHelper::createNativeDialog()
{
- QWindowsNativeFileDialogBase *result = QWindowsNativeFileDialogBase::create(m_fileDialog->acceptMode());
+ QWindowsNativeFileDialogBase *result = QWindowsNativeFileDialogBase::create(options()->acceptMode());
if (!result)
return 0;
- QObject::connect(result, SIGNAL(accepted()), m_fileDialog, SLOT(accept()),
+ QObject::connect(result, SIGNAL(accepted()), this, SIGNAL(accept()),
Qt::QueuedConnection);
- QObject::connect(result, SIGNAL(rejected()), m_fileDialog, SLOT(reject()),
+ QObject::connect(result, SIGNAL(rejected()), this, SIGNAL(reject()),
Qt::QueuedConnection);
QObject::connect(result, SIGNAL(directoryEntered(QString)),
this, SIGNAL(directoryEntered(QString)),
@@ -1125,18 +1146,26 @@ QWindowsNativeDialogBase *QWindowsFileDialogHelper::createNativeDialog()
Qt::QueuedConnection);
// Apply settings.
- result->setMode(m_fileDialog->fileMode(), m_fileDialog->options());
- const QDir directory = m_fileDialog->directory();
- if (directory.exists())
- result->setDirectory(directory.absolutePath());
- result->setHideFiltersDetails(m_fileDialog->testOption(QFileDialog::HideNameFilterDetails));
- const QStringList nameFilters = m_fileDialog->nameFilters();
- if (!nameFilters.isEmpty()) {
+ const QSharedPointer<QFileDialogOptions> &opts = options();
+ result->setWindowTitle(opts->windowTitle());
+ result->setMode(opts->fileMode(), opts->options());
+ result->setHideFiltersDetails(opts->testOption(QFileDialogOptions::HideNameFilterDetails));
+ const QStringList nameFilters = opts->nameFilters();
+ if (!nameFilters.isEmpty())
result->setNameFilters(nameFilters);
- const QString selectedNameFilter = m_fileDialog->selectedNameFilter();
- if (!selectedNameFilter.isEmpty())
- result->selectNameFilter(selectedNameFilter);
- }
+ if (opts->isLabelExplicitlySet(QFileDialogOptions::FileName))
+ result->setLabelText(QFileDialogOptions::FileName, opts->labelText(QFileDialogOptions::FileName));
+ if (opts->isLabelExplicitlySet(QFileDialogOptions::Accept))
+ result->setLabelText(QFileDialogOptions::Accept, opts->labelText(QFileDialogOptions::Accept));
+ const QString initialDirectory = opts->initialDirectory();
+ if (!initialDirectory.isEmpty())
+ result->setDirectory(initialDirectory);
+ const QString initialNameFilter = opts->initiallySelectedNameFilter();
+ if (!initialNameFilter.isEmpty())
+ result->selectNameFilter(initialNameFilter);
+ const QString defaultSuffix = opts->defaultSuffix();
+ if (!defaultSuffix.isEmpty())
+ result->setDefaultSuffix(defaultSuffix);
return result;
}
@@ -1218,6 +1247,8 @@ class QWindowsNativeColorDialog : public QWindowsNativeDialogBase
{
Q_OBJECT
public:
+ enum { CustomColorCount = 16 };
+
explicit QWindowsNativeColorDialog(const SharedPointerColor &color);
virtual void setWindowTitle(const QString &) {}
@@ -1228,7 +1259,7 @@ public slots:
virtual void close() {}
private:
- COLORREF m_customColors[16];
+ COLORREF m_customColors[CustomColorCount];
QPlatformDialogHelper::DialogCode m_code;
SharedPointerColor m_color;
};
@@ -1256,6 +1287,11 @@ void QWindowsNativeColorDialog::exec(HWND owner)
chooseColor.lStructSize = sizeof(chooseColor);
chooseColor.hwndOwner = owner;
chooseColor.lpCustColors = m_customColors;
+ QRgb *qCustomColors = QColorDialogOptions::customColors();
+ const int customColorCount = qMin(QColorDialogOptions::customColorCount(),
+ int(CustomColorCount));
+ for (int c= 0; c < customColorCount; ++c)
+ m_customColors[c] = qColorToCOLORREF(QColor(qCustomColors[c]));
chooseColor.rgbResult = qColorToCOLORREF(*m_color);
chooseColor.Flags = CC_FULLOPEN | CC_RGBINIT;
static ChooseColorWType chooseColorW = 0;
@@ -1272,6 +1308,8 @@ void QWindowsNativeColorDialog::exec(HWND owner)
}
if (m_code == QPlatformDialogHelper::Accepted) {
*m_color = COLORREFToQColor(chooseColor.rgbResult);
+ for (int c= 0; c < customColorCount; ++c)
+ qCustomColors[c] = COLORREFToQColor(m_customColors[c]).rgb();
emit accepted();
if (QWindowsContext::verboseDialogs)
qDebug() << '<' << __FUNCTION__ << m_color;
@@ -1295,8 +1333,7 @@ void QWindowsNativeColorDialog::exec(HWND owner)
class QWindowsColorDialogHelper : public QWindowsDialogHelperBase<QPlatformColorDialogHelper>
{
public:
- QWindowsColorDialogHelper(QDialog *dialog) :
- QWindowsDialogHelperBase<QPlatformColorDialogHelper>(dialog), m_currentColor(new QColor) { }
+ QWindowsColorDialogHelper() {}
virtual bool supportsNonModalDialog()
{ return false; }
@@ -1307,11 +1344,18 @@ public:
private:
inline QWindowsNativeColorDialog *nativeFileDialog() const
{ return static_cast<QWindowsNativeColorDialog *>(nativeDialog()); }
- virtual QWindowsNativeDialogBase *createNativeDialog()
- { return new QWindowsNativeColorDialog(m_currentColor); }
+ virtual QWindowsNativeDialogBase *createNativeDialog();
+
SharedPointerColor m_currentColor;
};
+QWindowsNativeDialogBase *QWindowsColorDialogHelper::createNativeDialog()
+{
+ QWindowsNativeColorDialog *nativeDialog = new QWindowsNativeColorDialog(m_currentColor);
+ nativeDialog->setWindowTitle(options()->windowTitle());
+ return nativeDialog;
+}
+
namespace QWindowsDialogs {
// QWindowsDialogHelperBase creation functions
@@ -1342,10 +1386,10 @@ QPlatformDialogHelper *createHelper(QDialog *dialog)
switch (QWindowsDialogs::dialogType(dialog)) {
case QWindowsDialogs::FileDialog:
- return new QWindowsFileDialogHelper(dialog);
+ return new QWindowsFileDialogHelper();
case QWindowsDialogs::ColorDialog:
#ifdef USE_NATIVE_COLOR_DIALOG
- return new QWindowsColorDialogHelper(dialog);
+ return new QWindowsColorDialogHelper();
#endif
case QWindowsDialogs::FontDialog:
case QWindowsDialogs::UnknownType:
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.h b/src/plugins/platforms/windows/qwindowsdialoghelpers.h
index 96c03bbaec..120076e58b 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.h
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -73,7 +73,9 @@ public:
virtual void platformNativeDialogModalHelp();
virtual void _q_platformRunNativeAppModalPanel();
virtual void deleteNativeDialog_sys();
- virtual bool show_sys(QWindow *parent);
+ virtual bool show_sys(QPlatformDialogHelper::ShowFlags flags,
+ Qt::WindowFlags windowFlags,
+ QWindow *parent);
virtual void hide_sys();
virtual QVariant styleHint(QPlatformDialogHelper::StyleHint) const;
@@ -82,14 +84,13 @@ public:
virtual bool supportsNonModalDialog() const { return true; }
protected:
- explicit QWindowsDialogHelperBase(QDialog *dialog);
+ QWindowsDialogHelperBase();
QWindowsNativeDialogBase *nativeDialog() const;
private:
virtual QWindowsNativeDialogBase *createNativeDialog() = 0;
inline QWindowsNativeDialogBase *ensureNativeDialog();
- QDialog *m_dialog;
QWindowsNativeDialogBase *m_nativeDialog;
HWND m_ownerWindow;
};
diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp
index 56f3a6d906..cbd81b99a0 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.cpp
+++ b/src/plugins/platforms/windows/qwindowsdrag.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -61,6 +61,146 @@
QT_BEGIN_NAMESPACE
+// These pixmaps approximate the images in the Windows User Interface Guidelines.
+// XPM
+
+static const char * const moveDragCursorXpmC[] = {
+"11 20 3 1",
+". c None",
+"a c #FFFFFF",
+"X c #000000", // X11 cursor is traditionally black
+"aa.........",
+"aXa........",
+"aXXa.......",
+"aXXXa......",
+"aXXXXa.....",
+"aXXXXXa....",
+"aXXXXXXa...",
+"aXXXXXXXa..",
+"aXXXXXXXXa.",
+"aXXXXXXXXXa",
+"aXXXXXXaaaa",
+"aXXXaXXa...",
+"aXXaaXXa...",
+"aXa..aXXa..",
+"aa...aXXa..",
+"a.....aXXa.",
+"......aXXa.",
+".......aXXa",
+".......aXXa",
+"........aa."};
+
+
+/* XPM */
+static const char * const copyDragCursorXpmC[] = {
+"24 30 3 1",
+". c None",
+"a c #000000",
+"X c #FFFFFF",
+"XX......................",
+"XaX.....................",
+"XaaX....................",
+"XaaaX...................",
+"XaaaaX..................",
+"XaaaaaX.................",
+"XaaaaaaX................",
+"XaaaaaaaX...............",
+"XaaaaaaaaX..............",
+"XaaaaaaaaaX.............",
+"XaaaaaaXXXX.............",
+"XaaaXaaX................",
+"XaaXXaaX................",
+"XaX..XaaX...............",
+"XX...XaaX...............",
+"X.....XaaX..............",
+"......XaaX..............",
+".......XaaX.............",
+".......XaaX.............",
+"........XX...aaaaaaaaaaa",
+".............aXXXXXXXXXa",
+".............aXXXXXXXXXa",
+".............aXXXXaXXXXa",
+".............aXXXXaXXXXa",
+".............aXXaaaaaXXa",
+".............aXXXXaXXXXa",
+".............aXXXXaXXXXa",
+".............aXXXXXXXXXa",
+".............aXXXXXXXXXa",
+".............aaaaaaaaaaa"};
+
+/* XPM */
+static const char * const linkDragCursorXpmC[] = {
+"24 30 3 1",
+". c None",
+"a c #000000",
+"X c #FFFFFF",
+"XX......................",
+"XaX.....................",
+"XaaX....................",
+"XaaaX...................",
+"XaaaaX..................",
+"XaaaaaX.................",
+"XaaaaaaX................",
+"XaaaaaaaX...............",
+"XaaaaaaaaX..............",
+"XaaaaaaaaaX.............",
+"XaaaaaaXXXX.............",
+"XaaaXaaX................",
+"XaaXXaaX................",
+"XaX..XaaX...............",
+"XX...XaaX...............",
+"X.....XaaX..............",
+"......XaaX..............",
+".......XaaX.............",
+".......XaaX.............",
+"........XX...aaaaaaaaaaa",
+".............aXXXXXXXXXa",
+".............aXXXaaaaXXa",
+".............aXXXXaaaXXa",
+".............aXXXaaaaXXa",
+".............aXXaaaXaXXa",
+".............aXXaaXXXXXa",
+".............aXXaXXXXXXa",
+".............aXXXaXXXXXa",
+".............aXXXXXXXXXa",
+".............aaaaaaaaaaa"};
+
+static const char * const ignoreDragCursorXpmC[] = {
+"24 30 3 1",
+". c None",
+"a c #000000",
+"X c #FFFFFF",
+"aa......................",
+"aXa.....................",
+"aXXa....................",
+"aXXXa...................",
+"aXXXXa..................",
+"aXXXXXa.................",
+"aXXXXXXa................",
+"aXXXXXXXa...............",
+"aXXXXXXXXa..............",
+"aXXXXXXXXXa.............",
+"aXXXXXXaaaa.............",
+"aXXXaXXa................",
+"aXXaaXXa................",
+"aXa..aXXa...............",
+"aa...aXXa...............",
+"a.....aXXa..............",
+"......aXXa.....XXXX.....",
+".......aXXa..XXaaaaXX...",
+".......aXXa.XaaaaaaaaX..",
+"........aa.XaaaXXXXaaaX.",
+"...........XaaaaX..XaaX.",
+"..........XaaXaaaX..XaaX",
+"..........XaaXXaaaX.XaaX",
+"..........XaaX.XaaaXXaaX",
+"..........XaaX..XaaaXaaX",
+"...........XaaX..XaaaaX.",
+"...........XaaaXXXXaaaX.",
+"............XaaaaaaaaX..",
+".............XXaaaaXX...",
+"...............XXXX....."};
+
/*!
\class QWindowsDropMimeData
\brief Special mime data class for data retrieval from Drag operations.
@@ -139,7 +279,7 @@ static inline Qt::KeyboardModifiers toQtKeyboardModifiers(DWORD keyState)
class QWindowsOleDropSource : public IDropSource
{
public:
- QWindowsOleDropSource();
+ explicit QWindowsOleDropSource(QWindowsDrag *drag);
virtual ~QWindowsOleDropSource();
void createCursors();
@@ -158,6 +298,7 @@ private:
inline void clearCursors();
+ QWindowsDrag *m_drag;
Qt::MouseButtons m_currentButtons;
Qt::DropAction m_currentAction;
ActionCursorMap m_cursors;
@@ -165,8 +306,8 @@ private:
ULONG m_refs;
};
-QWindowsOleDropSource::QWindowsOleDropSource() :
- m_currentButtons(Qt::NoButton), m_currentAction(Qt::IgnoreAction),
+QWindowsOleDropSource::QWindowsOleDropSource(QWindowsDrag *drag) :
+ m_drag(drag), m_currentButtons(Qt::NoButton), m_currentAction(Qt::IgnoreAction),
m_refs(1)
{
if (QWindowsContext::verboseOLE)
@@ -196,7 +337,14 @@ void QWindowsOleDropSource::createCursors()
actions << Qt::IgnoreAction;
const QPoint hotSpot = manager->object->hotSpot();
for (int cnum = 0; cnum < actions.size(); ++cnum) {
- const QPixmap cpm = manager->dragCursor(actions.at(cnum));
+ const Qt::DropAction action = actions.at(cnum);
+ QPixmap cpm = manager->dragCursor(action);
+ if (cpm.isNull())
+ cpm = m_drag->defaultCursor(action);
+ if (cpm.isNull()) {
+ qWarning("%s: Unable to obtain drag cursor for %d.", __FUNCTION__, action);
+ continue;
+ }
int w = cpm.width();
int h = cpm.height();
@@ -210,13 +358,13 @@ void QWindowsOleDropSource::createCursors()
h = y2 - y1 + 1;
}
- const QRect srcRect = pixmap.rect();
- const QPoint pmDest = QPoint(qMax(0, -hotSpot.x()), qMax(0, -hotSpot.y()));
const QPoint newHotSpot = hotSpot;
QPixmap newCursor(w, h);
if (hasPixmap) {
newCursor.fill(QColor(0, 0, 0, 0));
QPainter p(&newCursor);
+ const QRect srcRect = pixmap.rect();
+ const QPoint pmDest = QPoint(qMax(0, -hotSpot.x()), qMax(0, -hotSpot.y()));
p.drawPixmap(pmDest, pixmap, srcRect);
p.drawPixmap(qMax(0,newHotSpot.x()),qMax(0,newHotSpot.y()),cpm);
} else {
@@ -227,7 +375,7 @@ void QWindowsOleDropSource::createCursors()
const int hotY = hasPixmap ? qMax(0,newHotSpot.y()) : 0;
if (const HCURSOR sysCursor = QWindowsCursor::createPixmapCursor(newCursor, hotX, hotY))
- m_cursors.insert(actions.at(cnum), sysCursor);
+ m_cursors.insert(action, sysCursor);
}
if (QWindowsContext::verboseOLE)
qDebug("%s %d cursors", __FUNCTION__, m_cursors.size());
@@ -638,6 +786,30 @@ QWindowsDrag::~QWindowsDrag()
{
}
+QPixmap QWindowsDrag::defaultCursor(Qt::DropAction action) const
+{
+ switch (action) {
+ case Qt::CopyAction:
+ if (m_copyDragCursor.isNull())
+ m_copyDragCursor = QPixmap(copyDragCursorXpmC);
+ return m_copyDragCursor;
+ case Qt::TargetMoveAction:
+ case Qt::MoveAction:
+ if (m_moveDragCursor.isNull())
+ m_moveDragCursor = QPixmap(moveDragCursorXpmC);
+ return m_moveDragCursor;
+ case Qt::LinkAction:
+ if (m_linkDragCursor.isNull())
+ m_linkDragCursor = QPixmap(linkDragCursorXpmC);
+ return m_linkDragCursor;
+ default:
+ break;
+ }
+ if (m_ignoreDragCursor.isNull())
+ m_ignoreDragCursor = QPixmap(ignoreDragCursorXpmC);
+ return m_ignoreDragCursor;
+}
+
void QWindowsDrag::startDrag()
{
// TODO: Accessibility handling?
@@ -646,7 +818,7 @@ void QWindowsDrag::startDrag()
m_dragBeingCancelled = false;
DWORD resultEffect;
- QWindowsOleDropSource *windowDropSource = new QWindowsOleDropSource();
+ QWindowsOleDropSource *windowDropSource = new QWindowsOleDropSource(this);
windowDropSource->createCursors();
QWindowsOleDataObject *dropDataObject = new QWindowsOleDataObject(dropData);
const Qt::DropActions possibleActions = dragManager->possible_actions;
diff --git a/src/plugins/platforms/windows/qwindowsdrag.h b/src/plugins/platforms/windows/qwindowsdrag.h
index 621b769d28..2f2aa569f1 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.h
+++ b/src/plugins/platforms/windows/qwindowsdrag.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -105,10 +105,17 @@ public:
bool dragBeingCancelled() const { return m_dragBeingCancelled; }
+ QPixmap defaultCursor(Qt::DropAction action) const;
+
private:
QWindowsDropMimeData m_dropData;
IDataObject *m_dropDataObject;
bool m_dragBeingCancelled;
+
+ mutable QPixmap m_copyDragCursor;
+ mutable QPixmap m_moveDragCursor;
+ mutable QPixmap m_linkDragCursor;
+ mutable QPixmap m_ignoreDragCursor;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index b96ae6f3da..5969fbf0ab 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -51,6 +51,8 @@
#include <QtCore/qmath.h>
#include <QtCore/QDebug>
+#include <wchar.h>
+
#if !defined(QT_NO_DIRECTWRITE)
# include <dwrite.h>
# include <d2d1.h>
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.h b/src/plugins/platforms/windows/qwindowsfontdatabase.h
index 2e25ccf1a1..c991aed5ca 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.h
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
index 1c4a855255..c7bd5ebbb1 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -51,6 +51,8 @@
#include <QtGui/QGuiApplication>
#include <QtGui/QFontDatabase>
+#include <wchar.h>
+
static inline QFontDatabase::WritingSystem writingSystemFromScript(const QString &scriptName)
{
if (scriptName == QStringLiteral("Western")
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.h b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.h
index d9b8106227..94cf556925 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.h
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp
index b4faf597e1..f6c456bc7b 100644
--- a/src/plugins/platforms/windows/qwindowsfontengine.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h
index 9831d568ea..75968cc403 100644
--- a/src/plugins/platforms/windows/qwindowsfontengine.h
+++ b/src/plugins/platforms/windows/qwindowsfontengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
index 6f1e12a6d0..293c1c3b15 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h
index 1dfa69e3b7..f995c49a60 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index 1685adccec..1866faecd1 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.h b/src/plugins/platforms/windows/qwindowsglcontext.h
index f2784f3d9b..17a33a7c14 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.h
+++ b/src/plugins/platforms/windows/qwindowsglcontext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp b/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp
index 06ee97278a..cd5d28317e 100644
--- a/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp
+++ b/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsguieventdispatcher.h b/src/plugins/platforms/windows/qwindowsguieventdispatcher.h
index c385631a30..8d2bc1997b 100644
--- a/src/plugins/platforms/windows/qwindowsguieventdispatcher.h
+++ b/src/plugins/platforms/windows/qwindowsguieventdispatcher.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
index 8cd26f1efe..41c1a6c8f0 100644
--- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.h b/src/plugins/platforms/windows/qwindowsinputcontext.h
index 17cae5b158..d735d1fd93 100644
--- a/src/plugins/platforms/windows/qwindowsinputcontext.h
+++ b/src/plugins/platforms/windows/qwindowsinputcontext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index cebb17c9c7..8bb8bafe74 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -271,6 +271,14 @@ QPlatformFontDatabase *QWindowsIntegration::fontDatabase() const
return d->m_fontDatabase;
}
+static inline int keyBoardAutoRepeatRateMS()
+{
+ DWORD time = 0;
+ if (SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &time, 0))
+ return time ? 1000 / static_cast<int>(time) : 500;
+ return 30;
+}
+
QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
{
switch (hint) {
@@ -278,7 +286,8 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co
if (const unsigned timeMS = GetCaretBlinkTime())
return QVariant(int(timeMS));
break;
-
+ case KeyboardAutoRepeatRate:
+ return QVariant(keyBoardAutoRepeatRateMS());
case QPlatformIntegration::StartDragTime:
case QPlatformIntegration::StartDragDistance:
case QPlatformIntegration::MouseDoubleClickInterval:
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index 1c2a714fcb..fa133fa5de 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsinternalmimedata.h b/src/plugins/platforms/windows/qwindowsinternalmimedata.h
index 9997bddcf7..ceecd08f70 100644
--- a/src/plugins/platforms/windows/qwindowsinternalmimedata.h
+++ b/src/plugins/platforms/windows/qwindowsinternalmimedata.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index 8049b0832d..369deb7598 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.h b/src/plugins/platforms/windows/qwindowskeymapper.h
index 0eb743c924..e5e50c5886 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.h
+++ b/src/plugins/platforms/windows/qwindowskeymapper.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp
index cd4da16cff..026ab94d32 100644
--- a/src/plugins/platforms/windows/qwindowsmime.cpp
+++ b/src/plugins/platforms/windows/qwindowsmime.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsmime.h b/src/plugins/platforms/windows/qwindowsmime.h
index 3b71e55cfa..adac573375 100644
--- a/src/plugins/platforms/windows/qwindowsmime.h
+++ b/src/plugins/platforms/windows/qwindowsmime.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index a2b6aa8d68..e491029ea1 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -240,7 +240,6 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
const TOUCHINPUT &winTouchInput = winTouchInputs[i];
QTouchPoint touchPoint;
touchPoint.pressure = 1.0;
- touchPoint.isPrimary = (winTouchInput.dwFlags & TOUCHEVENTF_PRIMARY) != 0;
touchPoint.id = m_touchInputIDToTouchPointID.value(winTouchInput.dwID, -1);
if (touchPoint.id == -1) {
touchPoint.id = m_touchInputIDToTouchPointID.size();
@@ -275,19 +274,18 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
QWindowsContext::user32dll.closeTouchInputHandle((HANDLE) msg.lParam);
// all touch points released, forget the ids we've seen, they may not be reused
- if ((allStates & Qt::TouchPointStateMask) == Qt::TouchPointReleased)
+ if (allStates == Qt::TouchPointReleased)
m_touchInputIDToTouchPointID.clear();
if (!m_touchDevice) {
m_touchDevice = new QTouchDevice;
+ // TODO: Device used to be hardcoded to screen in previous code.
m_touchDevice->setType(QTouchDevice::TouchScreen);
m_touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::NormalizedPosition);
QWindowSystemInterface::registerTouchDevice(m_touchDevice);
}
- // TODO: Device used to be hardcoded to screen in previous code.
- // What is the correct event type? Which parts of translateRawTouchEvent() are required?
- QWindowSystemInterface::handleTouchEvent(window, QEvent::TouchBegin,
+ QWindowSystemInterface::handleTouchEvent(window,
m_touchDevice,
touchPoints);
return true;
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.h b/src/plugins/platforms/windows/qwindowsmousehandler.h
index 178936e2ec..4885d82b84 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.h
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsnativeimage.cpp b/src/plugins/platforms/windows/qwindowsnativeimage.cpp
index 2b252842e2..353366db8f 100644
--- a/src/plugins/platforms/windows/qwindowsnativeimage.cpp
+++ b/src/plugins/platforms/windows/qwindowsnativeimage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsnativeimage.h b/src/plugins/platforms/windows/qwindowsnativeimage.h
index f2efca55f9..6d453b0509 100644
--- a/src/plugins/platforms/windows/qwindowsnativeimage.h
+++ b/src/plugins/platforms/windows/qwindowsnativeimage.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsole.cpp b/src/plugins/platforms/windows/qwindowsole.cpp
index f7b84a7b66..fc61c2aa47 100644
--- a/src/plugins/platforms/windows/qwindowsole.cpp
+++ b/src/plugins/platforms/windows/qwindowsole.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsole.h b/src/plugins/platforms/windows/qwindowsole.h
index 0da55a8a88..47fc22526c 100644
--- a/src/plugins/platforms/windows/qwindowsole.h
+++ b/src/plugins/platforms/windows/qwindowsole.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index 08696a646b..c8966f2ecc 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h
index b424375694..dc1c8238d9 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.h
+++ b/src/plugins/platforms/windows/qwindowsscreen.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index a7001719fe..31adcfa167 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -41,13 +41,46 @@
#include "qwindowstheme.h"
#include "qwindowsdialoghelpers.h"
+#include "qwindowscontext.h"
+#include "qt_windows.h"
+
+#include <QtCore/QVariant>
QT_BEGIN_NAMESPACE
+static inline bool booleanSystemParametersInfo(UINT what, bool defaultValue)
+{
+ BOOL result;
+ if (SystemParametersInfo(what, 0, &result, 0))
+ return result ? true : false;
+ return defaultValue;
+}
+
+static inline bool dWordSystemParametersInfo(UINT what, DWORD defaultValue)
+{
+ DWORD result;
+ if (SystemParametersInfo(what, 0, &result, 0))
+ return result;
+ return defaultValue;
+}
+
QWindowsTheme::QWindowsTheme()
{
}
+QVariant QWindowsTheme::themeHint(ThemeHint hint) const
+{
+ switch (hint) {
+ case TextCursorWidth:
+ return QVariant(int(dWordSystemParametersInfo(SPI_GETCARETWIDTH, 1u)));
+ case DropShadow:
+ return QVariant(booleanSystemParametersInfo(SPI_GETDROPSHADOW, false));
+ case MaximumScrollBarDragDistance:
+ return QVariant(qRound(qreal(QWindowsContext::instance()->defaultDPI()) * 1.375));
+ }
+ return QVariant();
+}
+
bool QWindowsTheme::usePlatformNativeDialog(const QDialog *dialog) const
{
return QWindowsDialogs::useHelper(dialog);
diff --git a/src/plugins/platforms/windows/qwindowstheme.h b/src/plugins/platforms/windows/qwindowstheme.h
index 057e30d262..9bb937d607 100644
--- a/src/plugins/platforms/windows/qwindowstheme.h
+++ b/src/plugins/platforms/windows/qwindowstheme.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -53,6 +53,7 @@ public:
virtual bool usePlatformNativeDialog(const QDialog *dialog = 0) const;
virtual QPlatformDialogHelper *createPlatformDialogHelper(QDialog *dialog = 0) const;
+ virtual QVariant themeHint(ThemeHint) const;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index f61e15dded..282576105f 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -648,11 +648,11 @@ void QWindowsWindow::destroyWindow()
{
if (QWindowsContext::verboseIntegration || QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << this << window() << m_data.hwnd;
- if (m_data.hwnd) {
+ if (m_data.hwnd) { // Stop event dispatching before Window is destroyed.
unregisterDropSite();
+ QWindowsContext::instance()->removeWindow(m_data.hwnd);
if (m_data.hwnd != GetDesktopWindow())
DestroyWindow(m_data.hwnd);
- QWindowsContext::instance()->removeWindow(m_data.hwnd);
m_data.hwnd = 0;
}
}
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h
index 95e497acdb..364f3d0bc5 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/main.cpp b/src/plugins/platforms/xcb/main.cpp
index c544f7073d..16ef7628a7 100644
--- a/src/plugins/platforms/xcb/main.cpp
+++ b/src/plugins/platforms/xcb/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qdri2context.cpp b/src/plugins/platforms/xcb/qdri2context.cpp
index 31e613d4ba..c16052f021 100644
--- a/src/plugins/platforms/xcb/qdri2context.cpp
+++ b/src/plugins/platforms/xcb/qdri2context.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qdri2context.h b/src/plugins/platforms/xcb/qdri2context.h
index 6b93a0a93f..7c4dbb35c2 100644
--- a/src/plugins/platforms/xcb/qdri2context.h
+++ b/src/plugins/platforms/xcb/qdri2context.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp
index de41f862bd..86b7f09166 100644
--- a/src/plugins/platforms/xcb/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/qglxintegration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h
index 211a654c03..93c4805ec8 100644
--- a/src/plugins/platforms/xcb/qglxintegration.h
+++ b/src/plugins/platforms/xcb/qglxintegration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index fb8384212d..ad8b47c25a 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -124,7 +124,7 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QI
m_shm_info.shmaddr = 0;
- m_xcb_image->data = (uint8_t *)qMalloc(segmentSize);
+ m_xcb_image->data = (uint8_t *)malloc(segmentSize);
} else {
if (shmctl(m_shm_info.shmid, IPC_RMID, 0) == -1)
qWarning() << "QXcbBackingStore: Error while marking the shared memory segment to be destroyed";
@@ -146,7 +146,7 @@ void QXcbShmImage::destroy()
shmdt(m_shm_info.shmaddr);
shmctl(m_shm_info.shmid, IPC_RMID, 0);
} else {
- qFree(m_xcb_image->data);
+ free(m_xcb_image->data);
}
}
@@ -182,17 +182,47 @@ void QXcbShmImage::put(xcb_window_t window, const QPoint &target, const QRect &s
source.height(),
false);
} else {
- xcb_image_t *subimage = xcb_image_subimage(m_xcb_image, source.x(), source.y(), source.width(), source.height(),
- 0, 0, 0);
- xcb_image_put(xcb_connection(),
- window,
- m_gc,
- subimage,
- target.x(),
- target.y(),
- 0);
-
- xcb_image_destroy(subimage);
+ // If we upload the whole image in a single chunk, the result might be
+ // larger than the server's maximum request size and stuff breaks.
+ // To work around that, we upload the image in chunks where each chunk
+ // is small enough for a single request.
+ int src_x = source.x();
+ int src_y = source.y();
+ int target_x = target.x();
+ int target_y = target.y();
+ int width = source.width();
+ int height = source.height();
+
+ // We must make sure that each request is not larger than max_req_size.
+ // Each request takes req_size + m_xcb_image->stride * height bytes.
+ uint32_t max_req_size = xcb_get_maximum_request_length(xcb_connection());
+ uint32_t req_size = sizeof(xcb_put_image_request_t);
+ int rows_per_put = (max_req_size - req_size) / m_xcb_image->stride;
+
+ // This assert could trigger if a single row has more pixels than fit in
+ // a single PutImage request. However, max_req_size is guaranteed to be
+ // at least 16384 bytes. That should be enough for quite large images.
+ Q_ASSERT(rows_per_put > 0);
+
+ while (height > 0) {
+ int rows = std::min(height, rows_per_put);
+
+ xcb_image_t *subimage = xcb_image_subimage(m_xcb_image, src_x, src_y, width, rows,
+ 0, 0, 0);
+ xcb_image_put(xcb_connection(),
+ window,
+ m_gc,
+ subimage,
+ target_x,
+ target_y,
+ 0);
+
+ xcb_image_destroy(subimage);
+
+ src_y += rows;
+ target_y += rows;
+ height -= rows;
+ }
}
Q_XCB_NOOP(connection());
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.h b/src/plugins/platforms/xcb/qxcbbackingstore.h
index a389f97ac3..70fed46563 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.h
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp
index 03ee054f59..14d802a8bd 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -208,11 +208,12 @@ QXcbClipboard::~QXcbClipboard()
connection()->sync();
// waiting until the clipboard manager fetches the content.
- if (!waitForClipboardEvent(m_owner, XCB_SELECTION_NOTIFY, 5000)) {
+ if (!waitForClipboardEvent(m_owner, XCB_SELECTION_NOTIFY, clipboard_timeout, true)) {
qWarning("QClipboard: Unable to receive an event from the "
"clipboard manager in a reasonable time");
}
}
+ free(reply);
}
}
@@ -595,6 +596,7 @@ bool QXcbClipboard::clipboardReadProperty(xcb_window_t win, xcb_atom_t property,
xcb_get_property_cookie_t cookie = Q_XCB_CALL(xcb_get_property(xcb_connection(), false, win, property, XCB_GET_PROPERTY_TYPE_ANY, 0, 0));
xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, 0);
if (!reply || reply->type == XCB_NONE) {
+ free(reply);
buffer->resize(0);
return false;
}
@@ -687,7 +689,7 @@ namespace
: window(win), type(t) {}
xcb_window_t window;
int type;
- bool check(xcb_generic_event_t *event) const {
+ bool checkEvent(xcb_generic_event_t *event) const {
if (!event)
return false;
int t = event->response_type & 0x7f;
@@ -710,7 +712,7 @@ namespace
ClipboardEvent(QXcbConnection *c)
{ clipboard = c->internAtom("CLIPBOARD"); }
xcb_atom_t clipboard;
- bool check(xcb_generic_event_t *e) const {
+ bool checkEvent(xcb_generic_event_t *e) const {
if (!e)
return false;
int type = e->response_type & 0x7f;
@@ -726,7 +728,7 @@ namespace
};
}
-xcb_generic_event_t *QXcbClipboard::waitForClipboardEvent(xcb_window_t win, int type, int timeout)
+xcb_generic_event_t *QXcbClipboard::waitForClipboardEvent(xcb_window_t win, int type, int timeout, bool checkManager)
{
QElapsedTimer timer;
timer.start();
@@ -736,6 +738,16 @@ xcb_generic_event_t *QXcbClipboard::waitForClipboardEvent(xcb_window_t win, int
if (e)
return e;
+ if (checkManager) {
+ xcb_get_selection_owner_cookie_t cookie = xcb_get_selection_owner(xcb_connection(), atom(QXcbAtom::CLIPBOARD_MANAGER));
+ xcb_get_selection_owner_reply_t *reply = xcb_get_selection_owner_reply(xcb_connection(), cookie, 0);
+ if (!reply || reply->owner == XCB_NONE) {
+ free(reply);
+ return 0;
+ }
+ free(reply);
+ }
+
// process other clipboard events, since someone is probably requesting data from us
ClipboardEvent clipboard(connection());
e = connection()->checkEvent(clipboard);
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.h b/src/plugins/platforms/xcb/qxcbclipboard.h
index 3fd59964c1..c3b072984e 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.h
+++ b/src/plugins/platforms/xcb/qxcbclipboard.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -85,7 +85,7 @@ public:
QByteArray getSelection(xcb_atom_t selection, xcb_atom_t target, xcb_atom_t property);
private:
- xcb_generic_event_t *waitForClipboardEvent(xcb_window_t win, int type, int timeout);
+ xcb_generic_event_t *waitForClipboardEvent(xcb_window_t win, int type, int timeout, bool checkManager = false);
xcb_atom_t sendTargetsSelection(QMimeData *d, xcb_window_t window, xcb_atom_t property);
xcb_atom_t sendSelection(QMimeData *d, xcb_atom_t target, xcb_window_t window, xcb_atom_t property);
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 6969124b2a..ca21b1eb9d 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -86,13 +86,16 @@ extern "C" {
QT_BEGIN_NAMESPACE
+#ifdef XCB_USE_XLIB
static int nullErrorHandler(Display *, XErrorEvent *)
{
return 0;
}
+#endif
QXcbConnection::QXcbConnection(const char *displayName)
- : m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY"))
+ : m_connection(0)
+ , m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY"))
#ifdef XCB_USE_XINPUT2_MAEMO
, m_xinputData(0)
#endif
@@ -108,24 +111,26 @@ QXcbConnection::QXcbConnection(const char *displayName)
#ifdef XCB_USE_XLIB
Display *dpy = XOpenDisplay(m_displayName.constData());
- m_primaryScreen = DefaultScreen(dpy);
- m_connection = XGetXCBConnection(dpy);
- XSetEventQueueOwner(dpy, XCBOwnsEventQueue);
- XSetErrorHandler(nullErrorHandler);
- m_xlib_display = dpy;
+ if (dpy) {
+ m_primaryScreen = DefaultScreen(dpy);
+ m_connection = XGetXCBConnection(dpy);
+ XSetEventQueueOwner(dpy, XCBOwnsEventQueue);
+ XSetErrorHandler(nullErrorHandler);
+ m_xlib_display = dpy;
#ifdef XCB_USE_EGL
- EGLDisplay eglDisplay = eglGetDisplay(dpy);
- m_egl_display = eglDisplay;
- EGLint major, minor;
- eglBindAPI(EGL_OPENGL_ES_API);
- m_has_egl = eglInitialize(eglDisplay,&major,&minor);
+ EGLDisplay eglDisplay = eglGetDisplay(dpy);
+ m_egl_display = eglDisplay;
+ EGLint major, minor;
+ eglBindAPI(EGL_OPENGL_ES_API);
+ m_has_egl = eglInitialize(eglDisplay,&major,&minor);
#endif //XCB_USE_EGL
+ }
#else
m_connection = xcb_connect(m_displayName.constData(), &m_primaryScreen);
#endif //XCB_USE_XLIB
- if (m_connection)
- qDebug("Successfully connected to display %s", m_displayName.constData());
+ if (!m_connection)
+ qFatal("Could not connect to display %s", m_displayName.constData());
m_reader = new QXcbEventReader(this);
#ifdef XCB_POLL_FOR_QUEUED_EVENT
@@ -568,13 +573,17 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
if (!handled) {
// Check if a custom XEvent constructor was registered in xlib for this event type, and call it discarding the constructed XEvent if any.
// XESetWireToEvent might be used by libraries to intercept messages from the X server e.g. the OpenGL lib waiting for DRI2 events.
- Bool (*proc)(Display*, XEvent*, xEvent*) = XESetWireToEvent((Display*)m_xlib_display, response_type, 0);
+
+ Display *xdisplay = (Display *)m_xlib_display;
+ XLockDisplay(xdisplay);
+ Bool (*proc)(Display*, XEvent*, xEvent*) = XESetWireToEvent(xdisplay, response_type, 0);
if (proc) {
- XESetWireToEvent((Display*)m_xlib_display, response_type, proc);
+ XESetWireToEvent(xdisplay, response_type, proc);
XEvent dummy;
event->sequence = LastKnownRequestProcessed(m_xlib_display);
- proc((Display*)m_xlib_display, &dummy, (xEvent*)event);
+ proc(xdisplay, &dummy, (xEvent*)event);
}
+ XUnlockDisplay(xdisplay);
}
#endif
@@ -615,7 +624,7 @@ void QXcbEventReader::addEvent(xcb_generic_event_t *event)
m_events << event;
}
-QList<xcb_generic_event_t *> *QXcbEventReader::lock()
+QXcbEventArray *QXcbEventReader::lock()
{
m_mutex.lock();
#ifndef XCB_POLL_FOR_QUEUED_EVENT
@@ -648,7 +657,7 @@ void QXcbConnection::sendConnectionEvent(QXcbAtom::Atom a, uint id)
void QXcbConnection::processXcbEvents()
{
- QList<xcb_generic_event_t *> *eventqueue = m_reader->lock();
+ QXcbEventArray *eventqueue = m_reader->lock();
for(int i = 0; i < eventqueue->size(); ++i) {
xcb_generic_event_t *event = eventqueue->at(i);
@@ -711,7 +720,7 @@ void QXcbConnection::handleClientMessageEvent(const xcb_client_message_event_t *
xcb_generic_event_t *QXcbConnection::checkEvent(int type)
{
- QList<xcb_generic_event_t *> *eventqueue = m_reader->lock();
+ QXcbEventArray *eventqueue = m_reader->lock();
for (int i = 0; i < eventqueue->size(); ++i) {
xcb_generic_event_t *event = eventqueue->at(i);
@@ -960,6 +969,7 @@ QByteArray QXcbConnection::atomName(xcb_atom_t atom)
xcb_get_atom_name_reply_t *reply = xcb_get_atom_name_reply(xcb_connection(), cookie, &error);
if (error) {
qWarning() << "QXcbConnection::atomName: bad Atom" << atom;
+ free(error);
}
if (reply) {
QByteArray result(xcb_get_atom_name_name(reply), xcb_get_atom_name_name_length(reply));
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index ebe95c0013..c227b4c863 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -50,12 +50,13 @@
#include <QObject>
#include <QThread>
#include <QVector>
+#include <QVarLengthArray>
#ifdef XCB_USE_XINPUT2_MAEMO
struct XInput2Data;
#endif
-#define Q_XCB_DEBUG
+//#define Q_XCB_DEBUG
QT_BEGIN_NAMESPACE
@@ -249,6 +250,8 @@ namespace QXcbAtom {
};
}
+typedef QVarLengthArray<xcb_generic_event_t *, 64> QXcbEventArray;
+
class QXcbConnection;
class QXcbEventReader : public QThread
{
@@ -263,7 +266,7 @@ public:
void run();
#endif
- QList<xcb_generic_event_t *> *lock();
+ QXcbEventArray *lock();
void unlock();
signals:
@@ -273,7 +276,7 @@ private:
void addEvent(xcb_generic_event_t *event);
QMutex m_mutex;
- QList<xcb_generic_event_t *> m_events;
+ QXcbEventArray m_events;
QXcbConnection *m_connection;
};
@@ -337,7 +340,7 @@ public:
xcb_generic_event_t *checkEvent(int type);
template<typename T>
- inline xcb_generic_event_t *checkEvent(const T &checker);
+ inline xcb_generic_event_t *checkEvent(T &checker);
typedef bool (*PeekFunc)(xcb_generic_event_t *);
void addPeekFunc(PeekFunc f);
@@ -425,13 +428,13 @@ private:
#define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display()))
template<typename T>
-xcb_generic_event_t *QXcbConnection::checkEvent(const T &checker)
+xcb_generic_event_t *QXcbConnection::checkEvent(T &checker)
{
- QList<xcb_generic_event_t *> *eventqueue = m_reader->lock();
+ QXcbEventArray *eventqueue = m_reader->lock();
for (int i = 0; i < eventqueue->size(); ++i) {
xcb_generic_event_t *event = eventqueue->at(i);
- if (checker.check(event)) {
+ if (checker.checkEvent(event)) {
(*eventqueue)[i] = 0;
m_reader->unlock();
return event;
diff --git a/src/plugins/platforms/xcb/qxcbconnection_maemo.cpp b/src/plugins/platforms/xcb/qxcbconnection_maemo.cpp
index 719fc85ae2..12b3d67b9f 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_maemo.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_maemo.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -222,7 +222,6 @@ void QXcbConnection::handleGenericEvent(xcb_ge_event_t *event)
for (int i = 0; i < m_xinputData->xiMaxContacts; ++i) {
QWindowSystemInterface::TouchPoint tp;
tp.id = i;
- tp.isPrimary = (i == 0);
tp.state = Qt::TouchPointReleased;
touchPoints << tp;
}
@@ -288,7 +287,7 @@ void QXcbConnection::handleGenericEvent(xcb_ge_event_t *event)
QWindowSystemInterface::registerTouchDevice(dev);
m_xinputData->qtTouchDevice = dev;
}
- QWindowSystemInterface::handleTouchEvent(platformWindow->window(), xideviceevent->time, (QEvent::Type)0 /*None*/, dev, touchPoints);
+ QWindowSystemInterface::handleTouchEvent(platformWindow->window(), xideviceevent->time, dev, touchPoints);
}
if (xideviceevent->evtype == XI_ButtonRelease) {
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
index f6856d5694..a00fdd4824 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h
index 4bbb9a928b..f766d7c74e 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.h
+++ b/src/plugins/platforms/xcb/qxcbcursor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index c15bbeed83..89b1fa7445 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -818,7 +818,7 @@ namespace
public:
ClientMessageScanner(xcb_atom_t a) : atom(a) {}
xcb_atom_t atom;
- bool check(xcb_generic_event_t *event) const {
+ bool checkEvent(xcb_generic_event_t *event) const {
if (!event)
return false;
if ((event->response_type & 0x7f) != XCB_CLIENT_MESSAGE)
diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h
index 8142a77875..0233cc32b2 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.h
+++ b/src/plugins/platforms/xcb/qxcbdrag.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbeglsurface.h b/src/plugins/platforms/xcb/qxcbeglsurface.h
index a372cd9830..c4367cf572 100644
--- a/src/plugins/platforms/xcb/qxcbeglsurface.h
+++ b/src/plugins/platforms/xcb/qxcbeglsurface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbimage.cpp b/src/plugins/platforms/xcb/qxcbimage.cpp
index 569e4fc4e4..824805a983 100644
--- a/src/plugins/platforms/xcb/qxcbimage.cpp
+++ b/src/plugins/platforms/xcb/qxcbimage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbimage.h b/src/plugins/platforms/xcb/qxcbimage.h
index 1e7f104084..6a06610937 100644
--- a/src/plugins/platforms/xcb/qxcbimage.h
+++ b/src/plugins/platforms/xcb/qxcbimage.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 2190722f98..3cf50cbbd9 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h
index 91fcc0b6cb..8a3926dbfb 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.h
+++ b/src/plugins/platforms/xcb/qxcbintegration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index 581693ccb7..ef71b78339 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -907,6 +907,7 @@ QString QXcbKeyboard::translateKeySym(xcb_keysym_t keysym, uint xmodifiers,
QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection)
: QXcbObject(connection)
+ , m_autorepeat_code(0)
{
m_key_symbols = xcb_key_symbols_alloc(xcb_connection());
setupModifiers();
@@ -1020,6 +1021,62 @@ void QXcbKeyboard::setMask(uint sym, uint mask)
// #define XCB_KEYBOARD_DEBUG
+class KeyChecker
+{
+public:
+ KeyChecker(xcb_window_t window, xcb_keycode_t code, xcb_timestamp_t time)
+ : m_window(window)
+ , m_code(code)
+ , m_time(time)
+ , m_error(false)
+ , m_release(true)
+ {
+ }
+
+ bool checkEvent(xcb_generic_event_t *ev)
+ {
+ if (m_error || !ev)
+ return false;
+
+ int type = ev->response_type & ~0x80;
+ if (type != XCB_KEY_PRESS && type != XCB_KEY_RELEASE)
+ return false;
+
+ xcb_key_press_event_t *event = (xcb_key_press_event_t *)ev;
+
+ if (event->event != m_window || event->detail != m_code) {
+ m_error = true;
+ return false;
+ }
+
+ if (type == XCB_KEY_PRESS) {
+ m_error = !m_release || event->time - m_time > 10;
+ return !m_error;
+ }
+
+ if (m_release) {
+ m_error = true;
+ return false;
+ }
+
+ m_release = true;
+ m_time = event->time;
+
+ return false;
+ }
+
+ bool release() const { return m_release; }
+ xcb_timestamp_t time() const { return m_time; }
+
+private:
+ xcb_window_t m_window;
+ xcb_keycode_t m_code;
+ xcb_timestamp_t m_time;
+
+ bool m_error;
+ bool m_release;
+};
+
void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycode_t code,
quint16 state, xcb_timestamp_t time)
{
@@ -1062,8 +1119,32 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod
return;
}
+ bool isAutoRepeat = false;
+
+ if (type == QEvent::KeyPress) {
+ if (m_autorepeat_code == code) {
+ isAutoRepeat = true;
+ m_autorepeat_code = 0;
+ }
+ } else {
+ // look ahead for auto-repeat
+ KeyChecker checker(((QXcbWindow *)window->handle())->xcb_window(), code, time);
+ xcb_generic_event_t *event = connection()->checkEvent(checker);
+ if (event) {
+ isAutoRepeat = true;
+ free(event);
+ }
+ m_autorepeat_code = isAutoRepeat ? code : 0;
+ }
+
QWindowSystemInterface::handleExtendedKeyEvent(window, time, type, qtcode, modifiers,
- code, 0, state, string.left(count));
+ code, 0, state, string.left(count), isAutoRepeat);
+
+ if (isAutoRepeat && type == QEvent::KeyRelease) {
+ // since we removed it from the event queue using checkEvent we need to send the key press here
+ QWindowSystemInterface::handleExtendedKeyEvent(window, time, QEvent::KeyPress, qtcode, modifiers,
+ code, 0, state, string.left(count), isAutoRepeat);
+ }
}
#ifdef XCB_USE_XLIB
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h
index a4b6a28886..4a62dde11a 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.h
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -86,6 +86,7 @@ private:
uint m_caps_lock_mask;
xcb_key_symbols_t *m_key_symbols;
+ xcb_keycode_t m_autorepeat_code;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp
index 271d41ae75..5d86a118c7 100644
--- a/src/plugins/platforms/xcb/qxcbmime.cpp
+++ b/src/plugins/platforms/xcb/qxcbmime.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbmime.h b/src/plugins/platforms/xcb/qxcbmime.h
index ac032db442..02be4c9c5b 100644
--- a/src/plugins/platforms/xcb/qxcbmime.h
+++ b/src/plugins/platforms/xcb/qxcbmime.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index 5e0af8d24d..52ff30991e 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h
index 0902af03eb..517e92bc64 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.h
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbobject.h b/src/plugins/platforms/xcb/qxcbobject.h
index a594066545..b164f63f76 100644
--- a/src/plugins/platforms/xcb/qxcbobject.h
+++ b/src/plugins/platforms/xcb/qxcbobject.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index 1336ddb32a..8b01b4389f 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h
index 76cc0fa1b4..1975d56189 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.h
+++ b/src/plugins/platforms/xcb/qxcbscreen.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 8e01c8ec40..2cd2a15fb7 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index 6ff1627f98..f0b6437699 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbwmsupport.cpp b/src/plugins/platforms/xcb/qxcbwmsupport.cpp
index 15e423e95b..f06c9c503c 100644
--- a/src/plugins/platforms/xcb/qxcbwmsupport.cpp
+++ b/src/plugins/platforms/xcb/qxcbwmsupport.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xcb/qxcbwmsupport.h b/src/plugins/platforms/xcb/qxcbwmsupport.h
index 7b0a21f035..faa0934a3d 100644
--- a/src/plugins/platforms/xcb/qxcbwmsupport.h
+++ b/src/plugins/platforms/xcb/qxcbwmsupport.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/main.cpp b/src/plugins/platforms/xlib/main.cpp
index b4241fa228..41c86a5c18 100644
--- a/src/plugins/platforms/xlib/main.cpp
+++ b/src/plugins/platforms/xlib/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qglxintegration.cpp b/src/plugins/platforms/xlib/qglxintegration.cpp
index 6733f22093..c995070fe3 100644
--- a/src/plugins/platforms/xlib/qglxintegration.cpp
+++ b/src/plugins/platforms/xlib/qglxintegration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qglxintegration.h b/src/plugins/platforms/xlib/qglxintegration.h
index e3172b718c..c1ef2c9d36 100644
--- a/src/plugins/platforms/xlib/qglxintegration.h
+++ b/src/plugins/platforms/xlib/qglxintegration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibbackingstore.cpp b/src/plugins/platforms/xlib/qxlibbackingstore.cpp
index 24a346a29d..954b7c32a5 100644
--- a/src/plugins/platforms/xlib/qxlibbackingstore.cpp
+++ b/src/plugins/platforms/xlib/qxlibbackingstore.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibbackingstore.h b/src/plugins/platforms/xlib/qxlibbackingstore.h
index 35093f6784..7c0ac4b252 100644
--- a/src/plugins/platforms/xlib/qxlibbackingstore.h
+++ b/src/plugins/platforms/xlib/qxlibbackingstore.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibclipboard.cpp b/src/plugins/platforms/xlib/qxlibclipboard.cpp
index 3ee4d4269c..601314ff4f 100644
--- a/src/plugins/platforms/xlib/qxlibclipboard.cpp
+++ b/src/plugins/platforms/xlib/qxlibclipboard.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibclipboard.h b/src/plugins/platforms/xlib/qxlibclipboard.h
index 8fdc18b7d4..e9faef465b 100644
--- a/src/plugins/platforms/xlib/qxlibclipboard.h
+++ b/src/plugins/platforms/xlib/qxlibclipboard.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibcursor.cpp b/src/plugins/platforms/xlib/qxlibcursor.cpp
index 7a074bc0e6..44c9ccd489 100644
--- a/src/plugins/platforms/xlib/qxlibcursor.cpp
+++ b/src/plugins/platforms/xlib/qxlibcursor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibcursor.h b/src/plugins/platforms/xlib/qxlibcursor.h
index fd574778d7..74d520e2d1 100644
--- a/src/plugins/platforms/xlib/qxlibcursor.h
+++ b/src/plugins/platforms/xlib/qxlibcursor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibdisplay.cpp b/src/plugins/platforms/xlib/qxlibdisplay.cpp
index 32cffcf4fe..9e9536c93d 100644
--- a/src/plugins/platforms/xlib/qxlibdisplay.cpp
+++ b/src/plugins/platforms/xlib/qxlibdisplay.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibdisplay.h b/src/plugins/platforms/xlib/qxlibdisplay.h
index 650b72c6dd..02cbd42809 100644
--- a/src/plugins/platforms/xlib/qxlibdisplay.h
+++ b/src/plugins/platforms/xlib/qxlibdisplay.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibintegration.cpp b/src/plugins/platforms/xlib/qxlibintegration.cpp
index c1f0941619..216673cc65 100644
--- a/src/plugins/platforms/xlib/qxlibintegration.cpp
+++ b/src/plugins/platforms/xlib/qxlibintegration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibintegration.h b/src/plugins/platforms/xlib/qxlibintegration.h
index f5150fca6f..3b505df65a 100644
--- a/src/plugins/platforms/xlib/qxlibintegration.h
+++ b/src/plugins/platforms/xlib/qxlibintegration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.cpp b/src/plugins/platforms/xlib/qxlibkeyboard.cpp
index 1d3dc83464..688ff5bf4a 100644
--- a/src/plugins/platforms/xlib/qxlibkeyboard.cpp
+++ b/src/plugins/platforms/xlib/qxlibkeyboard.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.h b/src/plugins/platforms/xlib/qxlibkeyboard.h
index a33ad61d27..4f781983e6 100644
--- a/src/plugins/platforms/xlib/qxlibkeyboard.h
+++ b/src/plugins/platforms/xlib/qxlibkeyboard.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibmime.cpp b/src/plugins/platforms/xlib/qxlibmime.cpp
index 4f29a13063..40faa7ed98 100644
--- a/src/plugins/platforms/xlib/qxlibmime.cpp
+++ b/src/plugins/platforms/xlib/qxlibmime.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibmime.h b/src/plugins/platforms/xlib/qxlibmime.h
index ddfe908d88..a10b0002f9 100644
--- a/src/plugins/platforms/xlib/qxlibmime.h
+++ b/src/plugins/platforms/xlib/qxlibmime.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibnativeinterface.cpp b/src/plugins/platforms/xlib/qxlibnativeinterface.cpp
index 2c706e64e4..154b31fe3f 100644
--- a/src/plugins/platforms/xlib/qxlibnativeinterface.cpp
+++ b/src/plugins/platforms/xlib/qxlibnativeinterface.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibnativeinterface.h b/src/plugins/platforms/xlib/qxlibnativeinterface.h
index 4c6ce770b0..7bb5b01f61 100644
--- a/src/plugins/platforms/xlib/qxlibnativeinterface.h
+++ b/src/plugins/platforms/xlib/qxlibnativeinterface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibscreen.cpp b/src/plugins/platforms/xlib/qxlibscreen.cpp
index 314a3e4ecb..c9b8bae49a 100644
--- a/src/plugins/platforms/xlib/qxlibscreen.cpp
+++ b/src/plugins/platforms/xlib/qxlibscreen.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibscreen.h b/src/plugins/platforms/xlib/qxlibscreen.h
index 13fc03ef0f..44d2174f17 100644
--- a/src/plugins/platforms/xlib/qxlibscreen.h
+++ b/src/plugins/platforms/xlib/qxlibscreen.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibstatic.cpp b/src/plugins/platforms/xlib/qxlibstatic.cpp
index c9ed13aeea..147c591b85 100644
--- a/src/plugins/platforms/xlib/qxlibstatic.cpp
+++ b/src/plugins/platforms/xlib/qxlibstatic.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibstatic.h b/src/plugins/platforms/xlib/qxlibstatic.h
index a4a2106a77..d203fa3d5d 100644
--- a/src/plugins/platforms/xlib/qxlibstatic.h
+++ b/src/plugins/platforms/xlib/qxlibstatic.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp
index c14fadaaaa..eeb028d359 100644
--- a/src/plugins/platforms/xlib/qxlibwindow.cpp
+++ b/src/plugins/platforms/xlib/qxlibwindow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -303,10 +303,11 @@ WId QXlibWindow::winId() const
return x_window;
}
-void QXlibWindow::setParent(const QPlatformWindow *window)
+void QXlibWindow::setParent(const QPlatformWindow *parent)
{
QPoint topLeft = geometry().topLeft();
- XReparentWindow(mScreen->display()->nativeDisplay(),x_window,window->winId(),topLeft.x(),topLeft.y());
+ WId parentWinId = parent ? parent->winId() : mScreen->rootWindow();
+ XReparentWindow(mScreen->display()->nativeDisplay(),x_window,parentWinId,topLeft.x(),topLeft.y());
}
void QXlibWindow::raise()
diff --git a/src/plugins/platforms/xlib/qxlibwindow.h b/src/plugins/platforms/xlib/qxlibwindow.h
index 9b64dc5624..f3e83deed5 100644
--- a/src/plugins/platforms/xlib/qxlibwindow.h
+++ b/src/plugins/platforms/xlib/qxlibwindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -112,7 +112,7 @@ public:
void setVisible(bool visible);
WId winId() const;
- void setParent(const QPlatformWindow *window);
+ void setParent(const QPlatformWindow *parent);
void raise();
void lower();
void setWindowTitle(const QString &title);
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 14036e690c..d88db04f28 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -1,12 +1,12 @@
TEMPLATE = subdirs
-SUBDIRS *= sqldrivers bearer
+SUBDIRS *= sqldrivers bearer
unix {
contains(QT_CONFIG,iconv)|contains(QT_CONFIG,gnu-libiconv)|contains(QT_CONFIG,sun-libiconv):SUBDIRS *= codecs
} else {
SUBDIRS *= codecs
}
!contains(QT_CONFIG, no-gui): SUBDIRS *= imageformats
-!contains(QT_CONFIG, no-gui):SUBDIRS += accessible
+!isEmpty(QT.widgets.name): SUBDIRS += accessible
SUBDIRS += platforms platforminputcontexts printsupport
diff --git a/src/plugins/printsupport/windows/main.cpp b/src/plugins/printsupport/windows/main.cpp
index 1ed8f6d0ad..415663b260 100644
--- a/src/plugins/printsupport/windows/main.cpp
+++ b/src/plugins/printsupport/windows/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/printsupport/windows/qwindowsprinterinfo.cpp b/src/plugins/printsupport/windows/qwindowsprinterinfo.cpp
index 09ae632587..1420186a36 100644
--- a/src/plugins/printsupport/windows/qwindowsprinterinfo.cpp
+++ b/src/plugins/printsupport/windows/qwindowsprinterinfo.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/printsupport/windows/qwindowsprintersupport.cpp b/src/plugins/printsupport/windows/qwindowsprintersupport.cpp
index f7033733e1..208c26ea0b 100644
--- a/src/plugins/printsupport/windows/qwindowsprintersupport.cpp
+++ b/src/plugins/printsupport/windows/qwindowsprintersupport.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/printsupport/windows/qwindowsprintersupport.h b/src/plugins/printsupport/windows/qwindowsprintersupport.h
index c45e79587a..2774d0693a 100644
--- a/src/plugins/printsupport/windows/qwindowsprintersupport.h
+++ b/src/plugins/printsupport/windows/qwindowsprintersupport.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/sqldrivers/db2/main.cpp b/src/plugins/sqldrivers/db2/main.cpp
index b8e9bdd835..1a6ca90776 100644
--- a/src/plugins/sqldrivers/db2/main.cpp
+++ b/src/plugins/sqldrivers/db2/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/sqldrivers/ibase/main.cpp b/src/plugins/sqldrivers/ibase/main.cpp
index 6b3e088208..059620314e 100644
--- a/src/plugins/sqldrivers/ibase/main.cpp
+++ b/src/plugins/sqldrivers/ibase/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/sqldrivers/mysql/main.cpp b/src/plugins/sqldrivers/mysql/main.cpp
index de16ea760e..5243c2cb33 100644
--- a/src/plugins/sqldrivers/mysql/main.cpp
+++ b/src/plugins/sqldrivers/mysql/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/sqldrivers/oci/main.cpp b/src/plugins/sqldrivers/oci/main.cpp
index a97126501b..8d95db8867 100644
--- a/src/plugins/sqldrivers/oci/main.cpp
+++ b/src/plugins/sqldrivers/oci/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/sqldrivers/odbc/main.cpp b/src/plugins/sqldrivers/odbc/main.cpp
index cd5debfd75..9b8cac6f98 100644
--- a/src/plugins/sqldrivers/odbc/main.cpp
+++ b/src/plugins/sqldrivers/odbc/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/sqldrivers/psql/main.cpp b/src/plugins/sqldrivers/psql/main.cpp
index ecaca84670..ce2273da5b 100644
--- a/src/plugins/sqldrivers/psql/main.cpp
+++ b/src/plugins/sqldrivers/psql/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/sqldrivers/sqlite/smain.cpp b/src/plugins/sqldrivers/sqlite/smain.cpp
index f61ace9f4b..8027f01bf3 100644
--- a/src/plugins/sqldrivers/sqlite/smain.cpp
+++ b/src/plugins/sqldrivers/sqlite/smain.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/sqldrivers/sqlite2/smain.cpp b/src/plugins/sqldrivers/sqlite2/smain.cpp
index de2299cc75..ebdb0b4d54 100644
--- a/src/plugins/sqldrivers/sqlite2/smain.cpp
+++ b/src/plugins/sqldrivers/sqlite2/smain.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/plugins/sqldrivers/tds/main.cpp b/src/plugins/sqldrivers/tds/main.cpp
index bde409ddc6..81e3a21f9b 100644
--- a/src/plugins/sqldrivers/tds/main.cpp
+++ b/src/plugins/sqldrivers/tds/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qabstractpagesetupdialog.cpp b/src/printsupport/dialogs/qabstractpagesetupdialog.cpp
index 8268065bfd..33408b6bd2 100644
--- a/src/printsupport/dialogs/qabstractpagesetupdialog.cpp
+++ b/src/printsupport/dialogs/qabstractpagesetupdialog.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qabstractpagesetupdialog.h b/src/printsupport/dialogs/qabstractpagesetupdialog.h
index 597a7258d9..821d8775da 100644
--- a/src/printsupport/dialogs/qabstractpagesetupdialog.h
+++ b/src/printsupport/dialogs/qabstractpagesetupdialog.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qabstractpagesetupdialog_p.h b/src/printsupport/dialogs/qabstractpagesetupdialog_p.h
index 3a4711dd6b..659114cc8e 100644
--- a/src/printsupport/dialogs/qabstractpagesetupdialog_p.h
+++ b/src/printsupport/dialogs/qabstractpagesetupdialog_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qabstractprintdialog.cpp b/src/printsupport/dialogs/qabstractprintdialog.cpp
index 25a287945c..fa91c715c0 100644
--- a/src/printsupport/dialogs/qabstractprintdialog.cpp
+++ b/src/printsupport/dialogs/qabstractprintdialog.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qabstractprintdialog.h b/src/printsupport/dialogs/qabstractprintdialog.h
index 2f8a750827..da6c831347 100644
--- a/src/printsupport/dialogs/qabstractprintdialog.h
+++ b/src/printsupport/dialogs/qabstractprintdialog.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qabstractprintdialog_p.h b/src/printsupport/dialogs/qabstractprintdialog_p.h
index e329cb3169..3ecd749f2d 100644
--- a/src/printsupport/dialogs/qabstractprintdialog_p.h
+++ b/src/printsupport/dialogs/qabstractprintdialog_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qpagesetupdialog.cpp b/src/printsupport/dialogs/qpagesetupdialog.cpp
index 9c37572c3d..f63835f5e4 100644
--- a/src/printsupport/dialogs/qpagesetupdialog.cpp
+++ b/src/printsupport/dialogs/qpagesetupdialog.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qpagesetupdialog.h b/src/printsupport/dialogs/qpagesetupdialog.h
index 1581ce6c41..1bc94ba9de 100644
--- a/src/printsupport/dialogs/qpagesetupdialog.h
+++ b/src/printsupport/dialogs/qpagesetupdialog.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qpagesetupdialog_mac.mm b/src/printsupport/dialogs/qpagesetupdialog_mac.mm
index 0bbdbcc242..d2bbfaa412 100644
--- a/src/printsupport/dialogs/qpagesetupdialog_mac.mm
+++ b/src/printsupport/dialogs/qpagesetupdialog_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
index e5b12f8ba5..6dc182631c 100644
--- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
+++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h
index 2303db9fe8..c51b68dcad 100644
--- a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h
+++ b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qpagesetupdialog_win.cpp b/src/printsupport/dialogs/qpagesetupdialog_win.cpp
index f177ec4ea5..276cfc1b5b 100644
--- a/src/printsupport/dialogs/qpagesetupdialog_win.cpp
+++ b/src/printsupport/dialogs/qpagesetupdialog_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qprintdialog.h b/src/printsupport/dialogs/qprintdialog.h
index 06ad99d02e..09d5213bad 100644
--- a/src/printsupport/dialogs/qprintdialog.h
+++ b/src/printsupport/dialogs/qprintdialog.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qprintdialog.qdoc b/src/printsupport/dialogs/qprintdialog.qdoc
index 6418fa2b58..238e22df51 100644
--- a/src/printsupport/dialogs/qprintdialog.qdoc
+++ b/src/printsupport/dialogs/qprintdialog.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qprintdialog_mac.mm b/src/printsupport/dialogs/qprintdialog_mac.mm
index b1f211ffb3..a4f73ea396 100644
--- a/src/printsupport/dialogs/qprintdialog_mac.mm
+++ b/src/printsupport/dialogs/qprintdialog_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp
index d503623bae..2e338ad884 100644
--- a/src/printsupport/dialogs/qprintdialog_unix.cpp
+++ b/src/printsupport/dialogs/qprintdialog_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qprintdialog_win.cpp b/src/printsupport/dialogs/qprintdialog_win.cpp
index d413faeb18..24ba6e6910 100644
--- a/src/printsupport/dialogs/qprintdialog_win.cpp
+++ b/src/printsupport/dialogs/qprintdialog_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qprintpreviewdialog.cpp b/src/printsupport/dialogs/qprintpreviewdialog.cpp
index 7e5c7dac94..50783969c5 100644
--- a/src/printsupport/dialogs/qprintpreviewdialog.cpp
+++ b/src/printsupport/dialogs/qprintpreviewdialog.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/dialogs/qprintpreviewdialog.h b/src/printsupport/dialogs/qprintpreviewdialog.h
index f2997b09f5..f87cedafa7 100644
--- a/src/printsupport/dialogs/qprintpreviewdialog.h
+++ b/src/printsupport/dialogs/qprintpreviewdialog.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qcups.cpp b/src/printsupport/kernel/qcups.cpp
index 76050d9d71..46a6545952 100644
--- a/src/printsupport/kernel/qcups.cpp
+++ b/src/printsupport/kernel/qcups.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qcups_p.h b/src/printsupport/kernel/qcups_p.h
index cb7a79e486..3ad6e3e6a3 100644
--- a/src/printsupport/kernel/qcups_p.h
+++ b/src/printsupport/kernel/qcups_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qpaintengine_alpha.cpp b/src/printsupport/kernel/qpaintengine_alpha.cpp
index beda2c7144..6c0d1d8c26 100644
--- a/src/printsupport/kernel/qpaintengine_alpha.cpp
+++ b/src/printsupport/kernel/qpaintengine_alpha.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -223,25 +223,6 @@ void QAlphaPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRe
}
}
-void QAlphaPaintEngine::drawImage(const QRectF &r, const QImage &image, const QRectF &sr)
-{
- Q_D(QAlphaPaintEngine);
-
- QRectF tr = d->m_transform.mapRect(r);
- if (d->m_pass == 0) {
- d->m_continueCall = false;
- if (image.hasAlphaChannel() || d->m_alphaOpacity || d->m_complexTransform) {
- d->addAlphaRect(tr);
- }
-
- if (d->m_picengine)
- d->m_picengine->drawImage(r, image, sr);
-
- } else {
- d->m_continueCall = !d->fullyContained(tr);
- }
-}
-
void QAlphaPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
{
Q_D(QAlphaPaintEngine);
diff --git a/src/printsupport/kernel/qpaintengine_alpha_p.h b/src/printsupport/kernel/qpaintengine_alpha_p.h
index b662c166e8..e04d2a61da 100644
--- a/src/printsupport/kernel/qpaintengine_alpha_p.h
+++ b/src/printsupport/kernel/qpaintengine_alpha_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -76,7 +76,6 @@ public:
virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
- virtual void drawImage(const QRectF &r, const QImage &image, const QRectF &sr);
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem);
virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
diff --git a/src/printsupport/kernel/qpaintengine_preview.cpp b/src/printsupport/kernel/qpaintengine_preview.cpp
index 3cf06f5770..12de24d59d 100644
--- a/src/printsupport/kernel/qpaintengine_preview.cpp
+++ b/src/printsupport/kernel/qpaintengine_preview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qpaintengine_preview_p.h b/src/printsupport/kernel/qpaintengine_preview_p.h
index c2e11313c2..417870827e 100644
--- a/src/printsupport/kernel/qpaintengine_preview_p.h
+++ b/src/printsupport/kernel/qpaintengine_preview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qplatformprintersupport_qpa.cpp b/src/printsupport/kernel/qplatformprintersupport_qpa.cpp
index e97ca3fef4..08a59f5f1b 100644
--- a/src/printsupport/kernel/qplatformprintersupport_qpa.cpp
+++ b/src/printsupport/kernel/qplatformprintersupport_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qplatformprintersupport_qpa.h b/src/printsupport/kernel/qplatformprintersupport_qpa.h
index 800713c5bb..690f91bd0b 100644
--- a/src/printsupport/kernel/qplatformprintersupport_qpa.h
+++ b/src/printsupport/kernel/qplatformprintersupport_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qplatformprintplugin.cpp b/src/printsupport/kernel/qplatformprintplugin.cpp
index 8b3c75127e..6b131855e8 100644
--- a/src/printsupport/kernel/qplatformprintplugin.cpp
+++ b/src/printsupport/kernel/qplatformprintplugin.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qplatformprintplugin_qpa.h b/src/printsupport/kernel/qplatformprintplugin_qpa.h
index 831a0546b0..173e7818a2 100644
--- a/src/printsupport/kernel/qplatformprintplugin_qpa.h
+++ b/src/printsupport/kernel/qplatformprintplugin_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qprintengine.h b/src/printsupport/kernel/qprintengine.h
index 782b6ef8bd..222f992f62 100644
--- a/src/printsupport/kernel/qprintengine.h
+++ b/src/printsupport/kernel/qprintengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qprintengine_pdf.cpp b/src/printsupport/kernel/qprintengine_pdf.cpp
index c8ce2cfa0f..e66dfe5ae9 100644
--- a/src/printsupport/kernel/qprintengine_pdf.cpp
+++ b/src/printsupport/kernel/qprintengine_pdf.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -303,7 +303,7 @@ QVariant QPdfPrintEngine::property(PrintEnginePropertyKey key) const
ret = d->pageOrder;
break;
case PPK_PaperSize:
- ret = d->paperSize;
+ ret = d->printerPaperSize;
break;
case PPK_PaperSource:
ret = d->paperSource;
diff --git a/src/printsupport/kernel/qprintengine_pdf_p.h b/src/printsupport/kernel/qprintengine_pdf_p.h
index 483cde9af9..c97635f941 100644
--- a/src/printsupport/kernel/qprintengine_pdf_p.h
+++ b/src/printsupport/kernel/qprintengine_pdf_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index 52fd765051..48256388ea 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qprintengine_win_p.h b/src/printsupport/kernel/qprintengine_win_p.h
index 566e42ea2f..e11b3cb63c 100644
--- a/src/printsupport/kernel/qprintengine_win_p.h
+++ b/src/printsupport/kernel/qprintengine_win_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp
index 03d58667d4..ae5b2def62 100644
--- a/src/printsupport/kernel/qprinter.cpp
+++ b/src/printsupport/kernel/qprinter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qprinter.h b/src/printsupport/kernel/qprinter.h
index f09a4cc798..a4964d64bc 100644
--- a/src/printsupport/kernel/qprinter.h
+++ b/src/printsupport/kernel/qprinter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qprinter_p.h b/src/printsupport/kernel/qprinter_p.h
index 362202fe32..d798207379 100644
--- a/src/printsupport/kernel/qprinter_p.h
+++ b/src/printsupport/kernel/qprinter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qprinterinfo.cpp b/src/printsupport/kernel/qprinterinfo.cpp
index baff9e88dc..c49c8ab7cd 100644
--- a/src/printsupport/kernel/qprinterinfo.cpp
+++ b/src/printsupport/kernel/qprinterinfo.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qprinterinfo.h b/src/printsupport/kernel/qprinterinfo.h
index 59e6f2c138..22372158dc 100644
--- a/src/printsupport/kernel/qprinterinfo.h
+++ b/src/printsupport/kernel/qprinterinfo.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qprinterinfo_p.h b/src/printsupport/kernel/qprinterinfo_p.h
index 6c94e4e227..6a30eb062e 100644
--- a/src/printsupport/kernel/qprinterinfo_p.h
+++ b/src/printsupport/kernel/qprinterinfo_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qprinterinfo_unix.cpp b/src/printsupport/kernel/qprinterinfo_unix.cpp
index 63b7a2a7d9..9aeba9a4ce 100644
--- a/src/printsupport/kernel/qprinterinfo_unix.cpp
+++ b/src/printsupport/kernel/qprinterinfo_unix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/kernel/qprinterinfo_unix_p.h b/src/printsupport/kernel/qprinterinfo_unix_p.h
index c12aa39556..4d69e5ae21 100644
--- a/src/printsupport/kernel/qprinterinfo_unix_p.h
+++ b/src/printsupport/kernel/qprinterinfo_unix_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/widgets/qprintpreviewwidget.cpp b/src/printsupport/widgets/qprintpreviewwidget.cpp
index 6514a1af8b..551f9d2ced 100644
--- a/src/printsupport/widgets/qprintpreviewwidget.cpp
+++ b/src/printsupport/widgets/qprintpreviewwidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/printsupport/widgets/qprintpreviewwidget.h b/src/printsupport/widgets/qprintpreviewwidget.h
index 1c12bc0945..d3551b9c08 100644
--- a/src/printsupport/widgets/qprintpreviewwidget.h
+++ b/src/printsupport/widgets/qprintpreviewwidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp
index 1cd782dbcb..f8a803568e 100644
--- a/src/sql/drivers/db2/qsql_db2.cpp
+++ b/src/sql/drivers/db2/qsql_db2.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/drivers/db2/qsql_db2.h b/src/sql/drivers/db2/qsql_db2.h
index 51450c134b..4982aba776 100644
--- a/src/sql/drivers/db2/qsql_db2.h
+++ b/src/sql/drivers/db2/qsql_db2.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp
index f5423d963d..3d08649de9 100644
--- a/src/sql/drivers/ibase/qsql_ibase.cpp
+++ b/src/sql/drivers/ibase/qsql_ibase.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/drivers/ibase/qsql_ibase.h b/src/sql/drivers/ibase/qsql_ibase.h
index 878d5f2a2b..cd8d302db5 100644
--- a/src/sql/drivers/ibase/qsql_ibase.h
+++ b/src/sql/drivers/ibase/qsql_ibase.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index 96b3b3fff1..b0d8d04d1e 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/drivers/mysql/qsql_mysql.h b/src/sql/drivers/mysql/qsql_mysql.h
index b45d7c3bab..632d29305b 100644
--- a/src/sql/drivers/mysql/qsql_mysql.h
+++ b/src/sql/drivers/mysql/qsql_mysql.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp
index 059cce6f5c..9b4f887421 100644
--- a/src/sql/drivers/oci/qsql_oci.cpp
+++ b/src/sql/drivers/oci/qsql_oci.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/drivers/oci/qsql_oci.h b/src/sql/drivers/oci/qsql_oci.h
index 1d1bf59962..5b82829221 100644
--- a/src/sql/drivers/oci/qsql_oci.h
+++ b/src/sql/drivers/oci/qsql_oci.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 168ea22e3e..f0d66ea872 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -84,7 +84,7 @@ inline static QString fromSQLTCHAR(const QVarLengthArray<SQLTCHAR>& input, int s
result=QString::fromUcs4((const uint *)input.constData(), realsize);
break;
default:
- qCritical() << "sizeof(SQLTCHAR) is " << sizeof(SQLTCHAR) << "Don't know how to handle this";
+ qCritical("sizeof(SQLTCHAR) is %d. Don't know how to handle this.", sizeof(SQLTCHAR));
}
return result;
}
@@ -104,7 +104,7 @@ inline static QVarLengthArray<SQLTCHAR> toSQLTCHAR(const QString &input)
memcpy(result.data(), input.toUcs4().data(), input.size() * 4);
break;
default:
- qCritical() << "sizeof(SQLTCHAR) is " << sizeof(SQLTCHAR) << "Don't know how to handle this";
+ qCritical("sizeof(SQLTCHAR) is %d. Don't know how to handle this.", sizeof(SQLTCHAR));
}
result.append(0); // make sure it's null terminated, doesn't matter if it already is, it does if it isn't.
return result;
diff --git a/src/sql/drivers/odbc/qsql_odbc.h b/src/sql/drivers/odbc/qsql_odbc.h
index 1ac4549f6f..c28ebce535 100644
--- a/src/sql/drivers/odbc/qsql_odbc.h
+++ b/src/sql/drivers/odbc/qsql_odbc.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
index c8578c6de7..55d8cc6146 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/sql/drivers/psql/qsql_psql.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/drivers/psql/qsql_psql.h b/src/sql/drivers/psql/qsql_psql.h
index 8b23bfbeb4..16a40463fb 100644
--- a/src/sql/drivers/psql/qsql_psql.h
+++ b/src/sql/drivers/psql/qsql_psql.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp
index 38e4a63d57..d7ec53c451 100644
--- a/src/sql/drivers/sqlite/qsql_sqlite.cpp
+++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -292,7 +292,9 @@ QSQLiteResult::QSQLiteResult(const QSQLiteDriver* db)
QSQLiteResult::~QSQLiteResult()
{
- qobject_cast<const QSQLiteDriver *>(driver())->d->results.removeOne(this);
+ const QSqlDriver *sqlDriver = driver();
+ if (sqlDriver)
+ qobject_cast<const QSQLiteDriver *>(sqlDriver)->d->results.removeOne(this);
d->cleanup();
delete d;
}
diff --git a/src/sql/drivers/sqlite/qsql_sqlite.h b/src/sql/drivers/sqlite/qsql_sqlite.h
index 2ee8e09661..eac90b1e47 100644
--- a/src/sql/drivers/sqlite/qsql_sqlite.h
+++ b/src/sql/drivers/sqlite/qsql_sqlite.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
index 6593a69625..d69acc15a6 100644
--- a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
+++ b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.h b/src/sql/drivers/sqlite2/qsql_sqlite2.h
index a34706d8f3..6372495a54 100644
--- a/src/sql/drivers/sqlite2/qsql_sqlite2.h
+++ b/src/sql/drivers/sqlite2/qsql_sqlite2.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp
index 735e68b603..c97d96beb8 100644
--- a/src/sql/drivers/tds/qsql_tds.cpp
+++ b/src/sql/drivers/tds/qsql_tds.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/drivers/tds/qsql_tds.h b/src/sql/drivers/tds/qsql_tds.h
index 7808b5fd14..d14d1b6cf7 100644
--- a/src/sql/drivers/tds/qsql_tds.h
+++ b/src/sql/drivers/tds/qsql_tds.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsql.h b/src/sql/kernel/qsql.h
index f23b518bfb..54c9a684f6 100644
--- a/src/sql/kernel/qsql.h
+++ b/src/sql/kernel/qsql.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsql.qdoc b/src/sql/kernel/qsql.qdoc
index 06ea601229..a935acb661 100644
--- a/src/sql/kernel/qsql.qdoc
+++ b/src/sql/kernel/qsql.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqlcachedresult.cpp b/src/sql/kernel/qsqlcachedresult.cpp
index 78a9758c9e..a2ae24a2f4 100644
--- a/src/sql/kernel/qsqlcachedresult.cpp
+++ b/src/sql/kernel/qsqlcachedresult.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqlcachedresult_p.h b/src/sql/kernel/qsqlcachedresult_p.h
index dced9e7479..c2e4aeb2be 100644
--- a/src/sql/kernel/qsqlcachedresult_p.h
+++ b/src/sql/kernel/qsqlcachedresult_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp
index 6aa45c46e1..7ba3c24999 100644
--- a/src/sql/kernel/qsqldatabase.cpp
+++ b/src/sql/kernel/qsqldatabase.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqldatabase.h b/src/sql/kernel/qsqldatabase.h
index 72c5694ceb..9dfbd43ed2 100644
--- a/src/sql/kernel/qsqldatabase.h
+++ b/src/sql/kernel/qsqldatabase.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqldriver.cpp b/src/sql/kernel/qsqldriver.cpp
index f5436ff594..3b64bb10cb 100644
--- a/src/sql/kernel/qsqldriver.cpp
+++ b/src/sql/kernel/qsqldriver.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqldriver.h b/src/sql/kernel/qsqldriver.h
index ee1e52538a..446cdf4df6 100644
--- a/src/sql/kernel/qsqldriver.h
+++ b/src/sql/kernel/qsqldriver.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqldriverplugin.cpp b/src/sql/kernel/qsqldriverplugin.cpp
index 8b9adb64d0..0f98ce3196 100644
--- a/src/sql/kernel/qsqldriverplugin.cpp
+++ b/src/sql/kernel/qsqldriverplugin.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqldriverplugin.h b/src/sql/kernel/qsqldriverplugin.h
index 2c1def0a54..13ffd1e409 100644
--- a/src/sql/kernel/qsqldriverplugin.h
+++ b/src/sql/kernel/qsqldriverplugin.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqlerror.cpp b/src/sql/kernel/qsqlerror.cpp
index fd731e4974..8a8d2c318a 100644
--- a/src/sql/kernel/qsqlerror.cpp
+++ b/src/sql/kernel/qsqlerror.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqlerror.h b/src/sql/kernel/qsqlerror.h
index c1df370a86..11ebf5a615 100644
--- a/src/sql/kernel/qsqlerror.h
+++ b/src/sql/kernel/qsqlerror.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqlfield.cpp b/src/sql/kernel/qsqlfield.cpp
index 95e9a195a6..dca9e169fa 100644
--- a/src/sql/kernel/qsqlfield.cpp
+++ b/src/sql/kernel/qsqlfield.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqlfield.h b/src/sql/kernel/qsqlfield.h
index 93992ea9d4..3188b18a4a 100644
--- a/src/sql/kernel/qsqlfield.h
+++ b/src/sql/kernel/qsqlfield.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqlindex.cpp b/src/sql/kernel/qsqlindex.cpp
index 764e93a678..ad66e814ef 100644
--- a/src/sql/kernel/qsqlindex.cpp
+++ b/src/sql/kernel/qsqlindex.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqlindex.h b/src/sql/kernel/qsqlindex.h
index c88e30603f..328a8716e2 100644
--- a/src/sql/kernel/qsqlindex.h
+++ b/src/sql/kernel/qsqlindex.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqlnulldriver_p.h b/src/sql/kernel/qsqlnulldriver_p.h
index 1334e4229b..9de9c5641b 100644
--- a/src/sql/kernel/qsqlnulldriver_p.h
+++ b/src/sql/kernel/qsqlnulldriver_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp
index 74812b5bb7..4b65ef1d8b 100644
--- a/src/sql/kernel/qsqlquery.cpp
+++ b/src/sql/kernel/qsqlquery.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqlquery.h b/src/sql/kernel/qsqlquery.h
index bd498f344a..2791784374 100644
--- a/src/sql/kernel/qsqlquery.h
+++ b/src/sql/kernel/qsqlquery.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqlrecord.cpp b/src/sql/kernel/qsqlrecord.cpp
index 3f14cba245..18dd9fbc80 100644
--- a/src/sql/kernel/qsqlrecord.cpp
+++ b/src/sql/kernel/qsqlrecord.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqlrecord.h b/src/sql/kernel/qsqlrecord.h
index 8c7a17ab1d..52168255d2 100644
--- a/src/sql/kernel/qsqlrecord.h
+++ b/src/sql/kernel/qsqlrecord.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/kernel/qsqlresult.cpp b/src/sql/kernel/qsqlresult.cpp
index 71a81c0a8d..de348c99f5 100644
--- a/src/sql/kernel/qsqlresult.cpp
+++ b/src/sql/kernel/qsqlresult.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -48,6 +48,7 @@
#include "qsqlresult.h"
#include "qvector.h"
#include "qsqldriver.h"
+#include "qpointer.h"
#include <QDebug>
QT_BEGIN_NAMESPACE
@@ -64,7 +65,7 @@ class QSqlResultPrivate
{
public:
QSqlResultPrivate(QSqlResult* d)
- : q(d), sqldriver(0), idx(QSql::BeforeFirstRow), active(false),
+ : q(d), idx(QSql::BeforeFirstRow), active(false),
isSel(false), forwardOnly(false), precisionPolicy(QSql::LowPrecisionDouble), bindCount(0), binds(QSqlResult::PositionalBinding)
{}
@@ -98,7 +99,7 @@ public:
public:
QSqlResult* q;
- const QSqlDriver* sqldriver;
+ QPointer<QSqlDriver> sqldriver;
int idx;
QString sql;
bool active;
@@ -250,7 +251,7 @@ QString QSqlResultPrivate::namedToPositionalBinding()
QSqlResult::QSqlResult(const QSqlDriver *db)
{
d = new QSqlResultPrivate(this);
- d->sqldriver = db;
+ d->sqldriver = const_cast<QSqlDriver *>(db);
if(db) {
setNumericalPrecisionPolicy(db->numericalPrecisionPolicy());
}
diff --git a/src/sql/kernel/qsqlresult.h b/src/sql/kernel/qsqlresult.h
index 984bd5e03f..07780937a6 100644
--- a/src/sql/kernel/qsqlresult.h
+++ b/src/sql/kernel/qsqlresult.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp
index 5e61922916..a740071d33 100644
--- a/src/sql/models/qsqlquerymodel.cpp
+++ b/src/sql/models/qsqlquerymodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/models/qsqlquerymodel.h b/src/sql/models/qsqlquerymodel.h
index 5836122ad5..75ae2a5eff 100644
--- a/src/sql/models/qsqlquerymodel.h
+++ b/src/sql/models/qsqlquerymodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/models/qsqlquerymodel_p.h b/src/sql/models/qsqlquerymodel_p.h
index f974882602..c25d3c98a0 100644
--- a/src/sql/models/qsqlquerymodel_p.h
+++ b/src/sql/models/qsqlquerymodel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/models/qsqlrelationaldelegate.cpp b/src/sql/models/qsqlrelationaldelegate.cpp
index c20b5f86da..aaba25d06a 100644
--- a/src/sql/models/qsqlrelationaldelegate.cpp
+++ b/src/sql/models/qsqlrelationaldelegate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/models/qsqlrelationaldelegate.h b/src/sql/models/qsqlrelationaldelegate.h
index 93f0089c71..60e56ff99d 100644
--- a/src/sql/models/qsqlrelationaldelegate.h
+++ b/src/sql/models/qsqlrelationaldelegate.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/models/qsqlrelationaltablemodel.cpp b/src/sql/models/qsqlrelationaltablemodel.cpp
index ad05e0f39b..6b0ed06ac4 100644
--- a/src/sql/models/qsqlrelationaltablemodel.cpp
+++ b/src/sql/models/qsqlrelationaltablemodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -715,7 +715,7 @@ void QSqlRelationalTableModel::clear()
\value InnerJoin - Inner join mode, return rows when there is at least one match in both tables.
\value LeftJoin - Left join mode, returns all rows from the left table (table_name1), even if there are no matches in the right table (table_name2).
- \see QSqlRelationalTableModel::setJoinMode
+ \sa QSqlRelationalTableModel::setJoinMode
\since 4.8
*/
@@ -724,7 +724,7 @@ void QSqlRelationalTableModel::clear()
In InnerJoin mode (the default) these rows will not be showed: use the
LeftJoin mode if you want to show them.
- \see QSqlRelationalTableModel::JoinMode
+ \sa QSqlRelationalTableModel::JoinMode
\since 4.8
*/
void QSqlRelationalTableModel::setJoinMode( QSqlRelationalTableModel::JoinMode joinMode )
diff --git a/src/sql/models/qsqlrelationaltablemodel.h b/src/sql/models/qsqlrelationaltablemodel.h
index 32d88b3189..decdc08216 100644
--- a/src/sql/models/qsqlrelationaltablemodel.h
+++ b/src/sql/models/qsqlrelationaltablemodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp
index c615a30b48..d2b9427287 100644
--- a/src/sql/models/qsqltablemodel.cpp
+++ b/src/sql/models/qsqltablemodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/models/qsqltablemodel.h b/src/sql/models/qsqltablemodel.h
index 87ddfc08d6..d40e591238 100644
--- a/src/sql/models/qsqltablemodel.h
+++ b/src/sql/models/qsqltablemodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/sql/models/qsqltablemodel_p.h b/src/sql/models/qsqltablemodel_p.h
index 1c448f8fe5..9275712cee 100644
--- a/src/sql/models/qsqltablemodel_p.h
+++ b/src/sql/models/qsqltablemodel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/src.pro b/src/src.pro
index 0f7a380984..80d1c4e3bd 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -10,7 +10,6 @@ nacl: SRC_SUBDIRS -= src_network src_testlib
contains(QT_CONFIG, dbus):SRC_SUBDIRS += src_dbus
contains(QT_CONFIG, no-gui): SRC_SUBDIRS -= src_gui
-contains(QT_CONFIG, v8): SRC_SUBDIRS += src_v8
contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2): SRC_SUBDIRS += src_opengl
SRC_SUBDIRS += src_plugins
@@ -19,8 +18,6 @@ src_winmain.subdir = $$QT_SOURCE_TREE/src/winmain
src_winmain.target = sub-winmain
src_corelib.subdir = $$QT_SOURCE_TREE/src/corelib
src_corelib.target = sub-corelib
-src_v8.subdir = $$QT_SOURCE_TREE/src/v8
-src_v8.target = sub-v8
src_xml.subdir = $$QT_SOURCE_TREE/src/xml
src_xml.target = sub-xml
src_dbus.subdir = $$QT_SOURCE_TREE/src/dbus
@@ -65,7 +62,6 @@ src_platformsupport.target = sub-platformsupport
src_declarative.depends += src_opengl
src_webkit.depends += src_opengl
}
- src_v8.depends += src_tools_mkv8snapshot
}
diff --git a/src/testlib/qabstracttestlogger.cpp b/src/testlib/qabstracttestlogger.cpp
index f7d8842c4c..d3a2678ecf 100644
--- a/src/testlib/qabstracttestlogger.cpp
+++ b/src/testlib/qabstracttestlogger.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -80,12 +80,29 @@ QAbstractTestLogger::~QAbstractTestLogger()
stream = 0;
}
+void QAbstractTestLogger::filterUnprintable(char *str) const
+{
+ char *idx = str;
+ while (*idx) {
+ if (((*idx < 0x20 && *idx != '\n' && *idx != '\t') || *idx > 0x7e))
+ *idx = '?';
+ ++idx;
+ }
+}
+
void QAbstractTestLogger::outputString(const char *msg)
{
QTEST_ASSERT(stream);
+ QTEST_ASSERT(msg);
- ::fputs(msg, stream);
+ char *filtered = new char[strlen(msg) + 1];
+ strcpy(filtered, msg);
+ filterUnprintable(filtered);
+
+ ::fputs(filtered, stream);
::fflush(stream);
+
+ delete [] filtered;
}
void QAbstractTestLogger::startLogging()
@@ -135,8 +152,6 @@ int qt_asprintf(QTestCharBuffer *str, const char *format, ...)
break; // out of memory - take what we have
}
- filter_unprintable(str->data());
-
return res;
}
diff --git a/src/testlib/qabstracttestlogger_p.h b/src/testlib/qabstracttestlogger_p.h
index 3e11863012..009fbddf23 100644
--- a/src/testlib/qabstracttestlogger_p.h
+++ b/src/testlib/qabstracttestlogger_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -99,6 +99,7 @@ public:
void outputString(const char *msg);
protected:
+ void filterUnprintable(char *str) const;
FILE *stream;
};
diff --git a/src/testlib/qasciikey.cpp b/src/testlib/qasciikey.cpp
index bcbbddff63..ee18ec87f6 100644
--- a/src/testlib/qasciikey.cpp
+++ b/src/testlib/qasciikey.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qbenchmark.cpp b/src/testlib/qbenchmark.cpp
index ae15ef259e..b637a6e337 100644
--- a/src/testlib/qbenchmark.cpp
+++ b/src/testlib/qbenchmark.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -285,11 +285,11 @@ void QTest::setBenchmarkResult(qreal result, QTest::QBenchmarkMetric metric)
}
template <typename T>
-Q_TYPENAME T::value_type qAverage(const T &container)
+typename T::value_type qAverage(const T &container)
{
- Q_TYPENAME T::const_iterator it = container.constBegin();
- Q_TYPENAME T::const_iterator end = container.constEnd();
- Q_TYPENAME T::value_type acc = Q_TYPENAME T::value_type();
+ typename T::const_iterator it = container.constBegin();
+ typename T::const_iterator end = container.constEnd();
+ typename T::value_type acc = typename T::value_type();
int count = 0;
while (it != end) {
acc += *it;
diff --git a/src/testlib/qbenchmark.h b/src/testlib/qbenchmark.h
index 586d01be58..d43f1a6297 100644
--- a/src/testlib/qbenchmark.h
+++ b/src/testlib/qbenchmark.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qbenchmark_p.h b/src/testlib/qbenchmark_p.h
index 38f34c416b..402eccfa14 100644
--- a/src/testlib/qbenchmark_p.h
+++ b/src/testlib/qbenchmark_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qbenchmarkevent.cpp b/src/testlib/qbenchmarkevent.cpp
index 05d00156c8..a531d44748 100644
--- a/src/testlib/qbenchmarkevent.cpp
+++ b/src/testlib/qbenchmarkevent.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qbenchmarkevent_p.h b/src/testlib/qbenchmarkevent_p.h
index 3773aea7e7..3f94af2c67 100644
--- a/src/testlib/qbenchmarkevent_p.h
+++ b/src/testlib/qbenchmarkevent_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qbenchmarkmeasurement.cpp b/src/testlib/qbenchmarkmeasurement.cpp
index be52b4f211..db0f7c0958 100644
--- a/src/testlib/qbenchmarkmeasurement.cpp
+++ b/src/testlib/qbenchmarkmeasurement.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qbenchmarkmeasurement_p.h b/src/testlib/qbenchmarkmeasurement_p.h
index 53e44fd531..82721e8c87 100644
--- a/src/testlib/qbenchmarkmeasurement_p.h
+++ b/src/testlib/qbenchmarkmeasurement_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -54,9 +54,7 @@
//
#include <QtCore/qelapsedtimer.h>
-#ifdef HAVE_TICK_COUNTER
#include <QtTest/private/cycle_p.h>
-#endif
#include <QtTest/qbenchmark.h>
QT_BEGIN_NAMESPACE
diff --git a/src/testlib/qbenchmarkmetric.cpp b/src/testlib/qbenchmarkmetric.cpp
index fb7f8f857a..6cd9aa468f 100644
--- a/src/testlib/qbenchmarkmetric.cpp
+++ b/src/testlib/qbenchmarkmetric.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qbenchmarkmetric.h b/src/testlib/qbenchmarkmetric.h
index 133a114cd6..35b441a84e 100644
--- a/src/testlib/qbenchmarkmetric.h
+++ b/src/testlib/qbenchmarkmetric.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qbenchmarkmetric_p.h b/src/testlib/qbenchmarkmetric_p.h
index a3e885b56a..247a2ca795 100644
--- a/src/testlib/qbenchmarkmetric_p.h
+++ b/src/testlib/qbenchmarkmetric_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qbenchmarkvalgrind.cpp b/src/testlib/qbenchmarkvalgrind.cpp
index c511796884..f62cd299bc 100644
--- a/src/testlib/qbenchmarkvalgrind.cpp
+++ b/src/testlib/qbenchmarkvalgrind.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qbenchmarkvalgrind_p.h b/src/testlib/qbenchmarkvalgrind_p.h
index e6a0720a37..f242d85531 100644
--- a/src/testlib/qbenchmarkvalgrind_p.h
+++ b/src/testlib/qbenchmarkvalgrind_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp
index 45fc882492..f0e83183ec 100644
--- a/src/testlib/qplaintestlogger.cpp
+++ b/src/testlib/qplaintestlogger.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -257,7 +257,7 @@ void QPlainTestLogger::printBenchmarkResult(const QBenchmarkResult &result)
const char *bmtag = QTest::benchmarkResult2String();
char buf1[1024];
- QTest::qt_snprintf(
+ qsnprintf(
buf1, sizeof(buf1), "%s: %s::%s",
bmtag,
QTestResult::currentTestObjectName(),
@@ -267,16 +267,15 @@ void QPlainTestLogger::printBenchmarkResult(const QBenchmarkResult &result)
bufTag[0] = 0;
QByteArray tag = result.context.tag.toAscii();
if (tag.isEmpty() == false) {
- QTest::qt_snprintf(bufTag, sizeof(bufTag), ":\"%s\"", tag.data());
+ qsnprintf(bufTag, sizeof(bufTag), ":\"%s\"", tag.data());
}
char fillFormat[8];
int fillLength = 5;
- QTest::qt_snprintf(
- fillFormat, sizeof(fillFormat), ":\n%%%ds", fillLength);
+ qsnprintf(fillFormat, sizeof(fillFormat), ":\n%%%ds", fillLength);
char fill[1024];
- QTest::qt_snprintf(fill, sizeof(fill), fillFormat, "");
+ qsnprintf(fill, sizeof(fill), fillFormat, "");
const char * unitText = QTest::benchmarkMetricUnit(result.metric);
@@ -285,34 +284,24 @@ void QPlainTestLogger::printBenchmarkResult(const QBenchmarkResult &result)
QTest::formatResult(resultBuffer, 100, valuePerIteration, QTest::countSignificantDigits(result.value));
char buf2[1024];
- QTest::qt_snprintf(
- buf2, sizeof(buf2), "%s %s",
- resultBuffer,
- unitText);
+ qsnprintf(buf2, sizeof(buf2), "%s %s", resultBuffer, unitText);
char buf2_[1024];
QByteArray iterationText = " per iteration";
Q_ASSERT(result.iterations > 0);
- QTest::qt_snprintf(
- buf2_,
- sizeof(buf2_), "%s",
- iterationText.data());
+ qsnprintf(buf2_, sizeof(buf2_), "%s", iterationText.data());
char buf3[1024];
Q_ASSERT(result.iterations > 0);
QTest::formatResult(resultBuffer, 100, result.value, QTest::countSignificantDigits(result.value));
- QTest::qt_snprintf(
- buf3, sizeof(buf3), " (total: %s, iterations: %d)",
- resultBuffer,
- result.iterations);
+ qsnprintf(buf3, sizeof(buf3), " (total: %s, iterations: %d)", resultBuffer, result.iterations);
char buf[1024];
if (result.setByMacro) {
- QTest::qt_snprintf(
- buf, sizeof(buf), "%s%s%s%s%s%s\n", buf1, bufTag, fill, buf2, buf2_, buf3);
+ qsnprintf(buf, sizeof(buf), "%s%s%s%s%s%s\n", buf1, bufTag, fill, buf2, buf2_, buf3);
} else {
- QTest::qt_snprintf(buf, sizeof(buf), "%s%s%s%s\n", buf1, bufTag, fill, buf2);
+ qsnprintf(buf, sizeof(buf), "%s%s%s%s\n", buf1, bufTag, fill, buf2);
}
memcpy(buf, bmtag, strlen(bmtag));
@@ -340,13 +329,12 @@ void QPlainTestLogger::startLogging()
char buf[1024];
if (QTestLog::verboseLevel() < 0) {
- QTest::qt_snprintf(buf, sizeof(buf), "Testing %s\n",
- QTestResult::currentTestObjectName());
+ qsnprintf(buf, sizeof(buf), "Testing %s\n", QTestResult::currentTestObjectName());
} else {
- QTest::qt_snprintf(buf, sizeof(buf),
- "********* Start testing of %s *********\n"
- "Config: Using QTest library " QTEST_VERSION_STR
- ", Qt %s\n", QTestResult::currentTestObjectName(), qVersion());
+ qsnprintf(buf, sizeof(buf),
+ "********* Start testing of %s *********\n"
+ "Config: Using QTest library " QTEST_VERSION_STR
+ ", Qt %s\n", QTestResult::currentTestObjectName(), qVersion());
}
outputMessage(buf);
}
@@ -355,15 +343,15 @@ void QPlainTestLogger::stopLogging()
{
char buf[1024];
if (QTestLog::verboseLevel() < 0) {
- QTest::qt_snprintf(buf, sizeof(buf), "Totals: %d passed, %d failed, %d skipped\n",
- QTestResult::passCount(), QTestResult::failCount(),
- QTestResult::skipCount());
+ qsnprintf(buf, sizeof(buf), "Totals: %d passed, %d failed, %d skipped\n",
+ QTestResult::passCount(), QTestResult::failCount(),
+ QTestResult::skipCount());
} else {
- QTest::qt_snprintf(buf, sizeof(buf),
- "Totals: %d passed, %d failed, %d skipped\n"
- "********* Finished testing of %s *********\n",
- QTestResult::passCount(), QTestResult::failCount(),
- QTestResult::skipCount(), QTestResult::currentTestObjectName());
+ qsnprintf(buf, sizeof(buf),
+ "Totals: %d passed, %d failed, %d skipped\n"
+ "********* Finished testing of %s *********\n",
+ QTestResult::passCount(), QTestResult::failCount(),
+ QTestResult::skipCount(), QTestResult::currentTestObjectName());
}
outputMessage(buf);
diff --git a/src/testlib/qplaintestlogger_p.h b/src/testlib/qplaintestlogger_p.h
index 432e900320..dc0cec6dc4 100644
--- a/src/testlib/qplaintestlogger_p.h
+++ b/src/testlib/qplaintestlogger_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qsignaldumper.cpp b/src/testlib/qsignaldumper.cpp
index 18a505066f..ae8c353e6e 100644
--- a/src/testlib/qsignaldumper.cpp
+++ b/src/testlib/qsignaldumper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qsignaldumper_p.h b/src/testlib/qsignaldumper_p.h
index ddc42291f4..acf259733d 100644
--- a/src/testlib/qsignaldumper_p.h
+++ b/src/testlib/qsignaldumper_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qsignalspy.h b/src/testlib/qsignalspy.h
index 61ce12a3a4..61d65131f1 100644
--- a/src/testlib/qsignalspy.h
+++ b/src/testlib/qsignalspy.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -56,8 +56,6 @@ QT_MODULE(Test)
class QVariant;
-/* ### Qt5: change the class to use regular BC mechanisms, such that we can
- * implement things like suggested in task 160192. */
class QSignalSpy: public QObject, public QList<QList<QVariant> >
{
public:
diff --git a/src/testlib/qsignalspy.qdoc b/src/testlib/qsignalspy.qdoc
index fa7c48bc70..c63f315619 100644
--- a/src/testlib/qsignalspy.qdoc
+++ b/src/testlib/qsignalspy.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index 950b5d537b..da3a836636 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -194,19 +194,20 @@ inline bool qCompare(QStringList const &t1, QStringList const &t2,
char msg[1024];
msg[0] = '\0';
bool isOk = true;
- if (t1.count() != t2.count()) {
- qt_snprintf(msg, 1024, "Compared QStringLists have different sizes.\n"
- " Actual (%s) size : '%d'\n"
- " Expected (%s) size: '%d'", actual, t1.count(), expected, t2.count());
+ const int actualSize = t1.count();
+ const int expectedSize = t2.count();
+ if (actualSize != expectedSize) {
+ qsnprintf(msg, sizeof(msg), "Compared QStringLists have different sizes.\n"
+ " Actual (%s) size : '%d'\n"
+ " Expected (%s) size: '%d'", actual, actualSize, expected, expectedSize);
isOk = false;
}
- const int min = qMin(t1.count(), t2.count());
- for (int i = 0; isOk && i < min; ++i) {
+ for (int i = 0; isOk && i < actualSize; ++i) {
if (t1.at(i) != t2.at(i)) {
- qt_snprintf(msg, 1024, "Compared QStringLists differ at index %d.\n"
- " Actual (%s) : '%s'\n"
- " Expected (%s) : '%s'", i, actual, t1.at(i).toLatin1().constData(),
- expected, t2.at(i).toLatin1().constData());
+ qsnprintf(msg, sizeof(msg), "Compared QStringLists differ at index %d.\n"
+ " Actual (%s) : '%s'\n"
+ " Expected (%s) : '%s'", i, actual, t1.at(i).toLatin1().constData(),
+ expected, t2.at(i).toLatin1().constData());
isOk = false;
}
}
@@ -253,6 +254,7 @@ int main(int argc, char *argv[]) \
int main(int argc, char *argv[]) \
{ \
QApplication app(argc, argv); \
+ app.setAttribute(Qt::AA_Use96Dpi, true); \
QTEST_DISABLE_KEYPAD_NAVIGATION \
TestObject tc; \
return QTest::qExec(&tc, argc, argv); \
@@ -266,6 +268,7 @@ int main(int argc, char *argv[]) \
int main(int argc, char *argv[]) \
{ \
QGuiApplication app(argc, argv); \
+ app.setAttribute(Qt::AA_Use96Dpi, true); \
TestObject tc; \
return QTest::qExec(&tc, argc, argv); \
}
@@ -276,6 +279,7 @@ int main(int argc, char *argv[]) \
int main(int argc, char *argv[]) \
{ \
QCoreApplication app(argc, argv); \
+ app.setAttribute(Qt::AA_Use96Dpi, true); \
TestObject tc; \
return QTest::qExec(&tc, argc, argv); \
}
@@ -286,6 +290,7 @@ int main(int argc, char *argv[]) \
int main(int argc, char *argv[]) \
{ \
QCoreApplication app(argc, argv); \
+ app.setAttribute(Qt::AA_Use96Dpi, true); \
TestObject tc; \
return QTest::qExec(&tc, argc, argv); \
}
diff --git a/src/testlib/qtest_global.h b/src/testlib/qtest_global.h
index 730329a19c..ddd749e29d 100644
--- a/src/testlib/qtest_global.h
+++ b/src/testlib/qtest_global.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -60,7 +60,7 @@ QT_MODULE(Test)
# endif
#endif
-#if defined (Q_CC_SUN) || defined (Q_CC_XLC) || (defined (Q_CC_GNU) && (__GNUC__ - 0 < 3))
+#if defined (Q_CC_SUN) || defined (Q_CC_XLC)
# define QTEST_NO_SPECIALIZATIONS
#endif
@@ -78,8 +78,6 @@ QT_MODULE(Test)
namespace QTest
{
enum TestFailMode { Abort = 1, Continue = 2 };
-
- int Q_TESTLIB_EXPORT qt_snprintf(char *str, int size, const char *format, ...);
}
QT_END_NAMESPACE
diff --git a/src/testlib/qtest_gui.h b/src/testlib/qtest_gui.h
index 89f63e25c6..a5877f9d23 100644
--- a/src/testlib/qtest_gui.h
+++ b/src/testlib/qtest_gui.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -57,8 +57,12 @@
#include <QtTest/qtesttouch.h>
#include <QtTest/qtestkeyboard.h>
-#include <QtWidgets/qicon.h>
#include <QtGui/qpixmap.h>
+#include <QtGui/qimage.h>
+
+#ifdef QT_WIDGETS_LIB
+#include <QtWidgets/qicon.h>
+#endif
#if 0
// inform syncqt
@@ -85,30 +89,76 @@ inline bool qCompare(QIcon const &t1, QIcon const &t2, const char *actual, const
}
#endif
+#ifndef QTEST_NO_SPECIALIZATIONS
template<>
+#endif
+inline bool qCompare(QImage const &t1, QImage const &t2,
+ const char *actual, const char *expected, const char *file, int line)
+{
+ char msg[1024];
+ msg[0] = '\0';
+ const bool t1Null = t1.isNull();
+ const bool t2Null = t2.isNull();
+ if (t1Null != t2Null) {
+ qsnprintf(msg, 1024, "Compared QImages differ.\n"
+ " Actual (%s).isNull() : %d\n"
+ " Expected (%s).isNull(): %d", actual, t1Null, expected, t2Null);
+ return compare_helper(false, msg, file, line);
+ }
+ if (t1Null && t2Null)
+ return compare_helper(true, "COMPARE()", file, line);
+ if (t1.width() != t2.width() || t2.height() != t2.height()) {
+ qsnprintf(msg, 1024, "Compared QImages differ in size.\n"
+ " Actual (%s) : %dx%d\n"
+ " Expected (%s): %dx%d",
+ actual, t1.width(), t1.height(),
+ expected, t2.width(), t2.height());
+ return compare_helper(false, msg, file, line);
+ }
+ if (t1.format() != t2.format()) {
+ qsnprintf(msg, 1024, "Compared QImages differ in format.\n"
+ " Actual (%s) : %d\n"
+ " Expected (%s): %d",
+ actual, t1.format(), expected, t2.format());
+ return compare_helper(false, msg, file, line);
+ }
+ return (t1 == t2)
+ ? compare_helper(true, "COMPARE()", file, line)
+ : compare_helper(false, "Compared values are not the same",
+ toString(t1), toString(t2), actual, expected, file, line);
+}
+
+#ifndef QTEST_NO_SPECIALIZATIONS
+template<>
+#endif
inline bool qCompare(QPixmap const &t1, QPixmap const &t2, const char *actual, const char *expected,
const char *file, int line)
{
+ char msg[1024];
+ msg[0] = '\0';
+ const bool t1Null = t1.isNull();
+ const bool t2Null = t2.isNull();
+ if (t1Null != t2Null) {
+ qsnprintf(msg, 1024, "Compared QPixmaps differ.\n"
+ " Actual (%s).isNull() : %d\n"
+ " Expected (%s).isNull(): %d", actual, t1Null, expected, t2Null);
+ return compare_helper(false, msg, file, line);
+ }
+ if (t1Null && t2Null)
+ return compare_helper(true, "COMPARE()", file, line);
+ if (t1.width() != t2.width() || t2.height() != t2.height()) {
+ qsnprintf(msg, 1024, "Compared QPixmaps differ in size.\n"
+ " Actual (%s) : %dx%d\n"
+ " Expected (%s): %dx%d",
+ actual, t1.width(), t1.height(),
+ expected, t2.width(), t2.height());
+ return compare_helper(false, msg, file, line);
+ }
return qCompare(t1.toImage(), t2.toImage(), actual, expected, file, line);
}
}
-/* compatibility */
-
-inline static bool pixmapsAreEqual(const QPixmap *actual, const QPixmap *expected)
-{
- if (!actual && !expected)
- return true;
- if (!actual || !expected)
- return false;
- if (actual->isNull() && expected->isNull())
- return true;
- if (actual->isNull() || expected->isNull() || actual->size() != expected->size())
- return false;
- return actual->toImage() == expected->toImage();
-}
-
#ifdef Q_WS_X11
extern void qt_x11_wait_for_window_manager(QWidget *w);
#endif
diff --git a/src/testlib/qtestaccessible.h b/src/testlib/qtestaccessible.h
index 90ed8838b3..6bd3339a0f 100644
--- a/src/testlib/qtestaccessible.h
+++ b/src/testlib/qtestaccessible.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtestassert.h b/src/testlib/qtestassert.h
index 24edab278d..0dc24762ab 100644
--- a/src/testlib/qtestassert.h
+++ b/src/testlib/qtestassert.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index b37dbc0203..8bd836d7f9 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -148,9 +148,6 @@ QT_BEGIN_NAMESPACE
unspecified behavior from being introduced; that is behavior that usually
occurs when the compiler implicitly casts the argument.
- If you use QCOMPARE() to compare two QStringList objects, it will start
- comparing the objects from the end of the lists.
-
For your own classes, you can use \l QTest::toString() to format values for
outputting into the test log.
@@ -163,40 +160,61 @@ QT_BEGIN_NAMESPACE
\sa QVERIFY(), QTRY_COMPARE(), QTest::toString()
*/
-/*! \macro QTRY_VERIFY(condition)
+/*! \macro QTRY_VERIFY_WITH_TIMEOUT(condition, timeout)
\relates QTest
- The QTRY_VERIFY() macro is similar to QVERIFY(), but checks the \a condition
- repeatedly, until either the condition becomes true or a maximum timeout is
+ The QTRY_VERIFY_WITH_TIMEOUT() macro is similar to QVERIFY(), but checks the \a condition
+ repeatedly, until either the condition becomes true or the \a timeout is
reached. Between each evaluation, events will be processed. If the timeout
is reached, a failure is recorded in the test log and the test won't be
executed further.
- The timeout is fixed at five seconds.
+ \note This macro can only be used in a test function that is invoked
+ by the test framework.
+
+ \sa QTRY_VERIFY(), QVERIFY(), QCOMPARE(), QTRY_COMPARE()
+*/
+
+
+/*! \macro QTRY_VERIFY(condition)
+
+ \relates QTest
+
+ Invokes QTRY_VERIFY_WITH_TIMEOUT() with a timeout of five seconds.
\note This macro can only be used in a test function that is invoked
by the test framework.
- \sa QVERIFY(), QCOMPARE(), QTRY_COMPARE()
+ \sa QTRY_VERIFY_WITH_TIMEOUT(), QVERIFY(), QCOMPARE(), QTRY_COMPARE()
*/
-/*! \macro QTRY_COMPARE(actual, expected)
+/*! \macro QTRY_COMPARE_WITH_TIMEOUT(actual, expected, timeout)
\relates QTest
- The QTRY_COMPARE() macro is similar to QCOMPARE(), but performs the comparison
+ The QTRY_COMPARE_WITH_TIMEOUT() macro is similar to QCOMPARE(), but performs the comparison
of the \a actual and \a expected values repeatedly, until either the two values
- are equal or a maximum timeout is reached. Between each comparison, events
+ are equal or the \a timeout is reached. Between each comparison, events
will be processed. If the timeout is reached, a failure is recorded in the
test log and the test won't be executed further.
- The timeout is fixed at five seconds.
+ \note This macro can only be used in a test function that is invoked
+ by the test framework.
+
+ \sa QTRY_COMPARE(), QCOMPARE(), QVERIFY(), QTRY_VERIFY()
+*/
+
+/*! \macro QTRY_COMPARE(actual, expected)
+
+ \relates QTest
+
+ Invokes QTRY_COMPARE_WITH_TIMEOUT() with a timeout of five seconds.
\note This macro can only be used in a test function that is invoked
by the test framework.
- \sa QCOMPARE(), QVERIFY(), QTRY_VERIFY()
+ \sa QTRY_COMPARE_WITH_TIMEOUT(), QCOMPARE(), QVERIFY(), QTRY_VERIFY()
*/
/*! \macro QFETCH(type, name)
@@ -392,14 +410,19 @@ QT_BEGIN_NAMESPACE
the \a TestClass, and executes all tests in the order they were defined.
Use this macro to build stand-alone executables.
- If \c QT_GUI_LIB is defined, the application object will be a QApplication,
+ If \c QT_WIDGETS_LIB is defined, the application object will be a QApplication,
+ if \c QT_GUI_LIB is defined, the application object will be a QGuiApplication,
otherwise it will be a QCoreApplication. If qmake is used and the configuration
- includes \c{QT += gui}, then \c QT_GUI_LIB will be defined automatically.
+ includes \c{QT += widgets}, then \c QT_WIDGETS_LIB will be defined automatically.
+ Similarly, if qmake is used and the configuration includes \c{QT += gui}, then
+ \c QT_GUI_LIB will be defined automatically.
- \bold {Note:} On platforms that have keypad navigation enabled by default (eg: Symbian),
- this macro will forcfully disable it to simplify the usage of key events when writing
- autotests. If you wish to write a test case that uses keypad navigation, you should
- enable it either in the \c {initTestCase()} or \c {init()} functions of your test case.
+ \bold {Note:} On platforms that have keypad navigation enabled by default,
+ this macro will forcefully disable it if \c QT_WIDGETS_LIB is defined. This is done
+ to simplify the usage of key events when writing autotests. If you wish to write a
+ test case that uses keypad navigation, you should enable it either in the
+ \c {initTestCase()} or \c {init()} functions of your test case by calling
+ \l {QApplication::setNavigationMode()}.
Example:
\snippet doc/src/snippets/code/src_qtestlib_qtestcase.cpp 11
@@ -512,7 +535,8 @@ QT_BEGIN_NAMESPACE
\overload
Simulates clicking of \a key with an optional \a modifier on a \a widget.
- If \a delay is larger than 0, the test will wait for \a delay milliseconds.
+ If \a delay is larger than 0, the test will wait for \a delay milliseconds
+ before clicking the key.
Example:
\snippet doc/src/snippets/code/src_qtestlib_qtestcase.cpp 13
@@ -526,7 +550,8 @@ QT_BEGIN_NAMESPACE
/*! \fn void QTest::keyClick(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
Simulates clicking of \a key with an optional \a modifier on a \a widget.
- If \a delay is larger than 0, the test will wait for \a delay milliseconds.
+ If \a delay is larger than 0, the test will wait for \a delay milliseconds
+ before clicking the key.
Examples:
\snippet doc/src/snippets/code/src_qtestlib_qtestcase.cpp 14
@@ -534,7 +559,7 @@ QT_BEGIN_NAMESPACE
The first example above simulates clicking the \c escape key on \c
myWidget without any keyboard modifiers and without delay. The
second example simulates clicking \c shift-escape on \c myWidget
- with a following 200 ms delay of the test.
+ following a 200 ms delay of the test.
\sa QTest::keyClicks()
*/
@@ -559,7 +584,7 @@ QT_BEGIN_NAMESPACE
/*! \fn void QTest::keyPress(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
Simulates pressing a \a key with an optional \a modifier on a \a widget. If \a delay
- is larger than 0, the test will wait for \a delay milliseconds.
+ is larger than 0, the test will wait for \a delay milliseconds before pressing the key.
\bold {Note:} At some point you should release the key using \l keyRelease().
@@ -571,7 +596,8 @@ QT_BEGIN_NAMESPACE
\overload
Simulates pressing a \a key with an optional \a modifier on a \a widget.
- If \a delay is larger than 0, the test will wait for \a delay milliseconds.
+ If \a delay is larger than 0, the test will wait for \a delay milliseconds
+ before pressing the key.
\bold {Note:} At some point you should release the key using \l keyRelease().
@@ -581,7 +607,8 @@ QT_BEGIN_NAMESPACE
/*! \fn void QTest::keyRelease(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
Simulates releasing a \a key with an optional \a modifier on a \a widget.
- If \a delay is larger than 0, the test will wait for \a delay milliseconds.
+ If \a delay is larger than 0, the test will wait for \a delay milliseconds
+ before releasing the key.
\sa QTest::keyPress(), QTest::keyClick()
*/
@@ -591,7 +618,8 @@ QT_BEGIN_NAMESPACE
\overload
Simulates releasing a \a key with an optional \a modifier on a \a widget.
- If \a delay is larger than 0, the test will wait for \a delay milliseconds.
+ If \a delay is larger than 0, the test will wait for \a delay milliseconds
+ before releasing the key.
\sa QTest::keyClick()
*/
@@ -975,38 +1003,10 @@ namespace QTest
static int keyDelay = -1;
static int mouseDelay = -1;
static int eventDelay = -1;
- static int keyVerbose = -1;
#if defined(Q_OS_UNIX)
static bool noCrashHandler = false;
#endif
-void filter_unprintable(char *str)
-{
- char *idx = str;
- while (*idx) {
- if (((*idx < 0x20 && *idx != '\n' && *idx != '\t') || *idx > 0x7e))
- *idx = '?';
- ++idx;
- }
-}
-
-/*! \internal
- */
-int qt_snprintf(char *str, int size, const char *format, ...)
-{
- va_list ap;
- int res = 0;
-
- va_start(ap, format);
- qvsnprintf(str, size, format, ap);
- va_end(ap);
- str[size - 1] = '\0';
-
- filter_unprintable(str);
-
- return res;
-}
-
/*! \internal
Invoke a method of the object without generating warning if the method does not exist
*/
@@ -1020,14 +1020,6 @@ static void invokeMethod(QObject *obj, const char *methodName)
}
}
-bool Q_TESTLIB_EXPORT defaultKeyVerbose()
-{
- if (keyVerbose == -1) {
- keyVerbose = qgetenv("QTEST_KEYEVENT_VERBOSE").isEmpty() ? 0 : 1;
- }
- return keyVerbose == 1;
-}
-
int defaultEventDelay()
{
if (eventDelay == -1) {
@@ -1118,7 +1110,7 @@ static void qPrintDataTags(FILE *stream)
slot[strlen(slot) - 2] = '\0';
QByteArray member;
member.resize(qstrlen(slot) + qstrlen("_data()") + 1);
- QTest::qt_snprintf(member.data(), member.size(), "%s_data()", slot);
+ qsnprintf(member.data(), member.size(), "%s_data()", slot);
invokeMethod(QTest::currentTestObject, member.constData());
for (int j = 0; j < table.dataCount(); ++j)
localTags << QLatin1String(table.testData(j)->dataTag());
@@ -1209,7 +1201,6 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
" -eventdelay ms : Set default delay for mouse and keyboard simulation to ms milliseconds\n"
" -keydelay ms : Set default delay for keyboard simulation to ms milliseconds\n"
" -mousedelay ms : Set default delay for mouse simulation to ms milliseconds\n"
- " -keyevent-verbose : Turn on verbose messages for keyboard simulation\n"
" -maxwarnings n : Sets the maximum amount of messages to output.\n"
" 0 means unlimited, default: 2000\n"
#if defined(Q_OS_UNIX)
@@ -1343,8 +1334,6 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
} else if (strcmp(argv[i], "-nocrashhandler") == 0) {
QTest::noCrashHandler = true;
#endif
- } else if (strcmp(argv[i], "-keyevent-verbose") == 0) {
- QTest::keyVerbose = 1;
#ifdef QTESTLIB_USE_VALGRIND
} else if (strcmp(argv[i], "-callgrind") == 0) {
if (QBenchmarkValgrindUtils::haveValgrind())
@@ -1448,8 +1437,8 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
if (colon != -1) {
data = qstrdup(argv[i]+colon+1);
}
- QTest::qt_snprintf(buf, qMin(512, off + 1), "%s", argv[i]); // copy text before the ':' into buf
- QTest::qt_snprintf(buf + off, qMin(512 - off, 3), "()"); // append "()"
+ qsnprintf(buf, qMin(512, off + 1), "%s", argv[i]); // copy text before the ':' into buf
+ qsnprintf(buf + off, qMin(512 - off, 3), "()"); // append "()"
int idx = QTest::currentTestObject->metaObject()->indexOfMethod(buf);
if (idx < 0 || !isValidSlot(QTest::currentTestObject->metaObject()->method(idx))) {
fprintf(stderr, "Unknown testfunction: '%s'\n", buf);
@@ -1552,9 +1541,13 @@ static void qInvokeTestMethodDataEntry(char *slot)
if (QBenchmarkTestMethodData::current->isBenchmark() &&
QBenchmarkGlobalData::current->verboseOutput) {
if (i == -1) {
- qDebug() << "warmup stage result :" << QBenchmarkTestMethodData::current->result.value;
+ QTestLog::info(qPrintable(
+ QString::fromLatin1("warmup stage result : %1")
+ .arg(QBenchmarkTestMethodData::current->result.value)), 0, 0);
} else {
- qDebug() << "accumulation stage result:" << QBenchmarkTestMethodData::current->result.value;
+ QTestLog::info(qPrintable(
+ QString::fromLatin1("accumulation stage result: %1")
+ .arg(QBenchmarkTestMethodData::current->result.value)), 0, 0);
}
}
} while (QBenchmarkTestMethodData::current->isBenchmark()
@@ -1601,7 +1594,7 @@ static bool qInvokeTestMethod(const char *slotName, const char *data=0)
if (curGlobalDataIndex == 0) {
QTestResult::setCurrentTestLocation(QTestResult::DataFunc);
- QTest::qt_snprintf(member, 512, "%s_data()", slot);
+ qsnprintf(member, 512, "%s_data()", slot);
invokeMethod(QTest::currentTestObject, member);
}
@@ -1927,6 +1920,10 @@ FatalSignalHandler::~FatalSignalHandler()
test that was executed with qExec() can't run another test via qExec() and
threads are not allowed to call qExec() simultaneously.
+ If you have programatically created the arguments, as opposed to getting them
+ from the arguments in \c main(), it is likely of interest to use
+ QTest::qExec(QObject *, const QStringList &) since it is Unicode safe.
+
\sa QTEST_MAIN()
*/
@@ -2019,6 +2016,9 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
#endif
currentTestObject = 0;
+
+ QSignalDumper::endDump();
+
#ifdef Q_WS_MAC
if (macNeedsActivate) {
IOPMAssertionRelease(powerID);
@@ -2036,6 +2036,30 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
return qMin(QTestResult::failCount(), 127);
}
+/*!
+ \overload
+ \since 4.4
+
+ Behaves identically to qExec(QObject *, int, char**) but takes a
+ QStringList of \a arguments instead of a \c char** list.
+ */
+int QTest::qExec(QObject *testObject, const QStringList &arguments)
+{
+ const int argc = arguments.count();
+ QVarLengthArray<char *> argv(argc);
+
+ QVector<QByteArray> args;
+ args.reserve(argc);
+
+ for (int i = 0; i < argc; ++i)
+ {
+ args.append(arguments.at(i).toLocal8Bit().constData());
+ argv[i] = args.last().data();
+ }
+
+ return qExec(testObject, argc, argv.data());
+}
+
/*! \internal
*/
void QTest::qFail(const char *statementStr, const char *file, int line)
@@ -2099,6 +2123,15 @@ void QTest::ignoreMessage(QtMsgType type, const char *message)
/*! \internal
*/
+
+#ifdef Q_OS_WIN
+static inline bool isWindowsBuildDirectory(const QString &dirName)
+{
+ return dirName.compare(QStringLiteral("Debug"), Qt::CaseInsensitive) == 0
+ || dirName.compare(QStringLiteral("Release"), Qt::CaseInsensitive) == 0;
+}
+#endif
+
QString QTest::qFindTestData(const QString& base, const char *file, int line, const char *builddir)
{
QString found;
@@ -2107,16 +2140,23 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co
// 1. relative to test binary.
if (qApp) {
- QString binpath = QCoreApplication::applicationDirPath();
- QString candidate = QString::fromLatin1("%1/%2").arg(binpath).arg(base);
- if (QFileInfo(candidate).exists()) {
- found = candidate;
+ QDir binDirectory(QCoreApplication::applicationDirPath());
+ if (binDirectory.exists(base)) {
+ found = binDirectory.absoluteFilePath(base);
}
+#ifdef Q_OS_WIN
+ // Windows: The executable is typically located in one of the
+ // 'Release' or 'Debug' directories.
+ else if (isWindowsBuildDirectory(binDirectory.dirName())
+ && binDirectory.cdUp() && binDirectory.exists(base)) {
+ found = binDirectory.absoluteFilePath(base);
+ }
+#endif // Q_OS_WIN
else if (QTestLog::verboseLevel() >= 2) {
+ const QString candidate = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + QLatin1Char('/') + base);
QTestLog::info(qPrintable(
QString::fromLatin1("testdata %1 not found relative to test binary [%2]; "
- "checking next location")
- .arg(base).arg(candidate)),
+ "checking next location").arg(base, candidate)),
file, line);
}
}
@@ -2127,9 +2167,7 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co
if (testObjectName) {
QString testsPath = QLibraryInfo::location(QLibraryInfo::TestsPath);
QString candidate = QString::fromLatin1("%1/%2/%3")
- .arg(testsPath)
- .arg(QFile::decodeName(testObjectName).toLower())
- .arg(base);
+ .arg(testsPath, QFile::decodeName(testObjectName).toLower(), base);
if (QFileInfo(candidate).exists()) {
found = candidate;
}
@@ -2137,7 +2175,7 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co
QTestLog::info(qPrintable(
QString::fromLatin1("testdata %1 not found in tests install path [%2]; "
"checking next location")
- .arg(base).arg(candidate)),
+ .arg(base, QDir::toNativeSeparators(candidate))),
file, line);
}
}
@@ -2154,14 +2192,14 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co
srcdir.setFile(QFile::decodeName(builddir) + QLatin1String("/") + srcdir.filePath());
}
- QString candidate = QString::fromLatin1("%1/%2").arg(srcdir.canonicalFilePath()).arg(base);
+ QString candidate = QString::fromLatin1("%1/%2").arg(srcdir.canonicalFilePath(), base);
if (QFileInfo(candidate).exists()) {
found = candidate;
}
else if (QTestLog::verboseLevel() >= 2) {
QTestLog::info(qPrintable(
QString::fromLatin1("testdata %1 not found relative to source path [%2]")
- .arg(base).arg(candidate)),
+ .arg(base, QDir::toNativeSeparators(candidate))),
file, line);
}
}
@@ -2173,7 +2211,7 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co
}
else if (QTestLog::verboseLevel() >= 1) {
QTestLog::info(qPrintable(
- QString::fromLatin1("testdata %1 was located at %2").arg(base).arg(found)),
+ QString::fromLatin1("testdata %1 was located at %2").arg(base, QDir::toNativeSeparators(found))),
file, line);
}
@@ -2247,7 +2285,7 @@ QTestData &QTest::newRow(const char *dataTag)
{
QTEST_ASSERT_X(dataTag, "QTest::newRow()", "Data tag can not be null");
QTestTable *tbl = QTestTable::currentTestTable();
- QTEST_ASSERT_X(tbl, "QTest::addColumn()", "Cannot add testdata outside of a _data slot.");
+ QTEST_ASSERT_X(tbl, "QTest::newRow()", "Cannot add testdata outside of a _data slot.");
return *tbl->newData(dataTag);
}
@@ -2386,7 +2424,7 @@ Q_TESTLIB_EXPORT bool QTest::qCompare<double>(double const &t1, double const &t2
template <> Q_TESTLIB_EXPORT char *QTest::toString<TYPE >(const TYPE &t) \
{ \
char *msg = new char[128]; \
- qt_snprintf(msg, 128, #FORMAT, t); \
+ qsnprintf(msg, 128, #FORMAT, t); \
return msg; \
}
@@ -2423,7 +2461,7 @@ char *QTest::toString(const char *str)
char *QTest::toString(const void *p)
{
char *msg = new char[128];
- qt_snprintf(msg, 128, "%p", p);
+ qsnprintf(msg, 128, "%p", p);
return msg;
}
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h
index 091e9a8d96..4537e76920 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -86,33 +86,37 @@ do {\
} while (0)
// Will try to wait for the expression to become true while allowing event processing
-#define QTRY_VERIFY(__expr) \
+#define QTRY_VERIFY_WITH_TIMEOUT(__expr, __timeout) \
do { \
const int __step = 50; \
- const int __timeout = 5000; \
+ const int __timeoutValue = __timeout; \
if (!(__expr)) { \
QTest::qWait(0); \
} \
- for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \
+ for (int __i = 0; __i < __timeoutValue && !(__expr); __i+=__step) { \
QTest::qWait(__step); \
} \
QVERIFY(__expr); \
} while (0)
+#define QTRY_VERIFY(__expr) QTRY_VERIFY_WITH_TIMEOUT(__expr, 5000)
+
// Will try to wait for the comparison to become successful while allowing event processing
-#define QTRY_COMPARE(__expr, __expected) \
+
+#define QTRY_COMPARE_WITH_TIMEOUT(__expr, __expected, __timeout) \
do { \
const int __step = 50; \
- const int __timeout = 5000; \
+ const int __timeoutValue = __timeout; \
if ((__expr) != (__expected)) { \
QTest::qWait(0); \
} \
- for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \
+ for (int __i = 0; __i < __timeoutValue && ((__expr) != (__expected)); __i+=__step) { \
QTest::qWait(__step); \
} \
QCOMPARE(__expr, __expected); \
} while (0)
+#define QTRY_COMPARE(__expr, __expected) QTRY_COMPARE_WITH_TIMEOUT(__expr, __expected, 5000)
#ifdef Q_CC_MSVC
#define QSKIP(statement) \
@@ -180,6 +184,7 @@ namespace QTest
Q_TESTLIB_EXPORT char *toString(const void *);
Q_TESTLIB_EXPORT int qExec(QObject *testObject, int argc = 0, char **argv = 0);
+ Q_TESTLIB_EXPORT int qExec(QObject *testObject, const QStringList &arguments);
Q_TESTLIB_EXPORT bool qVerify(bool statement, const char *statementStr, const char *description,
const char *file, int line);
@@ -208,7 +213,7 @@ namespace QTest
Q_TESTLIB_EXPORT bool compare_helper(bool success, const char *msg, const char *file,
int line);
Q_TESTLIB_EXPORT bool compare_helper(bool success, const char *msg, char *val1, char *val2,
- const char *expected, const char *actual,
+ const char *actual, const char *expected,
const char *file, int line);
Q_TESTLIB_EXPORT void qSleep(int ms);
Q_TESTLIB_EXPORT void addColumnInternal(int id, const char *name);
diff --git a/src/testlib/qtestcoreelement_p.h b/src/testlib/qtestcoreelement_p.h
index 17e6ede4b6..3eb50f20d4 100644
--- a/src/testlib/qtestcoreelement_p.h
+++ b/src/testlib/qtestcoreelement_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtestcorelist_p.h b/src/testlib/qtestcorelist_p.h
index 263df17172..2571f75af4 100644
--- a/src/testlib/qtestcorelist_p.h
+++ b/src/testlib/qtestcorelist_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtestdata.cpp b/src/testlib/qtestdata.cpp
index 6ee0063738..1a246591c7 100644
--- a/src/testlib/qtestdata.cpp
+++ b/src/testlib/qtestdata.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtestdata.h b/src/testlib/qtestdata.h
index 02ee03ff7d..90b1395bf5 100644
--- a/src/testlib/qtestdata.h
+++ b/src/testlib/qtestdata.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtestelement.cpp b/src/testlib/qtestelement.cpp
index d0af966e8c..cad7b28da6 100644
--- a/src/testlib/qtestelement.cpp
+++ b/src/testlib/qtestelement.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtestelement_p.h b/src/testlib/qtestelement_p.h
index 583ef1cfea..22bcddaf87 100644
--- a/src/testlib/qtestelement_p.h
+++ b/src/testlib/qtestelement_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtestelementattribute.cpp b/src/testlib/qtestelementattribute.cpp
index 1ab25af25b..c3e62cc654 100644
--- a/src/testlib/qtestelementattribute.cpp
+++ b/src/testlib/qtestelementattribute.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtestelementattribute_p.h b/src/testlib/qtestelementattribute_p.h
index 9993321e81..04f06f20e3 100644
--- a/src/testlib/qtestelementattribute_p.h
+++ b/src/testlib/qtestelementattribute_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtestevent.h b/src/testlib/qtestevent.h
index c7af5b28d7..ac23bb69cd 100644
--- a/src/testlib/qtestevent.h
+++ b/src/testlib/qtestevent.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtestevent.qdoc b/src/testlib/qtestevent.qdoc
index 356f10367d..405f64abcc 100644
--- a/src/testlib/qtestevent.qdoc
+++ b/src/testlib/qtestevent.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtesteventloop.h b/src/testlib/qtesteventloop.h
index cb7c078136..205aba9fc7 100644
--- a/src/testlib/qtesteventloop.h
+++ b/src/testlib/qtesteventloop.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtestkeyboard.h b/src/testlib/qtestkeyboard.h
index deb572b8fd..71defcfbdc 100644
--- a/src/testlib/qtestkeyboard.h
+++ b/src/testlib/qtestkeyboard.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -53,11 +53,16 @@
#include <QtTest/qtestspontaneevent.h>
#include <QtCore/qpointer.h>
-#include <QtWidgets/qapplication.h>
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qwindow.h>
#include <QtGui/qevent.h>
-#include <QtWidgets/qwidget.h>
#include <QtGui/qwindowsysteminterface_qpa.h>
+#ifdef QT_WIDGETS_LIB
+#include <QtWidgets/qwidget.h>
+#include <QtWidgets/qapplication.h>
+#endif
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index 0951b9b309..695c001e0f 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -291,7 +291,7 @@ void QTestLog::printUnhandledIgnoreMessages()
char msg[1024];
QTest::IgnoreResultList *list = QTest::ignoreResultList;
while (list) {
- QTest::qt_snprintf(msg, 1024, "Did not receive message: \"%s\"", list->msg);
+ qsnprintf(msg, 1024, "Did not receive message: \"%s\"", list->msg);
QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, msg);
list = list->next;
@@ -419,7 +419,7 @@ int QTestLog::verboseLevel()
return QTest::verbosity;
}
-void QTestLog::addIgnoreMessage(QtMsgType type, const char *msg)
+void QTestLog::ignoreMessage(QtMsgType type, const char *msg)
{
QTEST_ASSERT(msg);
diff --git a/src/testlib/qtestlog_p.h b/src/testlib/qtestlog_p.h
index b2aa8c1890..02bb54815c 100644
--- a/src/testlib/qtestlog_p.h
+++ b/src/testlib/qtestlog_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -73,7 +73,8 @@ public:
static void addXPass(const char *msg, const char *file, int line);
static void addSkip(const char *msg, const char *file, int line);
static void addBenchmarkResult(const QBenchmarkResult &result);
- static void addIgnoreMessage(QtMsgType type, const char *msg);
+
+ static void ignoreMessage(QtMsgType type, const char *msg);
static int unhandledIgnoreMessages();
static void printUnhandledIgnoreMessages();
diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h
index cc6b3de9a9..6c68b057c1 100644
--- a/src/testlib/qtestmouse.h
+++ b/src/testlib/qtestmouse.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -53,11 +53,14 @@
#include <QtTest/qtestspontaneevent.h>
#include <QtCore/qpoint.h>
#include <QtCore/qstring.h>
-#include <QtWidgets/qapplication.h>
#include <QtGui/qevent.h>
-#include <QtWidgets/qwidget.h>
#include <QtGui/qwindowsysteminterface_qpa.h>
+#ifdef QT_WIDGETS_LIB
+#include <QtWidgets/qapplication.h>
+#include <QtWidgets/qwidget.h>
+#endif
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
diff --git a/src/testlib/qtestresult.cpp b/src/testlib/qtestresult.cpp
index 35a3f042ad..9fc3c67ca5 100644
--- a/src/testlib/qtestresult.cpp
+++ b/src/testlib/qtestresult.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -88,11 +88,6 @@ void QTestResult::reset()
QTest::expectFailMode = 0;
}
-bool QTestResult::allDataPassed()
-{
- return !QTest::failed;
-}
-
bool QTestResult::currentTestFailed()
{
return QTest::dataFailed;
@@ -239,11 +234,11 @@ bool QTestResult::verify(bool statement, const char *statementStr,
char msg[1024];
if (QTestLog::verboseLevel() >= 2) {
- QTest::qt_snprintf(msg, 1024, "QVERIFY(%s)", statementStr);
+ qsnprintf(msg, 1024, "QVERIFY(%s)", statementStr);
QTestLog::info(msg, file, line);
}
- QTest::qt_snprintf(msg, 1024, "'%s' returned FALSE. (%s)", statementStr, description);
+ qsnprintf(msg, 1024, "'%s' returned FALSE. (%s)", statementStr, description);
return checkStatement(statement, msg, file, line);
}
@@ -267,9 +262,9 @@ bool QTestResult::compare(bool success, const char *msg, char *val1, char *val2,
return compare(success, msg, file, line);
char buf[1024];
- QTest::qt_snprintf(buf, 1024, "%s\n Actual (%s): %s\n Expected (%s): %s", msg,
- actual, val1 ? val1 : "<null>",
- expected, val2 ? val2 : "<null>");
+ qsnprintf(buf, 1024, "%s\n Actual (%s): %s\n Expected (%s): %s", msg,
+ actual, val1 ? val1 : "<null>",
+ expected, val2 ? val2 : "<null>");
delete [] val1;
delete [] val2;
return compare(success, buf, file, line);
@@ -330,7 +325,7 @@ int QTestResult::skipCount()
void QTestResult::ignoreMessage(QtMsgType type, const char *msg)
{
- QTestLog::addIgnoreMessage(type, msg);
+ QTestLog::ignoreMessage(type, msg);
}
bool QTestResult::testFailed()
diff --git a/src/testlib/qtestresult_p.h b/src/testlib/qtestresult_p.h
index 1ce81854b5..134d0637b6 100644
--- a/src/testlib/qtestresult_p.h
+++ b/src/testlib/qtestresult_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -67,7 +67,6 @@ public:
static const char *currentTestObjectName();
static bool currentTestFailed();
- static bool allDataPassed();
static QTestData *currentTestData();
static QTestData *currentGlobalTestData();
static const char *currentTestFunction();
diff --git a/src/testlib/qtestspontaneevent.h b/src/testlib/qtestspontaneevent.h
index bf5a74ca4b..20e396bda6 100644
--- a/src/testlib/qtestspontaneevent.h
+++ b/src/testlib/qtestspontaneevent.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h
index 6a87fe3460..ff621cdb6f 100644
--- a/src/testlib/qtestsystem.h
+++ b/src/testlib/qtestsystem.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtesttable.cpp b/src/testlib/qtesttable.cpp
index 0c76076b88..203a74618d 100644
--- a/src/testlib/qtesttable.cpp
+++ b/src/testlib/qtesttable.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -73,8 +73,8 @@ public:
ElementList *list;
DataList *dataList;
- void append(int elemType, const char *elemName);
- void append(QTestData *data);
+ void addColumn(int elemType, const char *elemName);
+ void addRow(QTestData *data);
ElementList *elementAt(int index);
QTestData *dataAt(int index);
@@ -124,7 +124,7 @@ QTestTablePrivate::~QTestTablePrivate()
}
}
-void QTestTablePrivate::append(int elemType, const char *elemName)
+void QTestTablePrivate::addColumn(int elemType, const char *elemName)
{
ElementList *item = new ElementList;
item->elementName = elemName;
@@ -139,7 +139,7 @@ void QTestTablePrivate::append(int elemType, const char *elemName)
last->next = item;
}
-void QTestTablePrivate::append(QTestData *data)
+void QTestTablePrivate::addRow(QTestData *data)
{
DataList *item = new DataList;
item->data = data;
@@ -158,7 +158,7 @@ void QTestTable::addColumn(int type, const char *name)
QTEST_ASSERT(type);
QTEST_ASSERT(name);
- d->append(type, name);
+ d->addColumn(type, name);
}
int QTestTable::elementCount() const
@@ -192,7 +192,7 @@ bool QTestTable::isEmpty() const
QTestData *QTestTable::newData(const char *tag)
{
QTestData *dt = new QTestData(tag, this);
- d->append(dt);
+ d->addRow(dt);
return dt;
}
diff --git a/src/testlib/qtesttable_p.h b/src/testlib/qtesttable_p.h
index ed435865a9..46ee4a99d9 100644
--- a/src/testlib/qtesttable_p.h
+++ b/src/testlib/qtesttable_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtesttouch.h b/src/testlib/qtesttouch.h
index 6a9909b617..499db58b4d 100644
--- a/src/testlib/qtesttouch.h
+++ b/src/testlib/qtesttouch.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -54,7 +54,9 @@
#include <QtGui/QWindowSystemInterface>
#include <QtCore/qmap.h>
#include <QtGui/qevent.h>
+#ifdef QT_WIDGETS_LIB
#include <QtWidgets/qwidget.h>
+#endif
QT_BEGIN_HEADER
@@ -62,13 +64,6 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Test)
-#ifdef QT_WIDGETS_LIB
-extern Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window,
- QTouchDevice *device,
- const QList<QTouchEvent::TouchPoint> &touchPoints,
- ulong timestamp);
-#endif
-
namespace QTest
{
@@ -136,20 +131,44 @@ namespace QTest
if (!points.isEmpty()) {
if (targetWindow)
{
- QWindowSystemInterface::handleTouchEvent(targetWindow,QEvent::None, device, touchPointList(points.values()));
- QTest::qWait(10);
+ QWindowSystemInterface::handleTouchEvent(targetWindow, device, touchPointList(points.values()));
}
#ifdef QT_WIDGETS_LIB
else if (targetWidget)
{
- qt_translateRawTouchEvent(targetWidget, device, points.values(), 0);
+ QWindowSystemInterface::handleTouchEvent(targetWidget->windowHandle(), device, touchPointList(points.values()));
}
#endif
}
+ QCoreApplication::processEvents();
previousPoints = points;
points.clear();
}
+ static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& pt)
+ {
+ QWindowSystemInterface::TouchPoint p;
+ p.id = pt.id();
+ p.flags = pt.flags();
+ p.normalPosition = pt.normalizedPos();
+ p.area = pt.screenRect();
+ p.pressure = pt.pressure();
+ p.state = pt.state();
+ p.velocity = pt.velocity();
+ p.rawPositions = pt.rawScreenPositions();
+ return p;
+ }
+ static QList<struct QWindowSystemInterface::TouchPoint> touchPointList(const QList<QTouchEvent::TouchPoint>& pointList)
+ {
+ QList<struct QWindowSystemInterface::TouchPoint> newList;
+
+ Q_FOREACH (QTouchEvent::TouchPoint p, pointList)
+ {
+ newList.append(touchPoint(p));
+ }
+ return newList;
+ }
+
private:
#ifdef QT_WIDGETS_LIB
QTouchEventSequence(QWidget *widget, QTouchDevice *aDevice)
@@ -198,27 +217,6 @@ namespace QTest
return window->mapToGlobal(pt);
return targetWindow ? targetWindow->mapToGlobal(pt) : pt;
}
- QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& pt)
- {
- QWindowSystemInterface::TouchPoint p;
- p.id = pt.id();
- p.isPrimary = pt.isPrimary();
- p.normalPosition = pt.screenRect().topLeft();
- p.area = pt.screenRect();
- p.pressure = pt.pressure();
- p.state = pt.state();
- return p;
- }
- QList<struct QWindowSystemInterface::TouchPoint> touchPointList(const QList<QTouchEvent::TouchPoint>& pointList)
- {
- QList<struct QWindowSystemInterface::TouchPoint> newList;
-
- Q_FOREACH (QTouchEvent::TouchPoint p, pointList)
- {
- newList.append(touchPoint(p));
- }
- return newList;
- }
QMap<int, QTouchEvent::TouchPoint> previousPoints;
QMap<int, QTouchEvent::TouchPoint> points;
diff --git a/src/testlib/qtestxunitstreamer.cpp b/src/testlib/qtestxunitstreamer.cpp
index 2c0b074cd8..607167ccce 100644
--- a/src/testlib/qtestxunitstreamer.cpp
+++ b/src/testlib/qtestxunitstreamer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qtestxunitstreamer_p.h b/src/testlib/qtestxunitstreamer_p.h
index 825890258a..c43d399acc 100644
--- a/src/testlib/qtestxunitstreamer_p.h
+++ b/src/testlib/qtestxunitstreamer_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qxmltestlogger.cpp b/src/testlib/qxmltestlogger.cpp
index fd18d1de30..b06f4736e7 100644
--- a/src/testlib/qxmltestlogger.cpp
+++ b/src/testlib/qxmltestlogger.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -251,7 +251,7 @@ void QXmlTestLogger::addBenchmarkResult(const QBenchmarkResult &result)
QTest::benchmarkResultFormatString(),
quotedMetric.constData(),
quotedTag.constData(),
- QByteArray::number(result.value).constData(), //no 64-bit qt_snprintf support
+ QByteArray::number(result.value).constData(), //no 64-bit qsnprintf support
result.iterations);
outputString(buf.constData());
}
diff --git a/src/testlib/qxmltestlogger_p.h b/src/testlib/qxmltestlogger_p.h
index c273493c48..0adb857633 100644
--- a/src/testlib/qxmltestlogger_p.h
+++ b/src/testlib/qxmltestlogger_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/testlib/qxunittestlogger.cpp b/src/testlib/qxunittestlogger.cpp
index 97a02eaff2..892cce855e 100644
--- a/src/testlib/qxunittestlogger.cpp
+++ b/src/testlib/qxunittestlogger.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -86,13 +86,13 @@ void QXunitTestLogger::stopLogging()
currentLogElement = new QTestElement(QTest::LET_TestSuite);
currentLogElement->addAttribute(QTest::AI_Name, QTestResult::currentTestObjectName());
- QTest::qt_snprintf(buf, sizeof(buf), "%i", testCounter);
+ qsnprintf(buf, sizeof(buf), "%i", testCounter);
currentLogElement->addAttribute(QTest::AI_Tests, buf);
- QTest::qt_snprintf(buf, sizeof(buf), "%i", failureCounter);
+ qsnprintf(buf, sizeof(buf), "%i", failureCounter);
currentLogElement->addAttribute(QTest::AI_Failures, buf);
- QTest::qt_snprintf(buf, sizeof(buf), "%i", errorCounter);
+ qsnprintf(buf, sizeof(buf), "%i", errorCounter);
currentLogElement->addAttribute(QTest::AI_Errors, buf);
QTestElement *property;
@@ -173,7 +173,7 @@ void QXunitTestLogger::addIncident(IncidentTypes type, const char *description,
failureElement->addAttribute(QTest::AI_File, file);
else
failureElement->addAttribute(QTest::AI_File, "");
- QTest::qt_snprintf(buf, sizeof(buf), "%i", line);
+ qsnprintf(buf, sizeof(buf), "%i", line);
failureElement->addAttribute(QTest::AI_Line, buf);
failureElement->addAttribute(QTest::AI_Description, description);
addTag(failureElement);
@@ -212,7 +212,7 @@ void QXunitTestLogger::addIncident(IncidentTypes type, const char *description,
else
currentLogElement->addAttribute(QTest::AI_File, "");
- QTest::qt_snprintf(buf, sizeof(buf), "%i", line);
+ qsnprintf(buf, sizeof(buf), "%i", line);
currentLogElement->addAttribute(QTest::AI_Line, buf);
/*
@@ -235,7 +235,7 @@ void QXunitTestLogger::addBenchmarkResult(const QBenchmarkResult &result)
benchmarkElement->addAttribute(QTest::AI_Value, QByteArray::number(result.value).constData());
char buf[100];
- QTest::qt_snprintf(buf, sizeof(buf), "%i", result.iterations);
+ qsnprintf(buf, sizeof(buf), "%i", result.iterations);
benchmarkElement->addAttribute(QTest::AI_Iterations, buf);
currentLogElement->addLogElement(benchmarkElement);
}
@@ -303,7 +303,7 @@ void QXunitTestLogger::addMessage(MessageTypes type, const char *message, const
errorElement->addAttribute(QTest::AI_File, "");
char buf[100];
- QTest::qt_snprintf(buf, sizeof(buf), "%i", line);
+ qsnprintf(buf, sizeof(buf), "%i", line);
errorElement->addAttribute(QTest::AI_Line, buf);
currentLogElement->addLogElement(errorElement);
diff --git a/src/testlib/qxunittestlogger_p.h b/src/testlib/qxunittestlogger_p.h
index ea3aaf4d92..0778fa4843 100644
--- a/src/testlib/qxunittestlogger_p.h
+++ b/src/testlib/qxunittestlogger_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/bootstrap/bootstrap.pri b/src/tools/bootstrap/bootstrap.pri
index 50c1af1775..83fcee18d6 100644
--- a/src/tools/bootstrap/bootstrap.pri
+++ b/src/tools/bootstrap/bootstrap.pri
@@ -19,7 +19,6 @@ DEFINES += \
QT_NO_QOBJECT \
QT_NO_STL \
QT_NO_SYSTEMLOCALE \
- QT_NO_TEXTSTREAM \
QT_NO_THREAD \
QT_NO_UNICODETABLES \
QT_NO_USING_NAMESPACE \
diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
index fdebd9be24..b5869d826c 100644
--- a/src/tools/bootstrap/bootstrap.pro
+++ b/src/tools/bootstrap/bootstrap.pro
@@ -22,7 +22,6 @@ DEFINES += \
QT_NO_QOBJECT \
QT_NO_STL \
QT_NO_SYSTEMLOCALE \
- QT_NO_TEXTSTREAM \
QT_NO_THREAD \
QT_NO_UNICODETABLES \
QT_NO_USING_NAMESPACE \
diff --git a/src/tools/mkv8snapshot/mkv8snapshot.pro b/src/tools/mkv8snapshot/mkv8snapshot.pro
deleted file mode 100644
index cd2b20456a..0000000000
--- a/src/tools/mkv8snapshot/mkv8snapshot.pro
+++ /dev/null
@@ -1,38 +0,0 @@
-TEMPLATE = app
-TARGET = mkv8snapshot
-QT =
-CONFIG -= app_bundle
-CONFIG -= qt
-CONFIG += console
-
-DESTDIR = ../../../bin
-INCLUDEPATH += .
-DEPENDPATH += .
-LIBS =
-OBJECTS_DIR = .
-
-contains(QT_CONFIG, build_all): CONFIG += build_all
-win32|mac:!macx-xcode: CONFIG += debug_and_release
-
-TARGET = $$TARGET$$qtPlatformTargetSuffix()
-
-cross_compile {
- equals(QT_ARCH, arm): V8_TARGET_ARCH = arm
-}
-
-include(../../v8/v8.pri)
-
-cross_compile {
- equals(V8_TARGET_ARCH, arm): SOURCES += $$V8SRC/arm/simulator-arm.cc
-}
-
-SOURCES += \
- $$V8SRC/snapshot-empty.cc \
- $$V8SRC/mksnapshot.cc
-
-unix:LIBS += -lpthread
-
-# We don't need to install this tool, it's only used for building v8.
-# However we do have to make sure that 'make install' builds it.
-dummytarget.CONFIG = dummy_install
-INSTALLS += dummytarget
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 7a9684fd02..8793496b37 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -329,17 +329,10 @@ void Generator::generateCode()
}
if (!extraList.isEmpty()) {
- fprintf(out, "#ifdef Q_NO_DATA_RELOCATION\n");
- fprintf(out, "static const QMetaObjectAccessor qt_meta_extradata_%s[] = {\n ", qualifiedClassNameIdentifier.constData());
- for (int i = 0; i < extraList.count(); ++i) {
- fprintf(out, " %s::getStaticMetaObject,\n", extraList.at(i).constData());
- }
- fprintf(out, "#else\n");
fprintf(out, "static const QMetaObject *qt_meta_extradata_%s[] = {\n ", qualifiedClassNameIdentifier.constData());
for (int i = 0; i < extraList.count(); ++i) {
fprintf(out, " &%s::staticMetaObject,\n", extraList.at(i).constData());
}
- fprintf(out, "#endif //Q_NO_DATA_RELOCATION\n");
fprintf(out, " 0\n};\n\n");
}
@@ -384,12 +377,6 @@ void Generator::generateCode()
if(isQt)
return;
-//
-// Generate static meta object accessor (needed for symbian, because DLLs do not support data imports.
-//
- fprintf(out, "\n#ifdef Q_NO_DATA_RELOCATION\n");
- fprintf(out, "const QMetaObject &%s::getStaticMetaObject() { return staticMetaObject; }\n", cdef->qualified.constData());
- fprintf(out, "#endif //Q_NO_DATA_RELOCATION\n");
if (!cdef->hasQObject)
return;
diff --git a/src/tools/moc/generator.h b/src/tools/moc/generator.h
index 90e586b6a0..3be216ae76 100644
--- a/src/tools/moc/generator.h
+++ b/src/tools/moc/generator.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/moc/keywords.cpp b/src/tools/moc/keywords.cpp
index 1440b5ca7b..fd59c1279f 100644
--- a/src/tools/moc/keywords.cpp
+++ b/src/tools/moc/keywords.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -43,12 +43,12 @@
// DO NOT EDIT.
static const short keyword_trans[][128] = {
- {0,0,0,0,0,0,0,0,0,541,538,0,0,0,0,0,
+ {0,0,0,0,0,0,0,0,0,532,529,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 541,252,539,542,0,38,239,540,25,26,236,234,30,235,27,237,
+ 532,252,530,533,0,38,239,531,25,26,236,234,30,235,27,237,
22,22,22,22,22,22,22,22,22,22,34,41,23,39,24,43,
0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,21,8,8,8,8,8,8,8,8,8,31,543,32,238,8,
+ 8,21,8,8,8,8,8,8,8,8,8,31,534,32,238,8,
0,1,2,3,4,5,6,7,8,9,8,8,10,11,12,13,
14,8,15,16,17,18,19,20,8,8,8,36,245,37,248,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -190,7 +190,7 @@ static const short keyword_trans[][128] = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,42,0,0,0,28,0,
- 546,546,546,546,546,546,546,546,546,546,0,0,0,0,0,0,
+ 537,537,537,537,537,537,537,537,537,537,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -349,7 +349,7 @@ static const short keyword_trans[][128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,545,0,0,0,0,544,
+ 0,0,0,0,0,0,0,0,0,0,536,0,0,0,0,535,
0,0,0,0,0,0,0,0,0,0,0,0,0,258,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -392,7 +392,7 @@ static const short keyword_trans[][128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,439,388,378,383,364,0,448,0,0,0,0,0,358,
- 370,0,530,436,0,0,0,0,0,0,0,0,0,0,0,0,
+ 370,0,521,436,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -415,7 +415,7 @@ static const short keyword_trans[][128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,513,0,437,0,0,0,465,0,0,471,0,0,0,
+ 0,0,0,504,0,437,0,0,0,465,0,0,471,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
@@ -424,7 +424,7 @@ static const short keyword_trans[][128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,450,0,506,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,450,0,497,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -432,15 +432,7 @@ static const short keyword_trans[][128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 522,0,0,481,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,497,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,486,
+ 513,0,0,481,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};
@@ -938,7 +930,7 @@ static const struct
{CHARACTER, 0, 79, 483, CHARACTER},
{CHARACTER, 0, 84, 484, CHARACTER},
{Q_PRIVATE_SLOT_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 49, 0, 0, CHARACTER},
+ {CHARACTER, 0, 95, 486, CHARACTER},
{CHARACTER, 0, 77, 487, CHARACTER},
{CHARACTER, 0, 79, 488, CHARACTER},
{CHARACTER, 0, 67, 489, CHARACTER},
@@ -950,46 +942,37 @@ static const struct
{CHARACTER, 0, 65, 495, CHARACTER},
{CHARACTER, 0, 84, 496, CHARACTER},
{Q_MOC_COMPAT_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 95, 498, CHARACTER},
- {CHARACTER, 0, 83, 499, CHARACTER},
- {CHARACTER, 0, 85, 500, CHARACTER},
- {CHARACTER, 0, 80, 501, CHARACTER},
- {CHARACTER, 0, 80, 502, CHARACTER},
- {CHARACTER, 0, 79, 503, CHARACTER},
- {CHARACTER, 0, 82, 504, CHARACTER},
- {CHARACTER, 0, 84, 505, CHARACTER},
- {Q_QT3_SUPPORT_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 79, 507, CHARACTER},
- {CHARACTER, 0, 75, 508, CHARACTER},
+ {CHARACTER, 0, 79, 498, CHARACTER},
+ {CHARACTER, 0, 75, 499, CHARACTER},
+ {CHARACTER, 0, 65, 500, CHARACTER},
+ {CHARACTER, 0, 66, 501, CHARACTER},
+ {CHARACTER, 0, 76, 502, CHARACTER},
+ {CHARACTER, 0, 69, 503, CHARACTER},
+ {Q_INVOKABLE_TOKEN, 0, 0, 0, CHARACTER},
+ {CHARACTER, 0, 82, 505, CHARACTER},
+ {CHARACTER, 0, 73, 506, CHARACTER},
+ {CHARACTER, 0, 80, 507, CHARACTER},
+ {CHARACTER, 0, 84, 508, CHARACTER},
{CHARACTER, 0, 65, 509, CHARACTER},
{CHARACTER, 0, 66, 510, CHARACTER},
{CHARACTER, 0, 76, 511, CHARACTER},
{CHARACTER, 0, 69, 512, CHARACTER},
- {Q_INVOKABLE_TOKEN, 0, 0, 0, CHARACTER},
+ {Q_SCRIPTABLE_TOKEN, 0, 0, 0, CHARACTER},
{CHARACTER, 0, 82, 514, CHARACTER},
- {CHARACTER, 0, 73, 515, CHARACTER},
+ {CHARACTER, 0, 79, 515, CHARACTER},
{CHARACTER, 0, 80, 516, CHARACTER},
- {CHARACTER, 0, 84, 517, CHARACTER},
- {CHARACTER, 0, 65, 518, CHARACTER},
- {CHARACTER, 0, 66, 519, CHARACTER},
- {CHARACTER, 0, 76, 520, CHARACTER},
- {CHARACTER, 0, 69, 521, CHARACTER},
- {Q_SCRIPTABLE_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 82, 523, CHARACTER},
- {CHARACTER, 0, 79, 524, CHARACTER},
- {CHARACTER, 0, 80, 525, CHARACTER},
- {CHARACTER, 0, 69, 526, CHARACTER},
- {CHARACTER, 0, 82, 527, CHARACTER},
- {CHARACTER, 0, 84, 528, CHARACTER},
- {CHARACTER, 0, 89, 529, CHARACTER},
+ {CHARACTER, 0, 69, 517, CHARACTER},
+ {CHARACTER, 0, 82, 518, CHARACTER},
+ {CHARACTER, 0, 84, 519, CHARACTER},
+ {CHARACTER, 0, 89, 520, CHARACTER},
{Q_PRIVATE_PROPERTY_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 69, 531, CHARACTER},
- {CHARACTER, 0, 86, 532, CHARACTER},
- {CHARACTER, 0, 73, 533, CHARACTER},
- {CHARACTER, 0, 83, 534, CHARACTER},
- {CHARACTER, 0, 73, 535, CHARACTER},
- {CHARACTER, 0, 79, 536, CHARACTER},
- {CHARACTER, 0, 78, 537, CHARACTER},
+ {CHARACTER, 0, 69, 522, CHARACTER},
+ {CHARACTER, 0, 86, 523, CHARACTER},
+ {CHARACTER, 0, 73, 524, CHARACTER},
+ {CHARACTER, 0, 83, 525, CHARACTER},
+ {CHARACTER, 0, 73, 526, CHARACTER},
+ {CHARACTER, 0, 79, 527, CHARACTER},
+ {CHARACTER, 0, 78, 528, CHARACTER},
{Q_REVISION_TOKEN, 0, 0, 0, CHARACTER},
{NEWLINE, 0, 0, 0, NOTOKEN},
{QUOTE, 0, 0, 0, NOTOKEN},
diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp
index bf7e22c0b9..82bd288f0f 100644
--- a/src/tools/moc/main.cpp
+++ b/src/tools/moc/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index d725919cac..6d8e6f899a 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -165,7 +165,6 @@ Type Moc::parseType()
type.isVolatile = true;
continue;
case Q_MOC_COMPAT_TOKEN:
- case Q_QT3_SUPPORT_TOKEN:
case Q_INVOKABLE_TOKEN:
case Q_SCRIPTABLE_TOKEN:
case Q_SIGNALS_TOKEN:
@@ -323,7 +322,6 @@ bool Moc::testFunctionAttribute(Token tok, FunctionDef *def)
{
switch (tok) {
case Q_MOC_COMPAT_TOKEN:
- case Q_QT3_SUPPORT_TOKEN:
def->isCompat = true;
return true;
case Q_INVOKABLE_TOKEN:
diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h
index c2577a2f4c..a80cf304d7 100644
--- a/src/tools/moc/moc.h
+++ b/src/tools/moc/moc.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/moc/mwerks_mac.cpp b/src/tools/moc/mwerks_mac.cpp
index 9286d29349..752fc0d683 100644
--- a/src/tools/moc/mwerks_mac.cpp
+++ b/src/tools/moc/mwerks_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/moc/mwerks_mac.h b/src/tools/moc/mwerks_mac.h
index ab1723c2af..526dc66d81 100644
--- a/src/tools/moc/mwerks_mac.h
+++ b/src/tools/moc/mwerks_mac.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/moc/outputrevision.h b/src/tools/moc/outputrevision.h
index a2a0cda162..4955cca169 100644
--- a/src/tools/moc/outputrevision.h
+++ b/src/tools/moc/outputrevision.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/moc/parser.cpp b/src/tools/moc/parser.cpp
index e960975ecf..39de3abbaf 100644
--- a/src/tools/moc/parser.cpp
+++ b/src/tools/moc/parser.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/moc/parser.h b/src/tools/moc/parser.h
index 651234dd78..7aeac80c38 100644
--- a/src/tools/moc/parser.h
+++ b/src/tools/moc/parser.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/moc/ppkeywords.cpp b/src/tools/moc/ppkeywords.cpp
index f76d59da07..a4f139098e 100644
--- a/src/tools/moc/ppkeywords.cpp
+++ b/src/tools/moc/ppkeywords.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index ecf6d7d4de..376935cd60 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/moc/preprocessor.h b/src/tools/moc/preprocessor.h
index 11b6476380..bf1e6d49b3 100644
--- a/src/tools/moc/preprocessor.h
+++ b/src/tools/moc/preprocessor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/moc/symbols.h b/src/tools/moc/symbols.h
index 9c6de87365..6e773bcab1 100644
--- a/src/tools/moc/symbols.h
+++ b/src/tools/moc/symbols.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/moc/token.cpp b/src/tools/moc/token.cpp
index 25b5b62d0f..d7ae9437e4 100644
--- a/src/tools/moc/token.cpp
+++ b/src/tools/moc/token.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -213,7 +213,6 @@ const char *tokenTypeName(Token t)
case PP_MOC_FALSE: return "PP_MOC_FALSE";
case Q_DECLARE_METATYPE_TOKEN: return "Q_DECLARE_METATYPE_TOKEN";
case Q_MOC_COMPAT_TOKEN: return "Q_MOC_COMPAT_TOKEN";
- case Q_QT3_SUPPORT_TOKEN: return "Q_QT3_SUPPORT_TOKEN";
case Q_INVOKABLE_TOKEN: return "Q_INVOKABLE_TOKEN";
case Q_SCRIPTABLE_TOKEN: return "Q_SCRIPTABLE_TOKEN";
}
diff --git a/src/tools/moc/token.h b/src/tools/moc/token.h
index 04e69141b6..359a46f2e8 100644
--- a/src/tools/moc/token.h
+++ b/src/tools/moc/token.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -182,7 +182,6 @@ enum Token {
Q_SLOT_TOKEN,
Q_PRIVATE_SLOT_TOKEN,
Q_MOC_COMPAT_TOKEN,
- Q_QT3_SUPPORT_TOKEN,
Q_INVOKABLE_TOKEN,
Q_SCRIPTABLE_TOKEN,
Q_PRIVATE_PROPERTY_TOKEN,
diff --git a/src/tools/moc/util/generate.sh b/src/tools/moc/util/generate.sh
index 6340e9e98f..1cb6c5f7ec 100755
--- a/src/tools/moc/util/generate.sh
+++ b/src/tools/moc/util/generate.sh
@@ -1,7 +1,7 @@
#!/bin/sh
#############################################################################
##
-## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
## Contact: Nokia Corporation (qt-info@nokia.com)
##
diff --git a/src/tools/moc/util/generate_keywords.cpp b/src/tools/moc/util/generate_keywords.cpp
index c40eb18c1e..751019797b 100644
--- a/src/tools/moc/util/generate_keywords.cpp
+++ b/src/tools/moc/util/generate_keywords.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -243,7 +243,6 @@ static const Keyword keywords[] = {
{ "Q_SLOTS", "Q_SLOTS_TOKEN" },
{ "Q_PRIVATE_SLOT", "Q_PRIVATE_SLOT_TOKEN" },
{ "QT_MOC_COMPAT", "Q_MOC_COMPAT_TOKEN" },
- { "QT3_SUPPORT", "Q_QT3_SUPPORT_TOKEN" },
{ "Q_INVOKABLE", "Q_INVOKABLE_TOKEN" },
{ "Q_SIGNAL", "Q_SIGNAL_TOKEN" },
{ "Q_SLOT", "Q_SLOT_TOKEN" },
diff --git a/src/tools/moc/util/licenseheader.txt b/src/tools/moc/util/licenseheader.txt
index 6f593a762b..a6f7b3e29a 100644
--- a/src/tools/moc/util/licenseheader.txt
+++ b/src/tools/moc/util/licenseheader.txt
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/moc/utils.h b/src/tools/moc/utils.h
index 31358db682..e5aad4df9c 100644
--- a/src/tools/moc/utils.h
+++ b/src/tools/moc/utils.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/rcc/main.cpp b/src/tools/rcc/main.cpp
index 46ff59e154..6d90f02491 100644
--- a/src/tools/rcc/main.cpp
+++ b/src/tools/rcc/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index 01cc0299f5..6748841615 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/rcc/rcc.h b/src/tools/rcc/rcc.h
index 0a51c3cba5..0510df0bf3 100644
--- a/src/tools/rcc/rcc.h
+++ b/src/tools/rcc/rcc.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/tools.pro b/src/tools/tools.pro
index 89ce0be055..5cbe92309e 100644
--- a/src/tools/tools.pro
+++ b/src/tools/tools.pro
@@ -2,7 +2,6 @@ TEMPLATE = subdirs
TOOLS_SUBDIRS = src_tools_bootstrap src_tools_moc src_tools_rcc
!contains(QT_CONFIG, no-gui): TOOLS_SUBDIRS += src_tools_uic
-contains(QT_CONFIG, v8):contains(QT_CONFIG, v8snapshot): TOOLS_SUBDIRS += src_tools_mkv8snapshot
# Set subdir and respective target name
src_tools_bootstrap.subdir = $$QT_SOURCE_TREE/src/tools/bootstrap
src_tools_bootstrap.target = sub-tools-bootstrap
@@ -12,8 +11,6 @@ src_tools_rcc.subdir = $$QT_SOURCE_TREE/src/tools/rcc
src_tools_rcc.target = sub-rcc
src_tools_uic.subdir = $$QT_SOURCE_TREE/src/tools/uic
src_tools_uic.target = sub-uic
-src_tools_mkv8snapshot.subdir = $$QT_SOURCE_TREE/src/tools/mkv8snapshot
-src_tools_mkv8snapshot.target = sub-mkv8snapshot
!wince*:!ordered {
# Set dependencies for each subdir
diff --git a/src/tools/uic/cpp/cppextractimages.cpp b/src/tools/uic/cpp/cppextractimages.cpp
index 45447d8660..8d9060db44 100644
--- a/src/tools/uic/cpp/cppextractimages.cpp
+++ b/src/tools/uic/cpp/cppextractimages.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/cpp/cppextractimages.h b/src/tools/uic/cpp/cppextractimages.h
index ad0183e335..9641e02060 100644
--- a/src/tools/uic/cpp/cppextractimages.h
+++ b/src/tools/uic/cpp/cppextractimages.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/cpp/cppwritedeclaration.cpp b/src/tools/uic/cpp/cppwritedeclaration.cpp
index d8adc4b7db..afa26b27e4 100644
--- a/src/tools/uic/cpp/cppwritedeclaration.cpp
+++ b/src/tools/uic/cpp/cppwritedeclaration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/cpp/cppwritedeclaration.h b/src/tools/uic/cpp/cppwritedeclaration.h
index 9a7d6edeb2..7d3653362f 100644
--- a/src/tools/uic/cpp/cppwritedeclaration.h
+++ b/src/tools/uic/cpp/cppwritedeclaration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/cpp/cppwriteicondata.cpp b/src/tools/uic/cpp/cppwriteicondata.cpp
index ab362ab0a7..c0f9cc4149 100644
--- a/src/tools/uic/cpp/cppwriteicondata.cpp
+++ b/src/tools/uic/cpp/cppwriteicondata.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/cpp/cppwriteicondata.h b/src/tools/uic/cpp/cppwriteicondata.h
index 2ea0a5baa6..7c43ba842a 100644
--- a/src/tools/uic/cpp/cppwriteicondata.h
+++ b/src/tools/uic/cpp/cppwriteicondata.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/cpp/cppwriteicondeclaration.cpp b/src/tools/uic/cpp/cppwriteicondeclaration.cpp
index 46788819e7..8ba9790f2c 100644
--- a/src/tools/uic/cpp/cppwriteicondeclaration.cpp
+++ b/src/tools/uic/cpp/cppwriteicondeclaration.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/cpp/cppwriteicondeclaration.h b/src/tools/uic/cpp/cppwriteicondeclaration.h
index 63369997b6..911aab473c 100644
--- a/src/tools/uic/cpp/cppwriteicondeclaration.h
+++ b/src/tools/uic/cpp/cppwriteicondeclaration.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/cpp/cppwriteiconinitialization.cpp b/src/tools/uic/cpp/cppwriteiconinitialization.cpp
index f2a35a0b7d..1045bafe0a 100644
--- a/src/tools/uic/cpp/cppwriteiconinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteiconinitialization.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/cpp/cppwriteiconinitialization.h b/src/tools/uic/cpp/cppwriteiconinitialization.h
index dcbb0ef8df..2b4495785a 100644
--- a/src/tools/uic/cpp/cppwriteiconinitialization.h
+++ b/src/tools/uic/cpp/cppwriteiconinitialization.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/cpp/cppwriteincludes.cpp b/src/tools/uic/cpp/cppwriteincludes.cpp
index c4613e20ae..de0deb3852 100644
--- a/src/tools/uic/cpp/cppwriteincludes.cpp
+++ b/src/tools/uic/cpp/cppwriteincludes.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/cpp/cppwriteincludes.h b/src/tools/uic/cpp/cppwriteincludes.h
index e8215364b9..bce8ece0ec 100644
--- a/src/tools/uic/cpp/cppwriteincludes.h
+++ b/src/tools/uic/cpp/cppwriteincludes.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index a887719d4f..dfb4a3299e 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/cpp/cppwriteinitialization.h b/src/tools/uic/cpp/cppwriteinitialization.h
index a33a1b9883..721eb0f79e 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.h
+++ b/src/tools/uic/cpp/cppwriteinitialization.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/customwidgetsinfo.cpp b/src/tools/uic/customwidgetsinfo.cpp
index f4a9381f73..d63054313c 100644
--- a/src/tools/uic/customwidgetsinfo.cpp
+++ b/src/tools/uic/customwidgetsinfo.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/customwidgetsinfo.h b/src/tools/uic/customwidgetsinfo.h
index f04dd53853..ed96a33c58 100644
--- a/src/tools/uic/customwidgetsinfo.h
+++ b/src/tools/uic/customwidgetsinfo.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/databaseinfo.cpp b/src/tools/uic/databaseinfo.cpp
index cbd26033fb..53a6bf3111 100644
--- a/src/tools/uic/databaseinfo.cpp
+++ b/src/tools/uic/databaseinfo.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/databaseinfo.h b/src/tools/uic/databaseinfo.h
index 87d4ceb1e3..7df32fb6e0 100644
--- a/src/tools/uic/databaseinfo.h
+++ b/src/tools/uic/databaseinfo.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/driver.cpp b/src/tools/uic/driver.cpp
index 0dd528c4cb..38217c603e 100644
--- a/src/tools/uic/driver.cpp
+++ b/src/tools/uic/driver.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/driver.h b/src/tools/uic/driver.h
index 22575c9127..66bfde6d53 100644
--- a/src/tools/uic/driver.h
+++ b/src/tools/uic/driver.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/globaldefs.h b/src/tools/uic/globaldefs.h
index a30c35a91c..45e0142821 100644
--- a/src/tools/uic/globaldefs.h
+++ b/src/tools/uic/globaldefs.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/main.cpp b/src/tools/uic/main.cpp
index 1f6e27b2a4..ec63c70dc1 100644
--- a/src/tools/uic/main.cpp
+++ b/src/tools/uic/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/option.h b/src/tools/uic/option.h
index 42b449530b..2eed07f0dc 100644
--- a/src/tools/uic/option.h
+++ b/src/tools/uic/option.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h
index 5ad6a4a12c..1afef3d3ac 100644
--- a/src/tools/uic/qclass_lib_map.h
+++ b/src/tools/uic/qclass_lib_map.h
@@ -397,11 +397,8 @@ QT_CLASS_LIB(QXmlStreamStringRef, QtXml, qxmlstream.h)
QT_CLASS_LIB(QXmlStreamWriter, QtXml, qxmlstream.h)
QT_CLASS_LIB(QNetworkCacheMetaData, QtNetwork, qabstractnetworkcache.h)
QT_CLASS_LIB(QAbstractNetworkCache, QtNetwork, qabstractnetworkcache.h)
-QT_CLASS_LIB(QFtp, QtNetwork, qftp.h)
-QT_CLASS_LIB(QHttpHeader, QtNetwork, qhttp.h)
-QT_CLASS_LIB(QHttpResponseHeader, QtNetwork, qhttp.h)
-QT_CLASS_LIB(QHttpRequestHeader, QtNetwork, qhttp.h)
-QT_CLASS_LIB(QHttp, QtNetwork, qhttp.h)
+QT_CLASS_LIB(QHttpHeader, QtNetwork, qhttpheader_p.h)
+QT_CLASS_LIB(QHttpResponseHeader, QtNetwork, qhttpheader_p.h)
QT_CLASS_LIB(QNetworkAccessManager, QtNetwork, qnetworkaccessmanager.h)
QT_CLASS_LIB(QNetworkCookie, QtNetwork, qnetworkcookie.h)
QT_CLASS_LIB(QNetworkCookieJar, QtNetwork, qnetworkcookiejar.h)
@@ -601,7 +598,6 @@ QT_CLASS_LIB(QTDSDriver, QtSql, qsql_tds.h)
QT_CLASS_LIB(QAccessible, QtWidgets, qaccessible.h)
QT_CLASS_LIB(QAccessibleInterface, QtWidgets, qaccessible.h)
QT_CLASS_LIB(QAccessibleInterfaceEx, QtWidgets, qaccessible.h)
-QT_CLASS_LIB(QAccessibleEvent, QtWidgets, qaccessible.h)
QT_CLASS_LIB(QAccessible2Interface, QtWidgets, qaccessible2.h)
QT_CLASS_LIB(QAccessibleTextInterface, QtWidgets, qaccessible2.h)
QT_CLASS_LIB(QAccessibleEditableTextInterface, QtWidgets, qaccessible2.h)
@@ -1160,189 +1156,3 @@ QT_CLASS_LIB(QGraphicsSvgItem, QtSvg, qgraphicssvgitem.h)
QT_CLASS_LIB(QSvgGenerator, QtSvg, qsvggenerator.h)
QT_CLASS_LIB(QSvgRenderer, QtSvg, qsvgrenderer.h)
QT_CLASS_LIB(QSvgWidget, QtSvg, qsvgwidget.h)
-QT_CLASS_LIB(Q3CanvasItemList, Qt3Support, q3canvas.h)
-QT_CLASS_LIB(Q3CanvasItem, Qt3Support, q3canvas.h)
-QT_CLASS_LIB(Q3Canvas, Qt3Support, q3canvas.h)
-QT_CLASS_LIB(Q3CanvasView, Qt3Support, q3canvas.h)
-QT_CLASS_LIB(Q3CanvasPixmap, Qt3Support, q3canvas.h)
-QT_CLASS_LIB(Q3CanvasPixmapArray, Qt3Support, q3canvas.h)
-QT_CLASS_LIB(Q3CanvasSprite, Qt3Support, q3canvas.h)
-QT_CLASS_LIB(Q3CanvasPolygonalItem, Qt3Support, q3canvas.h)
-QT_CLASS_LIB(Q3CanvasRectangle, Qt3Support, q3canvas.h)
-QT_CLASS_LIB(Q3CanvasPolygon, Qt3Support, q3canvas.h)
-QT_CLASS_LIB(Q3CanvasSpline, Qt3Support, q3canvas.h)
-QT_CLASS_LIB(Q3CanvasLine, Qt3Support, q3canvas.h)
-QT_CLASS_LIB(Q3CanvasEllipse, Qt3Support, q3canvas.h)
-QT_CLASS_LIB(Q3CanvasText, Qt3Support, q3canvas.h)
-QT_CLASS_LIB(Q3FileIconProvider, Qt3Support, q3filedialog.h)
-QT_CLASS_LIB(Q3FilePreview, Qt3Support, q3filedialog.h)
-QT_CLASS_LIB(Q3FileDialog, Qt3Support, q3filedialog.h)
-QT_CLASS_LIB(Q3ProgressDialog, Qt3Support, q3progressdialog.h)
-QT_CLASS_LIB(Q3TabDialog, Qt3Support, q3tabdialog.h)
-QT_CLASS_LIB(Q3Wizard, Qt3Support, q3wizard.h)
-QT_CLASS_LIB(Q3IconDragItem, Qt3Support, q3iconview.h)
-QT_CLASS_LIB(Q3IconDrag, Qt3Support, q3iconview.h)
-QT_CLASS_LIB(Q3IconViewItem, Qt3Support, q3iconview.h)
-QT_CLASS_LIB(Q3IconView, Qt3Support, q3iconview.h)
-QT_CLASS_LIB(Q3ListBox, Qt3Support, q3listbox.h)
-QT_CLASS_LIB(Q3ListBoxItem, Qt3Support, q3listbox.h)
-QT_CLASS_LIB(Q3ListBoxText, Qt3Support, q3listbox.h)
-QT_CLASS_LIB(Q3ListBoxPixmap, Qt3Support, q3listbox.h)
-QT_CLASS_LIB(Q3ListViewItem, Qt3Support, q3listview.h)
-QT_CLASS_LIB(Q3ListView, Qt3Support, q3listview.h)
-QT_CLASS_LIB(Q3CheckListItem, Qt3Support, q3listview.h)
-QT_CLASS_LIB(Q3ListViewItemIterator, Qt3Support, q3listview.h)
-QT_CLASS_LIB(Q3TableSelection, Qt3Support, q3table.h)
-QT_CLASS_LIB(Q3TableItem, Qt3Support, q3table.h)
-QT_CLASS_LIB(Q3ComboTableItem, Qt3Support, q3table.h)
-QT_CLASS_LIB(Q3CheckTableItem, Qt3Support, q3table.h)
-QT_CLASS_LIB(Q3Table, Qt3Support, q3table.h)
-QT_CLASS_LIB(Q3Dns, Qt3Support, q3dns.h)
-QT_CLASS_LIB(Q3DnsSocket, Qt3Support, q3dns.h)
-QT_CLASS_LIB(Q3Ftp, Qt3Support, q3ftp.h)
-QT_CLASS_LIB(Q3HttpHeader, Qt3Support, q3http.h)
-QT_CLASS_LIB(Q3HttpResponseHeader, Qt3Support, q3http.h)
-QT_CLASS_LIB(Q3HttpRequestHeader, Qt3Support, q3http.h)
-QT_CLASS_LIB(Q3Http, Qt3Support, q3http.h)
-QT_CLASS_LIB(Q3LocalFs, Qt3Support, q3localfs.h)
-QT_CLASS_LIB(Q3NetworkProtocolFactoryBase, Qt3Support, q3networkprotocol.h)
-QT_CLASS_LIB(Q3NetworkProtocolFactory, Qt3Support, q3networkprotocol.h)
-QT_CLASS_LIB(Q3NetworkProtocolDict, Qt3Support, q3networkprotocol.h)
-QT_CLASS_LIB(Q3NetworkProtocol, Qt3Support, q3networkprotocol.h)
-QT_CLASS_LIB(Q3NetworkOperation, Qt3Support, q3networkprotocol.h)
-QT_CLASS_LIB(Q3ServerSocket, Qt3Support, q3serversocket.h)
-QT_CLASS_LIB(Q3Socket, Qt3Support, q3socket.h)
-QT_CLASS_LIB(Q3SocketDevice, Qt3Support, q3socketdevice.h)
-QT_CLASS_LIB(Q3Url, Qt3Support, q3url.h)
-QT_CLASS_LIB(Q3UrlOperator, Qt3Support, q3urloperator.h)
-QT_CLASS_LIB(Q3Accel, Qt3Support, q3accel.h)
-QT_CLASS_LIB(Q3BoxLayout, Qt3Support, q3boxlayout.h)
-QT_CLASS_LIB(Q3HBoxLayout, Qt3Support, q3boxlayout.h)
-QT_CLASS_LIB(Q3VBoxLayout, Qt3Support, q3boxlayout.h)
-QT_CLASS_LIB(Q3DragObject, Qt3Support, q3dragobject.h)
-QT_CLASS_LIB(Q3StoredDrag, Qt3Support, q3dragobject.h)
-QT_CLASS_LIB(Q3TextDrag, Qt3Support, q3dragobject.h)
-QT_CLASS_LIB(Q3ImageDrag, Qt3Support, q3dragobject.h)
-QT_CLASS_LIB(Q3UriDrag, Qt3Support, q3dragobject.h)
-QT_CLASS_LIB(Q3ColorDrag, Qt3Support, q3dragobject.h)
-QT_CLASS_LIB(Q3DropSite, Qt3Support, q3dropsite.h)
-QT_CLASS_LIB(Q3GridLayout, Qt3Support, q3gridlayout.h)
-QT_CLASS_LIB(Q3MimeSourceFactory, Qt3Support, q3mimefactory.h)
-QT_CLASS_LIB(Q3PolygonScanner, Qt3Support, q3polygonscanner.h)
-QT_CLASS_LIB(Q3Process, Qt3Support, q3process.h)
-QT_CLASS_LIB(Q3PaintDeviceMetrics, Qt3Support, q3paintdevicemetrics.h)
-QT_CLASS_LIB(Q3Painter, Qt3Support, q3painter.h)
-QT_CLASS_LIB(Q3Picture, Qt3Support, q3picture.h)
-QT_CLASS_LIB(Q3PointArray, Qt3Support, q3pointarray.h)
-QT_CLASS_LIB(Q3DataBrowser, Qt3Support, q3databrowser.h)
-QT_CLASS_LIB(Q3DataTable, Qt3Support, q3datatable.h)
-QT_CLASS_LIB(Q3DataView, Qt3Support, q3dataview.h)
-QT_CLASS_LIB(Q3EditorFactory, Qt3Support, q3editorfactory.h)
-QT_CLASS_LIB(Q3SqlCursor, Qt3Support, q3sqlcursor.h)
-QT_CLASS_LIB(Q3SqlEditorFactory, Qt3Support, q3sqleditorfactory.h)
-QT_CLASS_LIB(Q3SqlFieldInfo, Qt3Support, q3sqlfieldinfo.h)
-QT_CLASS_LIB(Q3SqlForm, Qt3Support, q3sqlform.h)
-QT_CLASS_LIB(Q3SqlPropertyMap, Qt3Support, q3sqlpropertymap.h)
-QT_CLASS_LIB(Q3SqlFieldInfoList, Qt3Support, q3sqlrecordinfo.h)
-QT_CLASS_LIB(Q3SqlRecordInfo, Qt3Support, q3sqlrecordinfo.h)
-QT_CLASS_LIB(Q3SqlSelectCursor, Qt3Support, q3sqlselectcursor.h)
-QT_CLASS_LIB(Q3MultiLineEdit, Qt3Support, q3multilineedit.h)
-QT_CLASS_LIB(Q3SimpleRichText, Qt3Support, q3simplerichtext.h)
-QT_CLASS_LIB(Q3StyleSheetItem, Qt3Support, q3stylesheet.h)
-QT_CLASS_LIB(Q3StyleSheet, Qt3Support, q3stylesheet.h)
-QT_CLASS_LIB(Q3SyntaxHighlighter, Qt3Support, q3syntaxhighlighter.h)
-QT_CLASS_LIB(Q3TextBrowser, Qt3Support, q3textbrowser.h)
-QT_CLASS_LIB(Q3TextEditOptimPrivate, Qt3Support, q3textedit.h)
-QT_CLASS_LIB(Q3TextEdit, Qt3Support, q3textedit.h)
-QT_CLASS_LIB(Q3TextStream, Qt3Support, q3textstream.h)
-QT_CLASS_LIB(Q3TSFUNC, Qt3Support, q3textstream.h)
-QT_CLASS_LIB(Q3TextView, Qt3Support, q3textview.h)
-QT_CLASS_LIB(Q3AsciiCache, Qt3Support, q3asciicache.h)
-QT_CLASS_LIB(Q3AsciiCacheIterator, Qt3Support, q3asciicache.h)
-QT_CLASS_LIB(Q3AsciiDict, Qt3Support, q3asciidict.h)
-QT_CLASS_LIB(Q3AsciiDictIterator, Qt3Support, q3asciidict.h)
-QT_CLASS_LIB(Q3Cache, Qt3Support, q3cache.h)
-QT_CLASS_LIB(Q3CacheIterator, Qt3Support, q3cache.h)
-QT_CLASS_LIB(Q3CleanupHandler, Qt3Support, q3cleanuphandler.h)
-QT_CLASS_LIB(Q3SingleCleanupHandler, Qt3Support, q3cleanuphandler.h)
-QT_CLASS_LIB(Q3CString, Qt3Support, q3cstring.h)
-QT_CLASS_LIB(Q3DeepCopy, Qt3Support, q3deepcopy.h)
-QT_CLASS_LIB(Q3Dict, Qt3Support, q3dict.h)
-QT_CLASS_LIB(Q3DictIterator, Qt3Support, q3dict.h)
-QT_CLASS_LIB(Q3GArray, Qt3Support, q3garray.h)
-QT_CLASS_LIB(Q3GCache, Qt3Support, q3gcache.h)
-QT_CLASS_LIB(Q3GCacheIterator, Qt3Support, q3gcache.h)
-QT_CLASS_LIB(Q3BaseBucket, Qt3Support, q3gdict.h)
-QT_CLASS_LIB(Q3StringBucket, Qt3Support, q3gdict.h)
-QT_CLASS_LIB(Q3AsciiBucket, Qt3Support, q3gdict.h)
-QT_CLASS_LIB(Q3IntBucket, Qt3Support, q3gdict.h)
-QT_CLASS_LIB(Q3PtrBucket, Qt3Support, q3gdict.h)
-QT_CLASS_LIB(Q3GDict, Qt3Support, q3gdict.h)
-QT_CLASS_LIB(Q3GDictIterator, Qt3Support, q3gdict.h)
-QT_CLASS_LIB(Q3LNode, Qt3Support, q3glist.h)
-QT_CLASS_LIB(Q3GList, Qt3Support, q3glist.h)
-QT_CLASS_LIB(Q3GListIterator, Qt3Support, q3glist.h)
-QT_CLASS_LIB(Q3GListStdIterator, Qt3Support, q3glist.h)
-QT_CLASS_LIB(Q3GVector, Qt3Support, q3gvector.h)
-QT_CLASS_LIB(Q3IntCache, Qt3Support, q3intcache.h)
-QT_CLASS_LIB(Q3IntCacheIterator, Qt3Support, q3intcache.h)
-QT_CLASS_LIB(Q3IntDict, Qt3Support, q3intdict.h)
-QT_CLASS_LIB(Q3IntDictIterator, Qt3Support, q3intdict.h)
-QT_CLASS_LIB(Q3MemArray, Qt3Support, q3memarray.h)
-QT_CLASS_LIB(Q3ObjectDictionary, Qt3Support, q3objectdict.h)
-QT_CLASS_LIB(Q3PtrCollection, Qt3Support, q3ptrcollection.h)
-QT_CLASS_LIB(Q3PtrDict, Qt3Support, q3ptrdict.h)
-QT_CLASS_LIB(Q3PtrDictIterator, Qt3Support, q3ptrdict.h)
-QT_CLASS_LIB(Q3PtrListStdIterator, Qt3Support, q3ptrlist.h)
-QT_CLASS_LIB(Q3PtrList, Qt3Support, q3ptrlist.h)
-QT_CLASS_LIB(Q3PtrListIterator, Qt3Support, q3ptrlist.h)
-QT_CLASS_LIB(Q3PtrQueue, Qt3Support, q3ptrqueue.h)
-QT_CLASS_LIB(Q3PtrStack, Qt3Support, q3ptrstack.h)
-QT_CLASS_LIB(Q3PtrVector, Qt3Support, q3ptrvector.h)
-QT_CLASS_LIB(Q3Semaphore, Qt3Support, q3semaphore.h)
-QT_CLASS_LIB(Q3Shared, Qt3Support, q3shared.h)
-QT_CLASS_LIB(Q3Signal, Qt3Support, q3signal.h)
-QT_CLASS_LIB(Q3SortedList, Qt3Support, q3sortedlist.h)
-QT_CLASS_LIB(Q3StrListIterator, Qt3Support, q3strlist.h)
-QT_CLASS_LIB(Q3StrListIterator, Qt3Support, q3strlist.h)
-QT_CLASS_LIB(Q3StrList, Qt3Support, q3strlist.h)
-QT_CLASS_LIB(Q3StrIList, Qt3Support, q3strlist.h)
-QT_CLASS_LIB(Q3StrVec, Qt3Support, q3strvec.h)
-QT_CLASS_LIB(Q3StrIVec, Qt3Support, q3strvec.h)
-QT_CLASS_LIB(Q3ValueListIterator, Qt3Support, q3valuelist.h)
-QT_CLASS_LIB(Q3ValueListConstIterator, Qt3Support, q3valuelist.h)
-QT_CLASS_LIB(Q3ValueList, Qt3Support, q3valuelist.h)
-QT_CLASS_LIB(Q3ValueStack, Qt3Support, q3valuestack.h)
-QT_CLASS_LIB(Q3ValueVector, Qt3Support, q3valuevector.h)
-QT_CLASS_LIB(Q3Action, Qt3Support, q3action.h)
-QT_CLASS_LIB(Q3ActionGroup, Qt3Support, q3action.h)
-QT_CLASS_LIB(Q3Button, Qt3Support, q3button.h)
-QT_CLASS_LIB(Q3ButtonGroup, Qt3Support, q3buttongroup.h)
-QT_CLASS_LIB(Q3VButtonGroup, Qt3Support, q3buttongroup.h)
-QT_CLASS_LIB(Q3HButtonGroup, Qt3Support, q3buttongroup.h)
-QT_CLASS_LIB(Q3ComboBox, Qt3Support, q3combobox.h)
-QT_CLASS_LIB(Q3DateTimeEditBase, Qt3Support, q3datetimeedit.h)
-QT_CLASS_LIB(Q3DateEdit, Qt3Support, q3datetimeedit.h)
-QT_CLASS_LIB(Q3TimeEdit, Qt3Support, q3datetimeedit.h)
-QT_CLASS_LIB(Q3DateTimeEdit, Qt3Support, q3datetimeedit.h)
-QT_CLASS_LIB(Q3DockAreaLayout, Qt3Support, q3dockarea.h)
-QT_CLASS_LIB(Q3DockArea, Qt3Support, q3dockarea.h)
-QT_CLASS_LIB(Q3DockWindow, Qt3Support, q3dockwindow.h)
-QT_CLASS_LIB(Q3Frame, Qt3Support, q3frame.h)
-QT_CLASS_LIB(Q3Grid, Qt3Support, q3grid.h)
-QT_CLASS_LIB(Q3GridView, Qt3Support, q3gridview.h)
-QT_CLASS_LIB(Q3GroupBox, Qt3Support, q3groupbox.h)
-QT_CLASS_LIB(Q3HBox, Qt3Support, q3hbox.h)
-QT_CLASS_LIB(Q3Header, Qt3Support, q3header.h)
-QT_CLASS_LIB(Q3HGroupBox, Qt3Support, q3hgroupbox.h)
-QT_CLASS_LIB(Q3MainWindow, Qt3Support, q3mainwindow.h)
-QT_CLASS_LIB(Q3PopupMenu, Qt3Support, q3popupmenu.h)
-QT_CLASS_LIB(Q3ProgressBar, Qt3Support, q3progressbar.h)
-QT_CLASS_LIB(Q3RangeControl, Qt3Support, q3rangecontrol.h)
-QT_CLASS_LIB(Q3SpinWidget, Qt3Support, q3rangecontrol.h)
-QT_CLASS_LIB(Q3ScrollView, Qt3Support, q3scrollview.h)
-QT_CLASS_LIB(Q3ToolBar, Qt3Support, q3toolbar.h)
-QT_CLASS_LIB(Q3VBox, Qt3Support, q3vbox.h)
-QT_CLASS_LIB(Q3VGroupBox, Qt3Support, q3vgroupbox.h)
-QT_CLASS_LIB(Q3WhatsThis, Qt3Support, q3whatsthis.h)
-QT_CLASS_LIB(Q3WidgetStack, Qt3Support, q3widgetstack.h)
diff --git a/src/tools/uic/treewalker.cpp b/src/tools/uic/treewalker.cpp
index 9974e61aab..cc1dca3820 100644
--- a/src/tools/uic/treewalker.cpp
+++ b/src/tools/uic/treewalker.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/treewalker.h b/src/tools/uic/treewalker.h
index 8cd718509b..f57b6009c2 100644
--- a/src/tools/uic/treewalker.h
+++ b/src/tools/uic/treewalker.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/ui4.cpp b/src/tools/uic/ui4.cpp
index 5374fe9202..0c8adcd07a 100644
--- a/src/tools/uic/ui4.cpp
+++ b/src/tools/uic/ui4.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/ui4.h b/src/tools/uic/ui4.h
index 6a56c9eadc..ce8e9c1473 100644
--- a/src/tools/uic/ui4.h
+++ b/src/tools/uic/ui4.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp
index 347efb1042..8f425c8212 100644
--- a/src/tools/uic/uic.cpp
+++ b/src/tools/uic/uic.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/uic.h b/src/tools/uic/uic.h
index a6437161ee..9f77e54749 100644
--- a/src/tools/uic/uic.h
+++ b/src/tools/uic/uic.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/utils.h b/src/tools/uic/utils.h
index edc1e2a5e2..9455598868 100644
--- a/src/tools/uic/utils.h
+++ b/src/tools/uic/utils.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/validator.cpp b/src/tools/uic/validator.cpp
index 1d8157444c..687b19599d 100644
--- a/src/tools/uic/validator.cpp
+++ b/src/tools/uic/validator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/tools/uic/validator.h b/src/tools/uic/validator.h
index 53085b06d8..1cc313472e 100644
--- a/src/tools/uic/validator.h
+++ b/src/tools/uic/validator.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch b/src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch
deleted file mode 100644
index cb9f4a255c..0000000000
--- a/src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch
+++ /dev/null
@@ -1,336 +0,0 @@
-From 0a86a97f554c4aaa727da1c4481ca6368c68bf85 Mon Sep 17 00:00:00 2001
-From: Aaron Kennedy <aaron.kennedy@nokia.com>
-Date: Tue, 4 Oct 2011 15:04:21 +1000
-Subject: [PATCH 01/12] Add hashing and comparison methods to v8::String
-
-This allows us to more rapidly search for a v8::String inside a hash
-of QStrings.
----
- include/v8.h | 45 +++++++++++++++++++++++++++++
- src/api.cc | 51 +++++++++++++++++++++++++++++++++
- src/heap-inl.h | 2 +
- src/heap.cc | 3 ++
- src/objects-inl.h | 1 +
- src/objects.cc | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
- src/objects.h | 10 ++++++-
- 7 files changed, 192 insertions(+), 2 deletions(-)
-
-diff --git a/include/v8.h b/include/v8.h
-index 73b7fbe..86ea70f 100644
---- a/include/v8.h
-+++ b/include/v8.h
-@@ -1021,6 +1021,49 @@ class String : public Primitive {
- V8EXPORT int Utf8Length() const;
-
- /**
-+ * Returns the hash of this string.
-+ */
-+ V8EXPORT uint32_t Hash() const;
-+
-+ struct CompleteHashData {
-+ CompleteHashData() : length(0), hash(0), symbol_id(0) {}
-+ int length;
-+ uint32_t hash;
-+ uint32_t symbol_id;
-+ };
-+
-+ /**
-+ * Returns the "complete" hash of the string. This is
-+ * all the information about the string needed to implement
-+ * a very efficient hash keyed on the string.
-+ *
-+ * The members of CompleteHashData are:
-+ * length: The length of the string. Equivalent to Length()
-+ * hash: The hash of the string. Equivalent to Hash()
-+ * symbol_id: If the string is a sequential symbol, the symbol
-+ * id, otherwise 0. If the symbol ids of two strings are
-+ * the same (and non-zero) the two strings are identical.
-+ * If the symbol ids are different the strings may still be
-+ * identical, but an Equals() check must be performed.
-+ */
-+ V8EXPORT CompleteHashData CompleteHash() const;
-+
-+ /**
-+ * Compute a hash value for the passed UTF16 string
-+ * data.
-+ */
-+ V8EXPORT static uint32_t ComputeHash(uint16_t *string, int length);
-+ V8EXPORT static uint32_t ComputeHash(char *string, int length);
-+
-+ /**
-+ * Returns true if this string is equal to the external
-+ * string data provided.
-+ */
-+ V8EXPORT bool Equals(uint16_t *string, int length);
-+ V8EXPORT bool Equals(char *string, int length);
-+ inline bool Equals(Handle<Value> that) const { return v8::Value::Equals(that); }
-+
-+ /**
- * Write the contents of the string to an external buffer.
- * If no arguments are given, expects the buffer to be large
- * enough to hold the entire string and NULL terminator. Copies
-@@ -1051,6 +1094,8 @@ class String : public Primitive {
- NO_NULL_TERMINATION = 2
- };
-
-+ V8EXPORT uint16_t GetCharacter(int index);
-+
- // 16-bit character codes.
- V8EXPORT int Write(uint16_t* buffer,
- int start = 0,
-diff --git a/src/api.cc b/src/api.cc
-index ac4f07f..996812e 100644
---- a/src/api.cc
-+++ b/src/api.cc
-@@ -3633,6 +3633,57 @@ int String::Utf8Length() const {
- }
-
-
-+uint32_t String::Hash() const {
-+ i::Handle<i::String> str = Utils::OpenHandle(this);
-+ if (IsDeadCheck(str->GetIsolate(), "v8::String::Hash()")) return 0;
-+ return str->Hash();
-+}
-+
-+
-+String::CompleteHashData String::CompleteHash() const {
-+ i::Handle<i::String> str = Utils::OpenHandle(this);
-+ if (IsDeadCheck(str->GetIsolate(), "v8::String::CompleteHash()")) return CompleteHashData();
-+ CompleteHashData result;
-+ result.length = str->length();
-+ result.hash = str->Hash();
-+ if (str->IsSeqString())
-+ result.symbol_id = i::SeqString::cast(*str)->symbol_id();
-+ return result;
-+}
-+
-+
-+uint32_t String::ComputeHash(uint16_t *string, int length) {
-+ return i::HashSequentialString<i::uc16>(string, length) >> i::String::kHashShift;
-+}
-+
-+
-+uint32_t String::ComputeHash(char *string, int length) {
-+ return i::HashSequentialString<char>(string, length) >> i::String::kHashShift;
-+}
-+
-+
-+uint16_t String::GetCharacter(int index)
-+{
-+ i::Handle<i::String> str = Utils::OpenHandle(this);
-+ return str->Get(index);
-+}
-+
-+
-+bool String::Equals(uint16_t *string, int length) {
-+ i::Handle<i::String> str = Utils::OpenHandle(this);
-+ if (IsDeadCheck(str->GetIsolate(), "v8::String::Equals()")) return 0;
-+ return str->SlowEqualsExternal(string, length);
-+}
-+
-+
-+bool String::Equals(char *string, int length)
-+{
-+ i::Handle<i::String> str = Utils::OpenHandle(this);
-+ if (IsDeadCheck(str->GetIsolate(), "v8::String::Equals()")) return 0;
-+ return str->SlowEqualsExternal(string, length);
-+}
-+
-+
- int String::WriteUtf8(char* buffer,
- int capacity,
- int* nchars_ref,
-diff --git a/src/heap-inl.h b/src/heap-inl.h
-index aaf2927..4c55d63 100644
---- a/src/heap-inl.h
-+++ b/src/heap-inl.h
-@@ -105,6 +105,7 @@ MaybeObject* Heap::AllocateAsciiSymbol(Vector<const char> str,
- String* answer = String::cast(result);
- answer->set_length(str.length());
- answer->set_hash_field(hash_field);
-+ SeqString::cast(answer)->set_symbol_id(0);
-
- ASSERT_EQ(size, answer->Size());
-
-@@ -138,6 +139,7 @@ MaybeObject* Heap::AllocateTwoByteSymbol(Vector<const uc16> str,
- String* answer = String::cast(result);
- answer->set_length(str.length());
- answer->set_hash_field(hash_field);
-+ SeqString::cast(answer)->set_symbol_id(0);
-
- ASSERT_EQ(size, answer->Size());
-
-diff --git a/src/heap.cc b/src/heap.cc
-index bbb9d3e..d287ead 100644
---- a/src/heap.cc
-+++ b/src/heap.cc
-@@ -4009,6 +4009,7 @@ MaybeObject* Heap::AllocateInternalSymbol(unibrow::CharacterStream* buffer,
- String* answer = String::cast(result);
- answer->set_length(chars);
- answer->set_hash_field(hash_field);
-+ SeqString::cast(answer)->set_symbol_id(0);
-
- ASSERT_EQ(size, answer->Size());
-
-@@ -4051,6 +4052,7 @@ MaybeObject* Heap::AllocateRawAsciiString(int length, PretenureFlag pretenure) {
- HeapObject::cast(result)->set_map(ascii_string_map());
- String::cast(result)->set_length(length);
- String::cast(result)->set_hash_field(String::kEmptyHashField);
-+ SeqString::cast(result)->set_symbol_id(0);
- ASSERT_EQ(size, HeapObject::cast(result)->Size());
- return result;
- }
-@@ -4086,6 +4088,7 @@ MaybeObject* Heap::AllocateRawTwoByteString(int length,
- HeapObject::cast(result)->set_map(string_map());
- String::cast(result)->set_length(length);
- String::cast(result)->set_hash_field(String::kEmptyHashField);
-+ SeqString::cast(result)->set_symbol_id(0);
- ASSERT_EQ(size, HeapObject::cast(result)->Size());
- return result;
- }
-diff --git a/src/objects-inl.h b/src/objects-inl.h
-index dc3aa46..34cae9f 100644
---- a/src/objects-inl.h
-+++ b/src/objects-inl.h
-@@ -2082,6 +2082,7 @@ SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset)
- SMI_ACCESSORS(FreeSpace, size, kSizeOffset)
-
- SMI_ACCESSORS(String, length, kLengthOffset)
-+SMI_ACCESSORS(SeqString, symbol_id, kSymbolIdOffset)
-
-
- uint32_t String::hash_field() {
-diff --git a/src/objects.cc b/src/objects.cc
-index 9a87ac5..2946d02 100644
---- a/src/objects.cc
-+++ b/src/objects.cc
-@@ -6716,6 +6716,71 @@ static inline bool CompareStringContentsPartial(Isolate* isolate,
- }
-
-
-+bool String::SlowEqualsExternal(uc16 *string, int length) {
-+ int len = this->length();
-+ if (len != length) return false;
-+ if (len == 0) return true;
-+
-+ // We know the strings are both non-empty. Compare the first chars
-+ // before we try to flatten the strings.
-+ if (this->Get(0) != string[0]) return false;
-+
-+ String* lhs = this->TryFlattenGetString();
-+
-+ if (lhs->IsFlat()) {
-+ String::FlatContent lhs_content = lhs->GetFlatContent();
-+ if (lhs->IsAsciiRepresentation()) {
-+ Vector<const char> vec1 = lhs_content.ToAsciiVector();
-+ VectorIterator<char> buf1(vec1);
-+ VectorIterator<uc16> ib(string, length);
-+ return CompareStringContents(&buf1, &ib);
-+ } else {
-+ Vector<const uc16> vec1 = lhs_content.ToUC16Vector();
-+ Vector<const uc16> vec2(string, length);
-+ return CompareRawStringContents(vec1, vec2);
-+ }
-+ } else {
-+ Isolate* isolate = GetIsolate();
-+ isolate->objects_string_compare_buffer_a()->Reset(0, lhs);
-+ VectorIterator<uc16> ib(string, length);
-+ return CompareStringContents(isolate->objects_string_compare_buffer_a(), &ib);
-+ }
-+}
-+
-+
-+bool String::SlowEqualsExternal(char *string, int length)
-+{
-+ int len = this->length();
-+ if (len != length) return false;
-+ if (len == 0) return true;
-+
-+ // We know the strings are both non-empty. Compare the first chars
-+ // before we try to flatten the strings.
-+ if (this->Get(0) != string[0]) return false;
-+
-+ String* lhs = this->TryFlattenGetString();
-+
-+ if (StringShape(lhs).IsSequentialAscii()) {
-+ const char* str1 = SeqAsciiString::cast(lhs)->GetChars();
-+ return CompareRawStringContents(Vector<const char>(str1, len),
-+ Vector<const char>(string, len));
-+ }
-+
-+ if (lhs->IsFlat()) {
-+ String::FlatContent lhs_content = lhs->GetFlatContent();
-+ Vector<const uc16> vec1 = lhs_content.ToUC16Vector();
-+ VectorIterator<const uc16> buf1(vec1);
-+ VectorIterator<char> buf2(string, length);
-+ return CompareStringContents(&buf1, &buf2);
-+ } else {
-+ Isolate* isolate = GetIsolate();
-+ isolate->objects_string_compare_buffer_a()->Reset(0, lhs);
-+ VectorIterator<char> ib(string, length);
-+ return CompareStringContents(isolate->objects_string_compare_buffer_a(), &ib);
-+ }
-+}
-+
-+
- bool String::SlowEquals(String* other) {
- // Fast check: negative check with lengths.
- int len = length();
-@@ -10716,9 +10781,24 @@ class AsciiSymbolKey : public SequentialSymbolKey<char> {
-
- MaybeObject* AsObject() {
- if (hash_field_ == 0) Hash();
-- return HEAP->AllocateAsciiSymbol(string_, hash_field_);
-+ MaybeObject *result = HEAP->AllocateAsciiSymbol(string_, hash_field_);
-+ if (!result->IsFailure() && result->ToObjectUnchecked()->IsSeqString()) {
-+ while (true) {
-+ Atomic32 my_symbol_id = next_symbol_id;
-+ if (my_symbol_id > Smi::kMaxValue)
-+ break;
-+ if (my_symbol_id == NoBarrier_CompareAndSwap(&next_symbol_id, my_symbol_id, my_symbol_id + 1)) {
-+ SeqString::cast(result->ToObjectUnchecked())->set_symbol_id(my_symbol_id);
-+ break;
-+ }
-+ }
-+ }
-+ return result;
- }
-+
-+ static Atomic32 next_symbol_id;
- };
-+Atomic32 AsciiSymbolKey::next_symbol_id = 1;
-
-
- class SubStringAsciiSymbolKey : public HashTableKey {
-diff --git a/src/objects.h b/src/objects.h
-index f7d21802..d96e5f9 100644
---- a/src/objects.h
-+++ b/src/objects.h
-@@ -6201,6 +6201,9 @@ class String: public HeapObject {
- bool IsAsciiEqualTo(Vector<const char> str);
- bool IsTwoByteEqualTo(Vector<const uc16> str);
-
-+ bool SlowEqualsExternal(uc16 *string, int length);
-+ bool SlowEqualsExternal(char *string, int length);
-+
- // Return a UTF8 representation of the string. The string is null
- // terminated but may optionally contain nulls. Length is returned
- // in length_output if length_output is not a null pointer The string
-@@ -6457,8 +6460,13 @@ class SeqString: public String {
- // Casting.
- static inline SeqString* cast(Object* obj);
-
-+ // Get and set the symbol id of the string
-+ inline int symbol_id();
-+ inline void set_symbol_id(int value);
-+
- // Layout description.
-- static const int kHeaderSize = String::kSize;
-+ static const int kSymbolIdOffset = String::kSize;
-+ static const int kHeaderSize = kSymbolIdOffset + kPointerSize;
-
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString);
---
-1.7.7.3
-
diff --git a/src/v8/0002-Add-a-fallback-mode-for-named-property-interceptors.patch b/src/v8/0002-Add-a-fallback-mode-for-named-property-interceptors.patch
deleted file mode 100644
index 35db5c2ca5..0000000000
--- a/src/v8/0002-Add-a-fallback-mode-for-named-property-interceptors.patch
+++ /dev/null
@@ -1,361 +0,0 @@
-From 20eca1d4ce4c56b599a052d496f4660f9ca9c978 Mon Sep 17 00:00:00 2001
-From: Aaron Kennedy <aaron.kennedy@nokia.com>
-Date: Thu, 27 Oct 2011 11:31:56 +0100
-Subject: [PATCH 02/12] Add a "fallback" mode for named property interceptors
-
-By default interceptors are called before the normal property
-resolution on objects. When an interceptor is installed as a
-"fallback" interceptor, it is only called if the object doesn't
-already have the property.
-
-In the case of a global object having an fallback interceptor,
-the interceptor is not invoked at all for var or function
-declarations.
----
- include/v8.h | 7 +++++++
- src/api.cc | 29 +++++++++++++++++++++++++++++
- src/factory.cc | 3 +++
- src/handles.cc | 6 ++++--
- src/handles.h | 3 ++-
- src/objects-inl.h | 15 +++++++++++++++
- src/objects.cc | 24 +++++++++++++++++-------
- src/objects.h | 16 ++++++++++++----
- src/runtime.cc | 11 ++++++-----
- 9 files changed, 95 insertions(+), 19 deletions(-)
-
-diff --git a/include/v8.h b/include/v8.h
-index 86ea70f..d2e6c32 100644
---- a/include/v8.h
-+++ b/include/v8.h
-@@ -2305,6 +2305,7 @@ class V8EXPORT FunctionTemplate : public Template {
- NamedPropertyQuery query,
- NamedPropertyDeleter remover,
- NamedPropertyEnumerator enumerator,
-+ bool is_fallback,
- Handle<Value> data);
- void SetIndexedInstancePropertyHandler(IndexedPropertyGetter getter,
- IndexedPropertySetter setter,
-@@ -2388,6 +2389,12 @@ class V8EXPORT ObjectTemplate : public Template {
- NamedPropertyDeleter deleter = 0,
- NamedPropertyEnumerator enumerator = 0,
- Handle<Value> data = Handle<Value>());
-+ void SetFallbackPropertyHandler(NamedPropertyGetter getter,
-+ NamedPropertySetter setter = 0,
-+ NamedPropertyQuery query = 0,
-+ NamedPropertyDeleter deleter = 0,
-+ NamedPropertyEnumerator enumerator = 0,
-+ Handle<Value> data = Handle<Value>());
-
- /**
- * Sets an indexed property handler on the object template.
-diff --git a/src/api.cc b/src/api.cc
-index 996812e..e0f3b5a 100644
---- a/src/api.cc
-+++ b/src/api.cc
-@@ -1123,6 +1123,7 @@ void FunctionTemplate::SetNamedInstancePropertyHandler(
- NamedPropertyQuery query,
- NamedPropertyDeleter remover,
- NamedPropertyEnumerator enumerator,
-+ bool is_fallback,
- Handle<Value> data) {
- i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
- if (IsDeadCheck(isolate,
-@@ -1141,6 +1142,7 @@ void FunctionTemplate::SetNamedInstancePropertyHandler(
- if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query);
- if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover);
- if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator);
-+ obj->set_is_fallback(i::Smi::FromInt(is_fallback));
-
- if (data.IsEmpty()) data = v8::Undefined();
- obj->set_data(*Utils::OpenHandle(*data));
-@@ -1285,6 +1287,33 @@ void ObjectTemplate::SetNamedPropertyHandler(NamedPropertyGetter getter,
- query,
- remover,
- enumerator,
-+ false,
-+ data);
-+}
-+
-+
-+void ObjectTemplate::SetFallbackPropertyHandler(NamedPropertyGetter getter,
-+ NamedPropertySetter setter,
-+ NamedPropertyQuery query,
-+ NamedPropertyDeleter remover,
-+ NamedPropertyEnumerator enumerator,
-+ Handle<Value> data) {
-+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
-+ if (IsDeadCheck(isolate, "v8::ObjectTemplate::SetNamedPropertyHandler()")) {
-+ return;
-+ }
-+ ENTER_V8(isolate);
-+ i::HandleScope scope(isolate);
-+ EnsureConstructor(this);
-+ i::FunctionTemplateInfo* constructor =
-+ i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor());
-+ i::Handle<i::FunctionTemplateInfo> cons(constructor);
-+ Utils::ToLocal(cons)->SetNamedInstancePropertyHandler(getter,
-+ setter,
-+ query,
-+ remover,
-+ enumerator,
-+ true,
- data);
- }
-
-diff --git a/src/factory.cc b/src/factory.cc
-index 15f640e..1b95ed1 100644
---- a/src/factory.cc
-+++ b/src/factory.cc
-@@ -1213,6 +1213,9 @@ Handle<JSFunction> Factory::CreateApiFunction(
- // Set interceptor information in the map.
- if (!obj->named_property_handler()->IsUndefined()) {
- map->set_has_named_interceptor();
-+ InterceptorInfo *nph = InterceptorInfo::cast(obj->named_property_handler());
-+ bool is_fallback = nph->is_fallback()->IsUndefined()?false:nph->is_fallback()->value();
-+ map->set_named_interceptor_is_fallback(is_fallback);
- }
- if (!obj->indexed_property_handler()->IsUndefined()) {
- map->set_has_indexed_interceptor();
-diff --git a/src/handles.cc b/src/handles.cc
-index 62851f3..790d224 100644
---- a/src/handles.cc
-+++ b/src/handles.cc
-@@ -269,9 +269,11 @@ Handle<Object> SetProperty(Handle<JSReceiver> object,
- Handle<String> key,
- Handle<Object> value,
- PropertyAttributes attributes,
-- StrictModeFlag strict_mode) {
-+ StrictModeFlag strict_mode,
-+ bool skip_fallback_interceptor) {
- CALL_HEAP_FUNCTION(object->GetIsolate(),
-- object->SetProperty(*key, *value, attributes, strict_mode),
-+ object->SetProperty(*key, *value, attributes, strict_mode,
-+ skip_fallback_interceptor),
- Object);
- }
-
-diff --git a/src/handles.h b/src/handles.h
-index 06e47fc..c359cb3 100644
---- a/src/handles.h
-+++ b/src/handles.h
-@@ -190,7 +190,8 @@ Handle<Object> SetProperty(Handle<JSReceiver> object,
- Handle<String> key,
- Handle<Object> value,
- PropertyAttributes attributes,
-- StrictModeFlag strict_mode);
-+ StrictModeFlag strict_mode,
-+ bool skip_fallback_interceptor = false);
-
- Handle<Object> SetProperty(Handle<Object> object,
- Handle<Object> key,
-diff --git a/src/objects-inl.h b/src/objects-inl.h
-index 34cae9f..1cfea84 100644
---- a/src/objects-inl.h
-+++ b/src/objects-inl.h
-@@ -2754,6 +2754,20 @@ void Map::set_is_shared(bool value) {
- bool Map::is_shared() {
- return ((1 << kIsShared) & bit_field3()) != 0;
- }
-+
-+void Map::set_named_interceptor_is_fallback(bool value)
-+{
-+ if (value) {
-+ set_bit_field3(bit_field3() | (1 << kNamedInterceptorIsFallback));
-+ } else {
-+ set_bit_field3(bit_field3() & ~(1 << kNamedInterceptorIsFallback));
-+ }
-+}
-+
-+bool Map::named_interceptor_is_fallback()
-+{
-+ return ((1 << kNamedInterceptorIsFallback) & bit_field3()) != 0;
-+}
-
-
- JSFunction* Map::unchecked_constructor() {
-@@ -3255,6 +3269,7 @@ ACCESSORS(InterceptorInfo, query, Object, kQueryOffset)
- ACCESSORS(InterceptorInfo, deleter, Object, kDeleterOffset)
- ACCESSORS(InterceptorInfo, enumerator, Object, kEnumeratorOffset)
- ACCESSORS(InterceptorInfo, data, Object, kDataOffset)
-+ACCESSORS(InterceptorInfo, is_fallback, Smi, kFallbackOffset)
-
- ACCESSORS(CallHandlerInfo, callback, Object, kCallbackOffset)
- ACCESSORS(CallHandlerInfo, data, Object, kDataOffset)
-diff --git a/src/objects.cc b/src/objects.cc
-index 2946d02..f5b6bee 100644
---- a/src/objects.cc
-+++ b/src/objects.cc
-@@ -1980,9 +1980,10 @@ MaybeObject* JSObject::SetPropertyWithInterceptor(
- MaybeObject* JSReceiver::SetProperty(String* name,
- Object* value,
- PropertyAttributes attributes,
-- StrictModeFlag strict_mode) {
-+ StrictModeFlag strict_mode,
-+ bool skip_fallback_interceptor) {
- LookupResult result(GetIsolate());
-- LocalLookup(name, &result);
-+ LocalLookup(name, &result, skip_fallback_interceptor);
- return SetProperty(&result, name, value, attributes, strict_mode);
- }
-
-@@ -4213,7 +4214,8 @@ AccessorDescriptor* Map::FindAccessor(String* name) {
- }
-
-
--void JSReceiver::LocalLookup(String* name, LookupResult* result) {
-+void JSReceiver::LocalLookup(String* name, LookupResult* result,
-+ bool skip_fallback_interceptor) {
- ASSERT(name->IsString());
-
- Heap* heap = GetHeap();
-@@ -4245,23 +4247,31 @@ void JSReceiver::LocalLookup(String* name, LookupResult* result) {
- }
-
- // Check for lookup interceptor except when bootstrapping.
-- if (js_object->HasNamedInterceptor() &&
-- !heap->isolate()->bootstrapper()->IsActive()) {
-+ bool wouldIntercept = js_object->HasNamedInterceptor() &&
-+ !heap->isolate()->bootstrapper()->IsActive();
-+ if (wouldIntercept && !map()->named_interceptor_is_fallback()) {
- result->InterceptorResult(js_object);
- return;
- }
-
- js_object->LocalLookupRealNamedProperty(name, result);
-+
-+ if (wouldIntercept && !skip_fallback_interceptor && !result->IsProperty() &&
-+ map()->named_interceptor_is_fallback()) {
-+ result->InterceptorResult(js_object);
-+ return;
-+ }
- }
-
-
--void JSReceiver::Lookup(String* name, LookupResult* result) {
-+void JSReceiver::Lookup(String* name, LookupResult* result,
-+ bool skip_fallback_interceptor) {
- // Ecma-262 3rd 8.6.2.4
- Heap* heap = GetHeap();
- for (Object* current = this;
- current != heap->null_value();
- current = JSObject::cast(current)->GetPrototype()) {
-- JSReceiver::cast(current)->LocalLookup(name, result);
-+ JSReceiver::cast(current)->LocalLookup(name, result, skip_fallback_interceptor);
- if (result->IsProperty()) return;
- }
- result->NotFound();
-diff --git a/src/objects.h b/src/objects.h
-index d96e5f9..ed40061 100644
---- a/src/objects.h
-+++ b/src/objects.h
-@@ -1362,7 +1362,8 @@ class JSReceiver: public HeapObject {
- MUST_USE_RESULT MaybeObject* SetProperty(String* key,
- Object* value,
- PropertyAttributes attributes,
-- StrictModeFlag strict_mode);
-+ StrictModeFlag strict_mode,
-+ bool skip_fallback_interceptor = false);
- MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result,
- String* key,
- Object* value,
-@@ -1414,8 +1415,8 @@ class JSReceiver: public HeapObject {
-
- // Lookup a property. If found, the result is valid and has
- // detailed information.
-- void LocalLookup(String* name, LookupResult* result);
-- void Lookup(String* name, LookupResult* result);
-+ void LocalLookup(String* name, LookupResult* result, bool skip_fallback_interceptor = false);
-+ void Lookup(String* name, LookupResult* result, bool skip_fallback_interceptor = false);
-
- protected:
- Smi* GenerateIdentityHash();
-@@ -4242,6 +4243,10 @@ class Map: public HeapObject {
- inline void set_is_access_check_needed(bool access_check_needed);
- inline bool is_access_check_needed();
-
-+ // Whether the named interceptor is a fallback interceptor or not
-+ inline void set_named_interceptor_is_fallback(bool value);
-+ inline bool named_interceptor_is_fallback();
-+
- // [prototype]: implicit prototype object.
- DECL_ACCESSORS(prototype, Object)
-
-@@ -4506,6 +4511,7 @@ class Map: public HeapObject {
-
- // Bit positions for bit field 3
- static const int kIsShared = 0;
-+ static const int kNamedInterceptorIsFallback = 1;
-
- // Layout of the default cache. It holds alternating name and code objects.
- static const int kCodeCacheEntrySize = 2;
-@@ -7390,6 +7396,7 @@ class InterceptorInfo: public Struct {
- DECL_ACCESSORS(deleter, Object)
- DECL_ACCESSORS(enumerator, Object)
- DECL_ACCESSORS(data, Object)
-+ DECL_ACCESSORS(is_fallback, Smi)
-
- static inline InterceptorInfo* cast(Object* obj);
-
-@@ -7409,7 +7416,8 @@ class InterceptorInfo: public Struct {
- static const int kDeleterOffset = kQueryOffset + kPointerSize;
- static const int kEnumeratorOffset = kDeleterOffset + kPointerSize;
- static const int kDataOffset = kEnumeratorOffset + kPointerSize;
-- static const int kSize = kDataOffset + kPointerSize;
-+ static const int kFallbackOffset = kDataOffset + kPointerSize;
-+ static const int kSize = kFallbackOffset + kPointerSize;
-
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(InterceptorInfo);
-diff --git a/src/runtime.cc b/src/runtime.cc
-index 9c23c2c..0e256c1 100644
---- a/src/runtime.cc
-+++ b/src/runtime.cc
-@@ -1330,7 +1330,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareGlobals) {
- // Lookup the property in the global object, and don't set the
- // value of the variable if the property is already there.
- LookupResult lookup(isolate);
-- global->Lookup(*name, &lookup);
-+ global->Lookup(*name, &lookup, true);
- if (lookup.IsProperty()) {
- // We found an existing property. Unless it was an interceptor
- // that claims the property is absent, skip this declaration.
-@@ -1357,7 +1357,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareGlobals) {
- }
-
- LookupResult lookup(isolate);
-- global->LocalLookup(*name, &lookup);
-+ global->LocalLookup(*name, &lookup, true);
-
- // Compute the property attributes. According to ECMA-262, section
- // 13, page 71, the property must be read-only and
-@@ -1398,7 +1398,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareGlobals) {
- name,
- value,
- static_cast<PropertyAttributes>(attr),
-- strict_mode));
-+ strict_mode,
-+ true));
- }
- }
-
-@@ -1534,7 +1535,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
- while (object->IsJSObject() &&
- JSObject::cast(object)->map()->is_hidden_prototype()) {
- JSObject* raw_holder = JSObject::cast(object);
-- raw_holder->LocalLookup(*name, &lookup);
-+ raw_holder->LocalLookup(*name, &lookup, true);
- if (lookup.IsProperty() && lookup.type() == INTERCEPTOR) {
- HandleScope handle_scope(isolate);
- Handle<JSObject> holder(raw_holder);
-@@ -1557,7 +1558,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
- // Reload global in case the loop above performed a GC.
- global = isolate->context()->global();
- if (assign) {
-- return global->SetProperty(*name, args[2], attributes, strict_mode);
-+ return global->SetProperty(*name, args[2], attributes, strict_mode, true);
- }
- return isolate->heap()->undefined_value();
- }
---
-1.7.7.3
-
diff --git a/src/v8/0003-Generalize-external-object-resources.patch b/src/v8/0003-Generalize-external-object-resources.patch
deleted file mode 100644
index ba384a62ee..0000000000
--- a/src/v8/0003-Generalize-external-object-resources.patch
+++ /dev/null
@@ -1,595 +0,0 @@
-From 74974cee335e6c22ea99fd9a4bbb9c7fa7323d80 Mon Sep 17 00:00:00 2001
-From: Aaron Kennedy <aaron.kennedy@nokia.com>
-Date: Tue, 4 Oct 2011 16:06:09 +1000
-Subject: [PATCH 03/12] Generalize external object resources
-
-V8 was already able to manage and finalize an external string
-resource. This change generalizes that mechanism to handle a
-single generic external resource - a v8::Object::ExternalResource
-derived instance - on normal JSObject's.
-
-This is useful for mapping C++ objects to JS objects where the
-C++ object's memory is effectively owned by the JS Object, and
-thus needs to destroyed when the JS Object is garbage collected.
-The V8 mailing list suggests using a weak persistent handle for
-this purpose, but that seems to incur a fairly massive performance
-penalty for short lived objects as weak persistent handle callbacks
-are not called until the object has been promoted into the old
-object space.
----
- include/v8.h | 25 ++++++++++++++++++++
- src/api.cc | 56 +++++++++++++++++++++++++++++++++++++++++++++
- src/factory.cc | 11 +++++++++
- src/heap-inl.h | 63 +++++++++++++++++++++++++++++++++++---------------
- src/heap.cc | 29 +++++++++++++++++------
- src/heap.h | 16 ++++++++-----
- src/mark-compact.cc | 13 +++++-----
- src/objects-inl.h | 35 +++++++++++++++++++++++++++-
- src/objects.h | 19 ++++++++++++---
- 9 files changed, 223 insertions(+), 44 deletions(-)
-
-diff --git a/include/v8.h b/include/v8.h
-index d2e6c32..3ef4dd6 100644
---- a/include/v8.h
-+++ b/include/v8.h
-@@ -1597,6 +1597,25 @@ class Object : public Value {
- /** Sets a native pointer in an internal field. */
- V8EXPORT void SetPointerInInternalField(int index, void* value);
-
-+ class V8EXPORT ExternalResource { // NOLINT
-+ public:
-+ ExternalResource() {}
-+ virtual ~ExternalResource() {}
-+
-+ protected:
-+ virtual void Dispose() { delete this; }
-+
-+ private:
-+ // Disallow copying and assigning.
-+ ExternalResource(const ExternalResource&);
-+ void operator=(const ExternalResource&);
-+
-+ friend class v8::internal::Heap;
-+ };
-+
-+ V8EXPORT void SetExternalResource(ExternalResource *);
-+ V8EXPORT ExternalResource *GetExternalResource();
-+
- // Testers for local properties.
- V8EXPORT bool HasOwnProperty(Handle<String> key);
- V8EXPORT bool HasRealNamedProperty(Handle<String> key);
-@@ -2466,6 +2485,12 @@ class V8EXPORT ObjectTemplate : public Template {
- */
- void SetInternalFieldCount(int value);
-
-+ /**
-+ * Sets whether the object can store an "external resource" object.
-+ */
-+ bool HasExternalResource();
-+ void SetHasExternalResource(bool value);
-+
- private:
- ObjectTemplate();
- static Local<ObjectTemplate> New(Handle<FunctionTemplate> constructor);
-diff --git a/src/api.cc b/src/api.cc
-index e0f3b5a..7d54252 100644
---- a/src/api.cc
-+++ b/src/api.cc
-@@ -1436,6 +1436,34 @@ void ObjectTemplate::SetInternalFieldCount(int value) {
- }
-
-
-+bool ObjectTemplate::HasExternalResource()
-+{
-+ if (IsDeadCheck(Utils::OpenHandle(this)->GetIsolate(),
-+ "v8::ObjectTemplate::HasExternalResource()")) {
-+ return 0;
-+ }
-+ return !Utils::OpenHandle(this)->has_external_resource()->IsUndefined();
-+}
-+
-+
-+void ObjectTemplate::SetHasExternalResource(bool value)
-+{
-+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
-+ if (IsDeadCheck(isolate, "v8::ObjectTemplate::SetHasExternalResource()")) {
-+ return;
-+ }
-+ ENTER_V8(isolate);
-+ if (value) {
-+ EnsureConstructor(this);
-+ }
-+ if (value) {
-+ Utils::OpenHandle(this)->set_has_external_resource(i::Smi::FromInt(1));
-+ } else {
-+ Utils::OpenHandle(this)->set_has_external_resource(Utils::OpenHandle(this)->GetHeap()->undefined_value());
-+ }
-+}
-+
-+
- // --- S c r i p t D a t a ---
-
-
-@@ -4029,6 +4057,34 @@ void v8::Object::SetPointerInInternalField(int index, void* value) {
- }
-
-
-+void v8::Object::SetExternalResource(v8::Object::ExternalResource *resource) {
-+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
-+ ENTER_V8(isolate);
-+ i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
-+ if (CanBeEncodedAsSmi(resource)) {
-+ obj->SetExternalResourceObject(EncodeAsSmi(resource));
-+ } else {
-+ obj->SetExternalResourceObject(*isolate->factory()->NewForeign(static_cast<i::Address>((void *)resource)));
-+ }
-+ if (!obj->IsSymbol()) {
-+ isolate->heap()->external_string_table()->AddObject(*obj);
-+ }
-+}
-+
-+
-+v8::Object::ExternalResource *v8::Object::GetExternalResource() {
-+ i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
-+ i::Object* value = obj->GetExternalResourceObject();
-+ if (value->IsSmi()) {
-+ return reinterpret_cast<v8::Object::ExternalResource*>(i::Internals::GetExternalPointerFromSmi(value));
-+ } else if (value->IsForeign()) {
-+ return reinterpret_cast<v8::Object::ExternalResource*>(i::Foreign::cast(value)->address());
-+ } else {
-+ return NULL;
-+ }
-+}
-+
-+
- // --- E n v i r o n m e n t ---
-
-
-diff --git a/src/factory.cc b/src/factory.cc
-index 1b95ed1..8c96944 100644
---- a/src/factory.cc
-+++ b/src/factory.cc
-@@ -1152,15 +1152,21 @@ Handle<JSFunction> Factory::CreateApiFunction(
- Handle<Code> construct_stub = isolate()->builtins()->JSConstructStubApi();
-
- int internal_field_count = 0;
-+ bool has_external_resource = false;
-+
- if (!obj->instance_template()->IsUndefined()) {
- Handle<ObjectTemplateInfo> instance_template =
- Handle<ObjectTemplateInfo>(
- ObjectTemplateInfo::cast(obj->instance_template()));
- internal_field_count =
- Smi::cast(instance_template->internal_field_count())->value();
-+ has_external_resource =
-+ !instance_template->has_external_resource()->IsUndefined();
- }
-
- int instance_size = kPointerSize * internal_field_count;
-+ if (has_external_resource) instance_size += kPointerSize;
-+
- InstanceType type = INVALID_TYPE;
- switch (instance_type) {
- case JavaScriptObject:
-@@ -1195,6 +1201,11 @@ Handle<JSFunction> Factory::CreateApiFunction(
-
- Handle<Map> map = Handle<Map>(result->initial_map());
-
-+ // Mark as having external data object if needed
-+ if (has_external_resource) {
-+ map->set_has_external_resource(true);
-+ }
-+
- // Mark as undetectable if needed.
- if (obj->undetectable()) {
- map->set_is_undetectable();
-diff --git a/src/heap-inl.h b/src/heap-inl.h
-index 4c55d63..bca57cb 100644
---- a/src/heap-inl.h
-+++ b/src/heap-inl.h
-@@ -222,21 +222,36 @@ MaybeObject* Heap::NumberFromUint32(uint32_t value) {
- }
-
-
--void Heap::FinalizeExternalString(String* string) {
-- ASSERT(string->IsExternalString());
-- v8::String::ExternalStringResourceBase** resource_addr =
-- reinterpret_cast<v8::String::ExternalStringResourceBase**>(
-- reinterpret_cast<byte*>(string) +
-- ExternalString::kResourceOffset -
-- kHeapObjectTag);
--
-- // Dispose of the C++ object if it has not already been disposed.
-- if (*resource_addr != NULL) {
-- (*resource_addr)->Dispose();
-+void Heap::FinalizeExternalString(HeapObject* string) {
-+ ASSERT(string->IsExternalString() || string->map()->has_external_resource());
-+
-+ if (string->IsExternalString()) {
-+ v8::String::ExternalStringResourceBase** resource_addr =
-+ reinterpret_cast<v8::String::ExternalStringResourceBase**>(
-+ reinterpret_cast<byte*>(string) +
-+ ExternalString::kResourceOffset -
-+ kHeapObjectTag);
-+
-+ // Dispose of the C++ object if it has not already been disposed.
-+ if (*resource_addr != NULL) {
-+ (*resource_addr)->Dispose();
-+ }
-+
-+ // Clear the resource pointer in the string.
-+ *resource_addr = NULL;
-+ } else {
-+ JSObject *object = JSObject::cast(string);
-+ Object *value = object->GetExternalResourceObject();
-+ v8::Object::ExternalResource *resource = 0;
-+ if (value->IsSmi()) {
-+ resource = reinterpret_cast<v8::Object::ExternalResource*>(Internals::GetExternalPointerFromSmi(value));
-+ } else if (value->IsForeign()) {
-+ resource = reinterpret_cast<v8::Object::ExternalResource*>(Foreign::cast(value)->address());
-+ }
-+ if (resource) {
-+ resource->Dispose();
-+ }
- }
--
-- // Clear the resource pointer in the string.
-- *resource_addr = NULL;
- }
-
-
-@@ -555,6 +570,16 @@ void ExternalStringTable::AddString(String* string) {
- }
-
-
-+void ExternalStringTable::AddObject(HeapObject* object) {
-+ ASSERT(object->map()->has_external_resource());
-+ if (heap_->InNewSpace(object)) {
-+ new_space_strings_.Add(object);
-+ } else {
-+ old_space_strings_.Add(object);
-+ }
-+}
-+
-+
- void ExternalStringTable::Iterate(ObjectVisitor* v) {
- if (!new_space_strings_.is_empty()) {
- Object** start = &new_space_strings_[0];
-@@ -583,14 +608,14 @@ void ExternalStringTable::Verify() {
- }
-
-
--void ExternalStringTable::AddOldString(String* string) {
-- ASSERT(string->IsExternalString());
-- ASSERT(!heap_->InNewSpace(string));
-- old_space_strings_.Add(string);
-+void ExternalStringTable::AddOldObject(HeapObject* object) {
-+ ASSERT(object->IsExternalString() || object->map()->has_external_resource());
-+ ASSERT(!heap_->InNewSpace(object));
-+ old_space_strings_.Add(object);
- }
-
-
--void ExternalStringTable::ShrinkNewStrings(int position) {
-+void ExternalStringTable::ShrinkNewObjects(int position) {
- new_space_strings_.Rewind(position);
- if (FLAG_verify_heap) {
- Verify();
-diff --git a/src/heap.cc b/src/heap.cc
-index d287ead..53a0f27 100644
---- a/src/heap.cc
-+++ b/src/heap.cc
-@@ -1099,18 +1099,18 @@ void Heap::Scavenge() {
- }
-
-
--String* Heap::UpdateNewSpaceReferenceInExternalStringTableEntry(Heap* heap,
-- Object** p) {
-+HeapObject* Heap::UpdateNewSpaceReferenceInExternalStringTableEntry(Heap* heap,
-+ Object** p) {
- MapWord first_word = HeapObject::cast(*p)->map_word();
-
- if (!first_word.IsForwardingAddress()) {
- // Unreachable external string can be finalized.
-- heap->FinalizeExternalString(String::cast(*p));
-+ heap->FinalizeExternalString(HeapObject::cast(*p));
- return NULL;
- }
-
- // String is still reachable.
-- return String::cast(first_word.ToForwardingAddress());
-+ return HeapObject::cast(first_word.ToForwardingAddress());
- }
-
-
-@@ -1128,11 +1128,11 @@ void Heap::UpdateNewSpaceReferencesInExternalStringTable(
-
- for (Object** p = start; p < end; ++p) {
- ASSERT(InFromSpace(*p));
-- String* target = updater_func(this, p);
-+ HeapObject* target = updater_func(this, p);
-
- if (target == NULL) continue;
-
-- ASSERT(target->IsExternalString());
-+ ASSERT(target->IsExternalString() || target->map()->has_external_resource());
-
- if (InNewSpace(target)) {
- // String is still in new space. Update the table entry.
-@@ -1140,12 +1140,12 @@ void Heap::UpdateNewSpaceReferencesInExternalStringTable(
- ++last;
- } else {
- // String got promoted. Move it to the old string list.
-- external_string_table_.AddOldString(target);
-+ external_string_table_.AddOldObject(target);
- }
- }
-
- ASSERT(last <= end);
-- external_string_table_.ShrinkNewStrings(static_cast<int>(last - start));
-+ external_string_table_.ShrinkNewObjects(static_cast<int>(last - start));
- }
-
-
-@@ -6367,6 +6367,19 @@ void ExternalStringTable::CleanUp() {
-
-
- void ExternalStringTable::TearDown() {
-+ for (int i = 0; i < new_space_strings_.length(); ++i) {
-+ if (new_space_strings_[i] == heap_->raw_unchecked_null_value()) continue;
-+ HeapObject *object = HeapObject::cast(new_space_strings_[i]);
-+ if (!object->IsExternalString())
-+ heap_->FinalizeExternalString(object);
-+ }
-+ for (int i = 0; i < old_space_strings_.length(); ++i) {
-+ if (old_space_strings_[i] == heap_->raw_unchecked_null_value()) continue;
-+ HeapObject *object = HeapObject::cast(old_space_strings_[i]);
-+ if (!object->IsExternalString())
-+ heap_->FinalizeExternalString(object);
-+ }
-+
- new_space_strings_.Free();
- old_space_strings_.Free();
- }
-diff --git a/src/heap.h b/src/heap.h
-index 7c0b0ea..5e90964 100644
---- a/src/heap.h
-+++ b/src/heap.h
-@@ -245,8 +245,8 @@ class Isolate;
- class WeakObjectRetainer;
-
-
--typedef String* (*ExternalStringTableUpdaterCallback)(Heap* heap,
-- Object** pointer);
-+typedef HeapObject* (*ExternalStringTableUpdaterCallback)(Heap* heap,
-+ Object** pointer);
-
- class StoreBufferRebuilder {
- public:
-@@ -331,10 +331,14 @@ typedef void (*ScavengingCallback)(Map* map,
- // External strings table is a place where all external strings are
- // registered. We need to keep track of such strings to properly
- // finalize them.
-+// The ExternalStringTable can contain both strings and objects with
-+// external resources. It was not renamed to make the patch simpler.
- class ExternalStringTable {
- public:
- // Registers an external string.
- inline void AddString(String* string);
-+ // Registers an external object.
-+ inline void AddObject(HeapObject* string);
-
- inline void Iterate(ObjectVisitor* v);
-
-@@ -352,10 +356,10 @@ class ExternalStringTable {
-
- inline void Verify();
-
-- inline void AddOldString(String* string);
-+ inline void AddOldObject(HeapObject* string);
-
- // Notifies the table that only a prefix of the new list is valid.
-- inline void ShrinkNewStrings(int position);
-+ inline void ShrinkNewObjects(int position);
-
- // To speed up scavenge collections new space string are kept
- // separate from old space strings.
-@@ -851,7 +855,7 @@ class Heap {
-
- // Finalizes an external string by deleting the associated external
- // data and clearing the resource pointer.
-- inline void FinalizeExternalString(String* string);
-+ inline void FinalizeExternalString(HeapObject* string);
-
- // Allocates an uninitialized object. The memory is non-executable if the
- // hardware and OS allow.
-@@ -1656,7 +1660,7 @@ class Heap {
- // Performs a minor collection in new generation.
- void Scavenge();
-
-- static String* UpdateNewSpaceReferenceInExternalStringTableEntry(
-+ static HeapObject* UpdateNewSpaceReferenceInExternalStringTableEntry(
- Heap* heap,
- Object** pointer);
-
-diff --git a/src/mark-compact.cc b/src/mark-compact.cc
-index b41b033..bf0aab8 100644
---- a/src/mark-compact.cc
-+++ b/src/mark-compact.cc
-@@ -1513,8 +1513,9 @@ class SymbolTableCleaner : public ObjectVisitor {
-
- // Since no objects have yet been moved we can safely access the map of
- // the object.
-- if (o->IsExternalString()) {
-- heap_->FinalizeExternalString(String::cast(*p));
-+ if (o->IsExternalString() ||
-+ (o->IsHeapObject() && HeapObject::cast(o)->map()->has_external_resource())) {
-+ heap_->FinalizeExternalString(HeapObject::cast(*p));
- }
- // Set the entry to null_value (as deleted).
- *p = heap_->null_value();
-@@ -2487,15 +2488,15 @@ static void UpdatePointer(HeapObject** p, HeapObject* object) {
- }
-
-
--static String* UpdateReferenceInExternalStringTableEntry(Heap* heap,
-- Object** p) {
-+static HeapObject* UpdateReferenceInExternalStringTableEntry(Heap* heap,
-+ Object** p) {
- MapWord map_word = HeapObject::cast(*p)->map_word();
-
- if (map_word.IsForwardingAddress()) {
-- return String::cast(map_word.ToForwardingAddress());
-+ return HeapObject::cast(map_word.ToForwardingAddress());
- }
-
-- return String::cast(*p);
-+ return HeapObject::cast(*p);
- }
-
-
-diff --git a/src/objects-inl.h b/src/objects-inl.h
-index 1cfea84..6a80c9c 100644
---- a/src/objects-inl.h
-+++ b/src/objects-inl.h
-@@ -1343,7 +1343,7 @@ int JSObject::GetInternalFieldCount() {
- // Make sure to adjust for the number of in-object properties. These
- // properties do contribute to the size, but are not internal fields.
- return ((Size() - GetHeaderSize()) >> kPointerSizeLog2) -
-- map()->inobject_properties();
-+ map()->inobject_properties() - (map()->has_external_resource()?1:0);
- }
-
-
-@@ -1373,6 +1373,23 @@ void JSObject::SetInternalField(int index, Object* value) {
- }
-
-
-+void JSObject::SetExternalResourceObject(Object *value) {
-+ ASSERT(map()->has_external_resource());
-+ int offset = GetHeaderSize() + kPointerSize * GetInternalFieldCount();
-+ WRITE_FIELD(this, offset, value);
-+ WRITE_BARRIER(GetHeap(), this, offset, value);
-+}
-+
-+
-+Object *JSObject::GetExternalResourceObject() {
-+ if (map()->has_external_resource()) {
-+ return READ_FIELD(this, GetHeaderSize() + kPointerSize * GetInternalFieldCount());
-+ } else {
-+ return GetHeap()->undefined_value();
-+ }
-+}
-+
-+
- // Access fast-case object properties at index. The use of these routines
- // is needed to correctly distinguish between properties stored in-object and
- // properties stored in the properties array.
-@@ -2755,6 +2772,20 @@ bool Map::is_shared() {
- return ((1 << kIsShared) & bit_field3()) != 0;
- }
-
-+void Map::set_has_external_resource(bool value) {
-+ if (value) {
-+ set_bit_field(bit_field() | (1 << kHasExternalResource));
-+ } else {
-+ set_bit_field(bit_field() & ~(1 << kHasExternalResource));
-+ }
-+}
-+
-+bool Map::has_external_resource()
-+{
-+ return ((1 << kHasExternalResource) & bit_field()) != 0;
-+}
-+
-+
- void Map::set_named_interceptor_is_fallback(bool value)
- {
- if (value) {
-@@ -3301,6 +3332,8 @@ ACCESSORS(FunctionTemplateInfo, flag, Smi, kFlagOffset)
- ACCESSORS(ObjectTemplateInfo, constructor, Object, kConstructorOffset)
- ACCESSORS(ObjectTemplateInfo, internal_field_count, Object,
- kInternalFieldCountOffset)
-+ACCESSORS(ObjectTemplateInfo, has_external_resource, Object,
-+ kHasExternalResourceOffset)
-
- ACCESSORS(SignatureInfo, receiver, Object, kReceiverOffset)
- ACCESSORS(SignatureInfo, args, Object, kArgsOffset)
-diff --git a/src/objects.h b/src/objects.h
-index ed40061..c38d461 100644
---- a/src/objects.h
-+++ b/src/objects.h
-@@ -1760,6 +1760,9 @@ class JSObject: public JSReceiver {
- inline Object* GetInternalField(int index);
- inline void SetInternalField(int index, Object* value);
-
-+ inline void SetExternalResourceObject(Object *);
-+ inline Object *GetExternalResourceObject();
-+
- // The following lookup functions skip interceptors.
- void LocalLookupRealNamedProperty(String* name, LookupResult* result);
- void LookupRealNamedProperty(String* name, LookupResult* result);
-@@ -4171,11 +4174,11 @@ class Map: public HeapObject {
-
- // Tells whether the instance has a call-as-function handler.
- inline void set_has_instance_call_handler() {
-- set_bit_field(bit_field() | (1 << kHasInstanceCallHandler));
-+ set_bit_field3(bit_field3() | (1 << kHasInstanceCallHandler));
- }
-
- inline bool has_instance_call_handler() {
-- return ((1 << kHasInstanceCallHandler) & bit_field()) != 0;
-+ return ((1 << kHasInstanceCallHandler) & bit_field3()) != 0;
- }
-
- inline void set_is_extensible(bool value);
-@@ -4247,6 +4250,11 @@ class Map: public HeapObject {
- inline void set_named_interceptor_is_fallback(bool value);
- inline bool named_interceptor_is_fallback();
-
-+ // Tells whether the instance has the space for an external resource
-+ // object
-+ inline void set_has_external_resource(bool value);
-+ inline bool has_external_resource();
-+
- // [prototype]: implicit prototype object.
- DECL_ACCESSORS(prototype, Object)
-
-@@ -4487,7 +4495,7 @@ class Map: public HeapObject {
- static const int kHasNamedInterceptor = 3;
- static const int kHasIndexedInterceptor = 4;
- static const int kIsUndetectable = 5;
-- static const int kHasInstanceCallHandler = 6;
-+ static const int kHasExternalResource = 6;
- static const int kIsAccessCheckNeeded = 7;
-
- // Bit positions for bit field 2
-@@ -4512,6 +4520,7 @@ class Map: public HeapObject {
- // Bit positions for bit field 3
- static const int kIsShared = 0;
- static const int kNamedInterceptorIsFallback = 1;
-+ static const int kHasInstanceCallHandler = 2;
-
- // Layout of the default cache. It holds alternating name and code objects.
- static const int kCodeCacheEntrySize = 2;
-@@ -7539,6 +7548,7 @@ class ObjectTemplateInfo: public TemplateInfo {
- public:
- DECL_ACCESSORS(constructor, Object)
- DECL_ACCESSORS(internal_field_count, Object)
-+ DECL_ACCESSORS(has_external_resource, Object)
-
- static inline ObjectTemplateInfo* cast(Object* obj);
-
-@@ -7555,7 +7565,8 @@ class ObjectTemplateInfo: public TemplateInfo {
- static const int kConstructorOffset = TemplateInfo::kHeaderSize;
- static const int kInternalFieldCountOffset =
- kConstructorOffset + kPointerSize;
-- static const int kSize = kInternalFieldCountOffset + kPointerSize;
-+ static const int kHasExternalResourceOffset = kInternalFieldCountOffset + kPointerSize;
-+ static const int kSize = kHasExternalResourceOffset + kPointerSize;
- };
-
-
---
-1.7.7.3
-
diff --git a/src/v8/0004-Introduce-a-QML-compilation-mode.patch b/src/v8/0004-Introduce-a-QML-compilation-mode.patch
deleted file mode 100644
index 712c710df2..0000000000
--- a/src/v8/0004-Introduce-a-QML-compilation-mode.patch
+++ /dev/null
@@ -1,2355 +0,0 @@
-From ae1c497cf2235df9d73d3c5d3c2b40bcde7e534f Mon Sep 17 00:00:00 2001
-From: Aaron Kennedy <aaron.kennedy@nokia.com>
-Date: Thu, 27 Oct 2011 13:34:16 +0100
-Subject: [PATCH 04/12] Introduce a QML compilation mode
-
-In QML mode, there is a second global object - known as the QML
-global object. During property resolution, if a property is not
-present on the JS global object, it is resolved on the QML global
-object.
-
-This global object behavior is only enabled if a script is being
-compiled in QML mode. The object to use as the QML global object
-is passed as a parameter to the Script::Run() method. Any function
-closures etc. created during the run will retain a reference to this
-object, so different objects can be passed in different script
-runs.
----
- include/v8.h | 19 +++++++--
- src/api.cc | 52 +++++++++++++++++++----
- src/arm/code-stubs-arm.cc | 4 ++
- src/arm/full-codegen-arm.cc | 28 +++++++-----
- src/arm/lithium-arm.cc | 4 +-
- src/arm/lithium-arm.h | 12 +++++-
- src/arm/lithium-codegen-arm.cc | 9 ++--
- src/arm/macro-assembler-arm.h | 5 ++
- src/ast-inl.h | 5 ++
- src/ast.cc | 5 ++
- src/ast.h | 1 +
- src/code-stubs.h | 2 +-
- src/compiler.cc | 15 ++++++-
- src/compiler.h | 16 ++++++-
- src/contexts.cc | 35 ++++++++++++++++
- src/contexts.h | 4 ++
- src/execution.cc | 31 ++++++++++++--
- src/execution.h | 8 ++++
- src/full-codegen.cc | 3 +-
- src/full-codegen.h | 1 +
- src/heap.cc | 4 ++
- src/hydrogen-instructions.cc | 5 ++
- src/hydrogen-instructions.h | 21 ++++++++-
- src/hydrogen.cc | 4 ++
- src/ia32/code-stubs-ia32.cc | 5 ++
- src/ia32/full-codegen-ia32.cc | 28 +++++++-----
- src/ia32/lithium-codegen-ia32.cc | 9 ++--
- src/ia32/lithium-ia32.cc | 4 +-
- src/ia32/lithium-ia32.h | 12 +++++-
- src/ia32/macro-assembler-ia32.h | 3 +
- src/mips/code-stubs-mips.cc | 5 ++
- src/mips/full-codegen-mips.cc | 30 ++++++++-----
- src/mips/macro-assembler-mips.h | 5 ++
- src/objects-inl.h | 2 +
- src/objects.h | 7 +++
- src/parser.cc | 28 +++++++++++--
- src/parser.h | 4 +-
- src/prettyprinter.cc | 3 +
- src/runtime.cc | 84 +++++++++++++++++++++++++-------------
- src/runtime.h | 8 ++--
- src/scopeinfo.cc | 28 ++++++++++---
- src/scopeinfo.h | 1 +
- src/scopes.cc | 63 ++++++++++++++++++++++++++++
- src/scopes.h | 8 ++++
- src/variables.cc | 3 +-
- src/variables.h | 5 ++
- src/x64/code-stubs-x64.cc | 4 ++
- src/x64/full-codegen-x64.cc | 28 +++++++-----
- src/x64/lithium-codegen-x64.cc | 9 ++--
- src/x64/lithium-x64.cc | 4 +-
- src/x64/lithium-x64.h | 12 +++++
- src/x64/macro-assembler-x64.h | 5 ++
- 52 files changed, 559 insertions(+), 141 deletions(-)
-
-diff --git a/include/v8.h b/include/v8.h
-index 3ef4dd6..193e2fe 100644
---- a/include/v8.h
-+++ b/include/v8.h
-@@ -587,6 +587,11 @@ class ScriptOrigin {
- */
- class V8EXPORT Script {
- public:
-+ enum CompileFlags {
-+ Default = 0x00,
-+ QmlMode = 0x01
-+ };
-+
- /**
- * Compiles the specified script (context-independent).
- *
-@@ -605,7 +610,8 @@ class V8EXPORT Script {
- static Local<Script> New(Handle<String> source,
- ScriptOrigin* origin = NULL,
- ScriptData* pre_data = NULL,
-- Handle<String> script_data = Handle<String>());
-+ Handle<String> script_data = Handle<String>(),
-+ CompileFlags = Default);
-
- /**
- * Compiles the specified script using the specified file name
-@@ -618,7 +624,8 @@ class V8EXPORT Script {
- * will use the currently entered context).
- */
- static Local<Script> New(Handle<String> source,
-- Handle<Value> file_name);
-+ Handle<Value> file_name,
-+ CompileFlags = Default);
-
- /**
- * Compiles the specified script (bound to current context).
-@@ -639,7 +646,8 @@ class V8EXPORT Script {
- static Local<Script> Compile(Handle<String> source,
- ScriptOrigin* origin = NULL,
- ScriptData* pre_data = NULL,
-- Handle<String> script_data = Handle<String>());
-+ Handle<String> script_data = Handle<String>(),
-+ CompileFlags = Default);
-
- /**
- * Compiles the specified script using the specified file name
-@@ -656,7 +664,8 @@ class V8EXPORT Script {
- */
- static Local<Script> Compile(Handle<String> source,
- Handle<Value> file_name,
-- Handle<String> script_data = Handle<String>());
-+ Handle<String> script_data = Handle<String>(),
-+ CompileFlags = Default);
-
- /**
- * Runs the script returning the resulting value. If the script is
-@@ -666,6 +675,7 @@ class V8EXPORT Script {
- * compiled.
- */
- Local<Value> Run();
-+ Local<Value> Run(Handle<Object> qml);
-
- /**
- * Returns the script id value.
-@@ -3506,6 +3516,7 @@ class V8EXPORT Context {
- * JavaScript frames an empty handle is returned.
- */
- static Local<Context> GetCalling();
-+ static Local<Object> GetCallingQmlGlobal();
-
- /**
- * Sets the security token for the context. To access an object in
-diff --git a/src/api.cc b/src/api.cc
-index 7d54252..2d3d97a 100644
---- a/src/api.cc
-+++ b/src/api.cc
-@@ -1514,7 +1514,8 @@ ScriptData* ScriptData::New(const char* data, int length) {
- Local<Script> Script::New(v8::Handle<String> source,
- v8::ScriptOrigin* origin,
- v8::ScriptData* pre_data,
-- v8::Handle<String> script_data) {
-+ v8::Handle<String> script_data,
-+ v8::Script::CompileFlags compile_flags) {
- i::Isolate* isolate = i::Isolate::Current();
- ON_BAILOUT(isolate, "v8::Script::New()", return Local<Script>());
- LOG_API(isolate, "Script::New");
-@@ -1551,7 +1552,8 @@ Local<Script> Script::New(v8::Handle<String> source,
- NULL,
- pre_data_impl,
- Utils::OpenHandle(*script_data),
-- i::NOT_NATIVES_CODE);
-+ i::NOT_NATIVES_CODE,
-+ compile_flags);
- has_pending_exception = result.is_null();
- EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>());
- return Local<Script>(ToApi<Script>(result));
-@@ -1559,21 +1561,23 @@ Local<Script> Script::New(v8::Handle<String> source,
-
-
- Local<Script> Script::New(v8::Handle<String> source,
-- v8::Handle<Value> file_name) {
-+ v8::Handle<Value> file_name,
-+ v8::Script::CompileFlags compile_flags) {
- ScriptOrigin origin(file_name);
-- return New(source, &origin);
-+ return New(source, &origin, 0, Handle<String>(), compile_flags);
- }
-
-
- Local<Script> Script::Compile(v8::Handle<String> source,
- v8::ScriptOrigin* origin,
- v8::ScriptData* pre_data,
-- v8::Handle<String> script_data) {
-+ v8::Handle<String> script_data,
-+ v8::Script::CompileFlags compile_flags) {
- i::Isolate* isolate = i::Isolate::Current();
- ON_BAILOUT(isolate, "v8::Script::Compile()", return Local<Script>());
- LOG_API(isolate, "Script::Compile");
- ENTER_V8(isolate);
-- Local<Script> generic = New(source, origin, pre_data, script_data);
-+ Local<Script> generic = New(source, origin, pre_data, script_data, compile_flags);
- if (generic.IsEmpty())
- return generic;
- i::Handle<i::Object> obj = Utils::OpenHandle(*generic);
-@@ -1589,13 +1593,18 @@ Local<Script> Script::Compile(v8::Handle<String> source,
-
- Local<Script> Script::Compile(v8::Handle<String> source,
- v8::Handle<Value> file_name,
-- v8::Handle<String> script_data) {
-+ v8::Handle<String> script_data,
-+ v8::Script::CompileFlags compile_flags) {
- ScriptOrigin origin(file_name);
-- return Compile(source, &origin, 0, script_data);
-+ return Compile(source, &origin, 0, script_data, compile_flags);
- }
-
-
- Local<Value> Script::Run() {
-+ return Run(Handle<Object>());
-+}
-+
-+Local<Value> Script::Run(Handle<Object> qml) {
- i::Isolate* isolate = i::Isolate::Current();
- ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>());
- LOG_API(isolate, "Script::Run");
-@@ -1614,10 +1623,11 @@ Local<Value> Script::Run() {
- fun = i::Handle<i::JSFunction>(i::JSFunction::cast(*obj), isolate);
- }
- EXCEPTION_PREAMBLE(isolate);
-+ i::Handle<i::Object> qmlglobal = Utils::OpenHandle(*qml);
- i::Handle<i::Object> receiver(
- isolate->context()->global_proxy(), isolate);
- i::Handle<i::Object> result =
-- i::Execution::Call(fun, receiver, 0, NULL, &has_pending_exception);
-+ i::Execution::Call(fun, receiver, 0, NULL, &has_pending_exception, false, qmlglobal);
- EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
- raw_result = *result;
- }
-@@ -4337,6 +4347,30 @@ v8::Local<v8::Context> Context::GetCalling() {
- }
-
-
-+v8::Local<v8::Object> Context::GetCallingQmlGlobal() {
-+ i::Isolate* isolate = i::Isolate::Current();
-+ if (IsDeadCheck(isolate, "v8::Context::GetCallingQmlGlobal()")) {
-+ return Local<Object>();
-+ }
-+
-+ i::Context *context = isolate->context();
-+ if (!context->qml_global()->IsUndefined()) {
-+ i::Handle<i::Object> qmlglobal(context->qml_global());
-+ return Utils::ToLocal(i::Handle<i::JSObject>::cast(qmlglobal));
-+ }
-+
-+ i::JavaScriptFrameIterator it;
-+ if (it.done()) return Local<Object>();
-+ context = i::Context::cast(it.frame()->context());
-+ if (!context->qml_global()->IsUndefined()) {
-+ i::Handle<i::Object> qmlglobal(context->qml_global());
-+ return Utils::ToLocal(i::Handle<i::JSObject>::cast(qmlglobal));
-+ } else {
-+ return Local<Object>();
-+ }
-+}
-+
-+
- v8::Local<v8::Object> Context::Global() {
- if (IsDeadCheck(i::Isolate::Current(), "v8::Context::Global()")) {
- return Local<v8::Object>();
-diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc
-index cb3bc88..f5be938 100644
---- a/src/arm/code-stubs-arm.cc
-+++ b/src/arm/code-stubs-arm.cc
-@@ -172,6 +172,10 @@ void FastNewContextStub::Generate(MacroAssembler* masm) {
- __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
- __ str(r1, MemOperand(r0, Context::SlotOffset(Context::GLOBAL_INDEX)));
-
-+ // Copy the qml global object from the surrounding context.
-+ __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::QML_GLOBAL_INDEX)));
-+ __ str(r1, MemOperand(r0, Context::SlotOffset(Context::QML_GLOBAL_INDEX)));
-+
- // Initialize the rest of the slots to undefined.
- __ LoadRoot(r1, Heap::kUndefinedValueRootIndex);
- for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) {
-diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc
-index 497a295..b8e3f30 100644
---- a/src/arm/full-codegen-arm.cc
-+++ b/src/arm/full-codegen-arm.cc
-@@ -182,12 +182,13 @@ void FullCodeGenerator::Generate(CompilationInfo* info) {
-
- // Possibly allocate a local context.
- int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
-- if (heap_slots > 0) {
-+ if (heap_slots > 0 ||
-+ (scope()->is_qml_mode() && scope()->is_global_scope())) {
- Comment cmnt(masm_, "[ Allocate local context");
- // Argument to NewContext is the function, which is in r1.
- __ push(r1);
- if (heap_slots <= FastNewContextStub::kMaximumSlots) {
-- FastNewContextStub stub(heap_slots);
-+ FastNewContextStub stub((heap_slots < 0)?0:heap_slots);
- __ CallStub(&stub);
- } else {
- __ CallRuntime(Runtime::kNewFunctionContext, 1);
-@@ -1193,9 +1194,9 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var,
- __ bind(&fast);
- }
-
-- __ ldr(r0, GlobalObjectOperand());
-+ __ ldr(r0, var->is_qml_global()?QmlGlobalObjectOperand():GlobalObjectOperand());
- __ mov(r2, Operand(var->name()));
-- RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF)
-+ RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF || var->is_qml_global())
- ? RelocInfo::CODE_TARGET
- : RelocInfo::CODE_TARGET_CONTEXT;
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
-@@ -1280,10 +1281,10 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
- Comment cmnt(masm_, "Global variable");
- // Use inline caching. Variable name is passed in r2 and the global
- // object (receiver) in r0.
-- __ ldr(r0, GlobalObjectOperand());
-+ __ ldr(r0, var->is_qml_global()?QmlGlobalObjectOperand():GlobalObjectOperand());
- __ mov(r2, Operand(var->name()));
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
-- __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT);
-+ __ Call(ic, var->is_qml_global()?RelocInfo::CODE_TARGET:RelocInfo::CODE_TARGET_CONTEXT);
- context()->Plug(r0);
- break;
- }
-@@ -1920,7 +1921,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
- if (var->IsUnallocated()) {
- // Global var, const, or let.
- __ mov(r2, Operand(var->name()));
-- __ ldr(r1, GlobalObjectOperand());
-+ __ ldr(r1, var->is_qml_global()?QmlGlobalObjectOperand():GlobalObjectOperand());
- Handle<Code> ic = is_strict_mode()
- ? isolate()->builtins()->StoreIC_Initialize_Strict()
- : isolate()->builtins()->StoreIC_Initialize();
-@@ -2220,10 +2221,13 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag,
- FLAG_harmony_scoping ? kStrictMode : strict_mode_flag();
- __ mov(r1, Operand(Smi::FromInt(strict_mode)));
- __ push(r1);
-+ // Push the qml mode flag.
-+ __ mov(r1, Operand(Smi::FromInt(is_qml_mode())));
-+ __ push(r1);
-
- __ CallRuntime(flag == SKIP_CONTEXT_LOOKUP
- ? Runtime::kResolvePossiblyDirectEvalNoLookup
-- : Runtime::kResolvePossiblyDirectEval, 4);
-+ : Runtime::kResolvePossiblyDirectEval, 5);
- }
-
-
-@@ -2296,9 +2300,9 @@ void FullCodeGenerator::VisitCall(Call* expr) {
- context()->DropAndPlug(1, r0);
- } else if (proxy != NULL && proxy->var()->IsUnallocated()) {
- // Push global object as receiver for the call IC.
-- __ ldr(r0, GlobalObjectOperand());
-+ __ ldr(r0, proxy->var()->is_qml_global()?QmlGlobalObjectOperand():GlobalObjectOperand());
- __ push(r0);
-- EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT);
-+ EmitCallWithIC(expr, proxy->name(), proxy->var()->is_qml_global()?RelocInfo::CODE_TARGET:RelocInfo::CODE_TARGET_CONTEXT);
- } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
- // Call to a lookup slot (dynamically introduced variable).
- Label slow, done;
-@@ -3711,7 +3715,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
- // but "delete this" is allowed.
- ASSERT(strict_mode_flag() == kNonStrictMode || var->is_this());
- if (var->IsUnallocated()) {
-- __ ldr(r2, GlobalObjectOperand());
-+ __ ldr(r2, var->is_qml_global() ? QmlGlobalObjectOperand() : GlobalObjectOperand());
- __ mov(r1, Operand(var->name()));
- __ mov(r0, Operand(Smi::FromInt(kNonStrictMode)));
- __ Push(r2, r1, r0);
-@@ -3997,7 +4001,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
- VariableProxy* proxy = expr->AsVariableProxy();
- if (proxy != NULL && proxy->var()->IsUnallocated()) {
- Comment cmnt(masm_, "Global variable");
-- __ ldr(r0, GlobalObjectOperand());
-+ __ ldr(r0, proxy->var()->is_qml_global() ? QmlGlobalObjectOperand() : GlobalObjectOperand());
- __ mov(r2, Operand(proxy->name()));
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
- // Use a regular load, not a contextual load, to avoid a reference
-diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc
-index 5197842..943bc82 100644
---- a/src/arm/lithium-arm.cc
-+++ b/src/arm/lithium-arm.cc
-@@ -1128,7 +1128,7 @@ LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) {
-
- LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
- LOperand* context = UseRegisterAtStart(instr->value());
-- return DefineAsRegister(new LGlobalObject(context));
-+ return DefineAsRegister(new LGlobalObject(context, instr->qml_global()));
- }
-
-
-@@ -1198,7 +1198,7 @@ LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
-
- LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
- argument_count_ -= instr->argument_count();
-- return MarkAsCall(DefineFixed(new LCallGlobal, r0), instr);
-+ return MarkAsCall(DefineFixed(new LCallGlobal(instr->qml_global()), r0), instr);
- }
-
-
-diff --git a/src/arm/lithium-arm.h b/src/arm/lithium-arm.h
-index 5733bd0..a7e1704 100644
---- a/src/arm/lithium-arm.h
-+++ b/src/arm/lithium-arm.h
-@@ -1303,13 +1303,17 @@ class LOuterContext: public LTemplateInstruction<1, 1, 0> {
-
- class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
- public:
-- explicit LGlobalObject(LOperand* context) {
-+ explicit LGlobalObject(LOperand* context, bool qml_global) {
- inputs_[0] = context;
-+ qml_global_ = qml_global;
- }
-
- DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
-
- LOperand* context() { return InputAt(0); }
-+ bool qml_global() { return qml_global_; }
-+ private:
-+ bool qml_global_;
- };
-
-
-@@ -1396,10 +1400,16 @@ class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
- DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
- DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
-
-+ explicit LCallGlobal(bool qml_global) : qml_global_(qml_global) {}
-+
- virtual void PrintDataTo(StringStream* stream);
-
- Handle<String> name() const {return hydrogen()->name(); }
- int arity() const { return hydrogen()->argument_count() - 1; }
-+
-+ bool qml_global() { return qml_global_; }
-+ private:
-+ bool qml_global_;
- };
-
-
-diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
-index 4cf7df4..2e1e6fa 100644
---- a/src/arm/lithium-codegen-arm.cc
-+++ b/src/arm/lithium-codegen-arm.cc
-@@ -190,12 +190,13 @@ bool LCodeGen::GeneratePrologue() {
-
- // Possibly allocate a local context.
- int heap_slots = scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
-- if (heap_slots > 0) {
-+ if (heap_slots > 0 ||
-+ (scope()->is_qml_mode() && scope()->is_global_scope())) {
- Comment(";;; Allocate local context");
- // Argument to NewContext is the function, which is in r1.
- __ push(r1);
- if (heap_slots <= FastNewContextStub::kMaximumSlots) {
-- FastNewContextStub stub(heap_slots);
-+ FastNewContextStub stub((heap_slots < 0)?0:heap_slots);
- __ CallStub(&stub);
- } else {
- __ CallRuntime(Runtime::kNewFunctionContext, 1);
-@@ -2826,7 +2827,7 @@ void LCodeGen::DoOuterContext(LOuterContext* instr) {
-
- void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
- Register result = ToRegister(instr->result());
-- __ ldr(result, ContextOperand(cp, Context::GLOBAL_INDEX));
-+ __ ldr(result, ContextOperand(cp, instr->qml_global()?Context::QML_GLOBAL_INDEX:Context::GLOBAL_INDEX));
- }
-
-
-@@ -3280,7 +3281,7 @@ void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
- ASSERT(ToRegister(instr->result()).is(r0));
-
- int arity = instr->arity();
-- RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT;
-+ RelocInfo::Mode mode = instr->qml_global()?RelocInfo::CODE_TARGET:RelocInfo::CODE_TARGET_CONTEXT;
- Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arity, mode);
- __ mov(r2, Operand(instr->name()));
-diff --git a/src/arm/macro-assembler-arm.h b/src/arm/macro-assembler-arm.h
-index 90c4b37..5947e6a 100644
---- a/src/arm/macro-assembler-arm.h
-+++ b/src/arm/macro-assembler-arm.h
-@@ -1326,6 +1326,11 @@ static inline MemOperand GlobalObjectOperand() {
- }
-
-
-+static inline MemOperand QmlGlobalObjectOperand() {
-+ return ContextOperand(cp, Context::QML_GLOBAL_INDEX);
-+}
-+
-+
- #ifdef GENERATED_CODE_COVERAGE
- #define CODE_COVERAGE_STRINGIFY(x) #x
- #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x)
-diff --git a/src/ast-inl.h b/src/ast-inl.h
-index f8b460d..217c71f 100644
---- a/src/ast-inl.h
-+++ b/src/ast-inl.h
-@@ -126,6 +126,11 @@ StrictModeFlag FunctionLiteral::strict_mode_flag() const {
- }
-
-
-+bool FunctionLiteral::qml_mode() const {
-+ return scope()->is_qml_mode();
-+}
-+
-+
- } } // namespace v8::internal
-
- #endif // V8_AST_INL_H_
-diff --git a/src/ast.cc b/src/ast.cc
-index 9e34bc0..0dc3c1c 100644
---- a/src/ast.cc
-+++ b/src/ast.cc
-@@ -764,6 +764,11 @@ void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle,
- is_monomorphic_ = oracle->CallIsMonomorphic(this);
- Property* property = expression()->AsProperty();
- if (property == NULL) {
-+ if (VariableProxy *proxy = expression()->AsVariableProxy()) {
-+ if (proxy->var()->is_qml_global())
-+ return;
-+ }
-+
- // Function call. Specialize for monomorphic calls.
- if (is_monomorphic_) target_ = oracle->GetCallTarget(this);
- } else {
-diff --git a/src/ast.h b/src/ast.h
-index 3de00ef..8920b50 100644
---- a/src/ast.h
-+++ b/src/ast.h
-@@ -1653,6 +1653,7 @@ class FunctionLiteral: public Expression {
- bool is_anonymous() const { return is_anonymous_; }
- bool strict_mode() const { return strict_mode_flag() == kStrictMode; }
- StrictModeFlag strict_mode_flag() const;
-+ bool qml_mode() const;
-
- int materialized_literal_count() { return materialized_literal_count_; }
- int expected_property_count() { return expected_property_count_; }
-diff --git a/src/code-stubs.h b/src/code-stubs.h
-index fc7000b..4380764 100644
---- a/src/code-stubs.h
-+++ b/src/code-stubs.h
-@@ -326,7 +326,7 @@ class FastNewContextStub : public CodeStub {
- static const int kMaximumSlots = 64;
-
- explicit FastNewContextStub(int slots) : slots_(slots) {
-- ASSERT(slots_ > 0 && slots_ <= kMaximumSlots);
-+ ASSERT(slots_ >= 0 && slots <= kMaximumSlots);
- }
-
- void Generate(MacroAssembler* masm);
-diff --git a/src/compiler.cc b/src/compiler.cc
-index 88db467..4902e72 100644
---- a/src/compiler.cc
-+++ b/src/compiler.cc
-@@ -447,7 +447,8 @@ Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source,
- v8::Extension* extension,
- ScriptDataImpl* input_pre_data,
- Handle<Object> script_data,
-- NativesFlag natives) {
-+ NativesFlag natives,
-+ v8::Script::CompileFlags compile_flags) {
- Isolate* isolate = source->GetIsolate();
- int source_length = source->length();
- isolate->counters()->total_load_size()->Increment(source_length);
-@@ -515,6 +516,7 @@ Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source,
- info.MarkAsGlobal();
- info.SetExtension(extension);
- info.SetPreParseData(pre_data);
-+ if (compile_flags & v8::Script::QmlMode) info.MarkAsQmlMode();
- result = MakeFunctionInfo(&info);
- if (extension == NULL && !result.is_null()) {
- compilation_cache->PutScript(source, result);
-@@ -534,7 +536,8 @@ Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source,
- Handle<SharedFunctionInfo> Compiler::CompileEval(Handle<String> source,
- Handle<Context> context,
- bool is_global,
-- StrictModeFlag strict_mode) {
-+ StrictModeFlag strict_mode,
-+ bool qml_mode) {
- Isolate* isolate = source->GetIsolate();
- int source_length = source->length();
- isolate->counters()->total_eval_size()->Increment(source_length);
-@@ -559,6 +562,7 @@ Handle<SharedFunctionInfo> Compiler::CompileEval(Handle<String> source,
- info.MarkAsEval();
- if (is_global) info.MarkAsGlobal();
- info.SetStrictModeFlag(strict_mode);
-+ if (qml_mode) info.MarkAsQmlMode();
- info.SetCallingContext(context);
- result = MakeFunctionInfo(&info);
- if (!result.is_null()) {
-@@ -606,6 +610,12 @@ bool Compiler::CompileLazy(CompilationInfo* info) {
- info->SetStrictModeFlag(strict_mode);
- shared->set_strict_mode_flag(strict_mode);
-
-+ // After parsing we know function's qml mode. Remember it.
-+ if (info->function()->qml_mode()) {
-+ shared->set_qml_mode(true);
-+ info->MarkAsQmlMode();
-+ }
-+
- // Compile the code.
- if (!MakeCode(info)) {
- if (!isolate->has_pending_exception()) {
-@@ -751,6 +761,7 @@ void Compiler::SetFunctionInfo(Handle<SharedFunctionInfo> function_info,
- *lit->this_property_assignments());
- function_info->set_allows_lazy_compilation(lit->AllowsLazyCompilation());
- function_info->set_strict_mode_flag(lit->strict_mode_flag());
-+ function_info->set_qml_mode(lit->qml_mode());
- function_info->set_uses_arguments(lit->scope()->arguments() != NULL);
- function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters());
- }
-diff --git a/src/compiler.h b/src/compiler.h
-index bedf5ee..054e3b9 100644
---- a/src/compiler.h
-+++ b/src/compiler.h
-@@ -57,6 +57,7 @@ class CompilationInfo BASE_EMBEDDED {
- return StrictModeFlagField::decode(flags_);
- }
- bool is_in_loop() const { return IsInLoop::decode(flags_); }
-+ bool is_qml_mode() const { return IsQmlMode::decode(flags_); }
- FunctionLiteral* function() const { return function_; }
- Scope* scope() const { return scope_; }
- Handle<Code> code() const { return code_; }
-@@ -85,6 +86,9 @@ class CompilationInfo BASE_EMBEDDED {
- ASSERT(is_lazy());
- flags_ |= IsInLoop::encode(true);
- }
-+ void MarkAsQmlMode() {
-+ flags_ |= IsQmlMode::encode(true);
-+ }
- void MarkAsNative() {
- flags_ |= IsNative::encode(true);
- }
-@@ -192,6 +196,9 @@ class CompilationInfo BASE_EMBEDDED {
- ASSERT(strict_mode_flag() == kNonStrictMode);
- SetStrictModeFlag(shared_info_->strict_mode_flag());
- }
-+ if (!shared_info_.is_null() && shared_info_->qml_mode()) {
-+ MarkAsQmlMode();
-+ }
- }
-
- void SetMode(Mode mode) {
-@@ -218,7 +225,8 @@ class CompilationInfo BASE_EMBEDDED {
- // If compiling for debugging produce just full code matching the
- // initial mode setting.
- class IsCompilingForDebugging: public BitField<bool, 8, 1> {};
--
-+ // Qml mode
-+ class IsQmlMode: public BitField<bool, 9, 1> {};
-
- unsigned flags_;
-
-@@ -283,13 +291,15 @@ class Compiler : public AllStatic {
- v8::Extension* extension,
- ScriptDataImpl* pre_data,
- Handle<Object> script_data,
-- NativesFlag is_natives_code);
-+ NativesFlag is_natives_code,
-+ v8::Script::CompileFlags = v8::Script::Default);
-
- // Compile a String source within a context for Eval.
- static Handle<SharedFunctionInfo> CompileEval(Handle<String> source,
- Handle<Context> context,
- bool is_global,
-- StrictModeFlag strict_mode);
-+ StrictModeFlag strict_mode,
-+ bool qml_mode);
-
- // Compile from function info (used for lazy compilation). Returns true on
- // success and false if the compilation resulted in a stack overflow.
-diff --git a/src/contexts.cc b/src/contexts.cc
-index b25ffac..3129af0 100644
---- a/src/contexts.cc
-+++ b/src/contexts.cc
-@@ -103,6 +103,9 @@ Handle<Object> Context::Lookup(Handle<String> name,
- PrintF(")\n");
- }
-
-+ Handle<JSObject> qml_global;
-+ Handle<JSObject> qml_global_global;
-+
- do {
- if (FLAG_trace_contexts) {
- PrintF(" - looking in context %p", reinterpret_cast<void*>(*context));
-@@ -110,6 +113,11 @@ Handle<Object> Context::Lookup(Handle<String> name,
- PrintF("\n");
- }
-
-+ if (qml_global.is_null() && !context->qml_global()->IsUndefined()) {
-+ qml_global = Handle<JSObject>(context->qml_global(), isolate);
-+ qml_global_global = Handle<JSObject>(context->global(), isolate);
-+ }
-+
- // 1. Check global objects, subjects of with, and extension objects.
- if (context->IsGlobalContext() ||
- context->IsWithContext() ||
-@@ -228,6 +236,33 @@ Handle<Object> Context::Lookup(Handle<String> name,
- }
- } while (follow_context_chain);
-
-+ if (!qml_global.is_null()) {
-+ if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0) {
-+ *attributes = qml_global_global->GetLocalPropertyAttribute(*name);
-+ } else {
-+ *attributes = qml_global_global->GetPropertyAttribute(*name);
-+ }
-+
-+ if (*attributes != ABSENT) {
-+ *attributes = ABSENT;
-+ } else {
-+ if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0) {
-+ *attributes = qml_global->GetLocalPropertyAttribute(*name);
-+ } else {
-+ *attributes = qml_global->GetPropertyAttribute(*name);
-+ }
-+
-+ if (*attributes != ABSENT) {
-+ // property found
-+ if (FLAG_trace_contexts) {
-+ PrintF("=> found property in qml global object %p\n",
-+ reinterpret_cast<void*>(*qml_global));
-+ }
-+ return qml_global;
-+ }
-+ }
-+ }
-+
- if (FLAG_trace_contexts) {
- PrintF("=> no property/slot found\n");
- }
-diff --git a/src/contexts.h b/src/contexts.h
-index 7021ff8..c3cfeee 100644
---- a/src/contexts.h
-+++ b/src/contexts.h
-@@ -218,6 +218,7 @@ class Context: public FixedArray {
- // (with contexts), or the variable name (catch contexts), the serialized
- // scope info (block contexts).
- EXTENSION_INDEX,
-+ QML_GLOBAL_INDEX,
- GLOBAL_INDEX,
- MIN_CONTEXT_SLOTS,
-
-@@ -321,6 +322,9 @@ class Context: public FixedArray {
- }
- void set_global(GlobalObject* global) { set(GLOBAL_INDEX, global); }
-
-+ JSObject *qml_global() { return reinterpret_cast<JSObject *>(get(QML_GLOBAL_INDEX)); }
-+ void set_qml_global(JSObject *qml_global) { set(QML_GLOBAL_INDEX, qml_global); }
-+
- // Returns a JSGlobalProxy object or null.
- JSObject* global_proxy();
- void set_global_proxy(JSObject* global);
-diff --git a/src/execution.cc b/src/execution.cc
-index 29955fa..4261ac2 100644
---- a/src/execution.cc
-+++ b/src/execution.cc
-@@ -71,7 +71,8 @@ static Handle<Object> Invoke(bool is_construct,
- Handle<Object> receiver,
- int argc,
- Handle<Object> args[],
-- bool* has_pending_exception) {
-+ bool* has_pending_exception,
-+ Handle<Object> qml) {
- Isolate* isolate = function->GetIsolate();
-
- // Entering JavaScript.
-@@ -102,6 +103,12 @@ static Handle<Object> Invoke(bool is_construct,
- // make the current one is indeed a global object.
- ASSERT(function->context()->global()->IsGlobalObject());
-
-+ Handle<JSObject> oldqml;
-+ if (!qml.is_null()) {
-+ oldqml = Handle<JSObject>(function->context()->qml_global());
-+ function->context()->set_qml_global(JSObject::cast(*qml));
-+ }
-+
- {
- // Save and restore context around invocation and block the
- // allocation of handles without explicit handle scopes.
-@@ -118,6 +125,9 @@ static Handle<Object> Invoke(bool is_construct,
- CALL_GENERATED_CODE(stub_entry, function_entry, func, recv, argc, argv);
- }
-
-+ if (!qml.is_null())
-+ function->context()->set_qml_global(*oldqml);
-+
- #ifdef DEBUG
- value->Verify();
- #endif
-@@ -146,7 +156,18 @@ Handle<Object> Execution::Call(Handle<Object> callable,
- int argc,
- Handle<Object> argv[],
- bool* pending_exception,
-- bool convert_receiver) {
-+ bool convert_receiver)
-+{
-+ return Call(callable, receiver, argc, argv, pending_exception, convert_receiver, Handle<Object>());
-+}
-+
-+Handle<Object> Execution::Call(Handle<Object> callable,
-+ Handle<Object> receiver,
-+ int argc,
-+ Handle<Object> argv[],
-+ bool* pending_exception,
-+ bool convert_receiver,
-+ Handle<Object> qml) {
- *pending_exception = false;
-
- if (!callable->IsJSFunction()) {
-@@ -170,7 +191,7 @@ Handle<Object> Execution::Call(Handle<Object> callable,
- if (*pending_exception) return callable;
- }
-
-- return Invoke(false, func, receiver, argc, argv, pending_exception);
-+ return Invoke(false, func, receiver, argc, argv, pending_exception, qml);
- }
-
-
-@@ -179,7 +200,7 @@ Handle<Object> Execution::New(Handle<JSFunction> func,
- Handle<Object> argv[],
- bool* pending_exception) {
- return Invoke(true, func, Isolate::Current()->global(), argc, argv,
-- pending_exception);
-+ pending_exception, Handle<Object>());
- }
-
-
-@@ -198,7 +219,7 @@ Handle<Object> Execution::TryCall(Handle<JSFunction> func,
- *caught_exception = false;
-
- Handle<Object> result = Invoke(false, func, receiver, argc, args,
-- caught_exception);
-+ caught_exception, Handle<Object>());
-
- if (*caught_exception) {
- ASSERT(catcher.HasCaught());
-diff --git a/src/execution.h b/src/execution.h
-index f2d17d0..532e5d8 100644
---- a/src/execution.h
-+++ b/src/execution.h
-@@ -65,6 +65,14 @@ class Execution : public AllStatic {
- bool* pending_exception,
- bool convert_receiver = false);
-
-+ static Handle<Object> Call(Handle<Object> callable,
-+ Handle<Object> receiver,
-+ int argc,
-+ Handle<Object> argv[],
-+ bool* pending_exception,
-+ bool convert_receiver,
-+ Handle<Object> qml);
-+
- // Construct object from function, the caller supplies an array of
- // arguments. Arguments are Object* type. After function returns,
- // pointers in 'args' might be invalid.
-diff --git a/src/full-codegen.cc b/src/full-codegen.cc
-index 27c509f..f099d25 100644
---- a/src/full-codegen.cc
-+++ b/src/full-codegen.cc
-@@ -513,7 +513,7 @@ void FullCodeGenerator::VisitDeclarations(
- // Batch declare global functions and variables.
- if (global_count > 0) {
- Handle<FixedArray> array =
-- isolate()->factory()->NewFixedArray(2 * global_count, TENURED);
-+ isolate()->factory()->NewFixedArray(3 * global_count, TENURED);
- for (int j = 0, i = 0; i < length; i++) {
- Declaration* decl = declarations->at(i);
- Variable* var = decl->proxy()->var();
-@@ -537,6 +537,7 @@ void FullCodeGenerator::VisitDeclarations(
- }
- array->set(j++, *function);
- }
-+ array->set(j++, Smi::FromInt(var->is_qml_global()));
- }
- }
- // Invoke the platform-dependent code generator to do the actual
-diff --git a/src/full-codegen.h b/src/full-codegen.h
-index 9132502..78e6089 100644
---- a/src/full-codegen.h
-+++ b/src/full-codegen.h
-@@ -583,6 +583,7 @@ class FullCodeGenerator: public AstVisitor {
- StrictModeFlag strict_mode_flag() {
- return function()->strict_mode_flag();
- }
-+ bool is_qml_mode() { return function()->qml_mode(); }
- FunctionLiteral* function() { return info_->function(); }
- Scope* scope() { return scope_; }
-
-diff --git a/src/heap.cc b/src/heap.cc
-index 53a0f27..881a876 100644
---- a/src/heap.cc
-+++ b/src/heap.cc
-@@ -4355,6 +4355,7 @@ MaybeObject* Heap::AllocateFunctionContext(int length, JSFunction* function) {
- context->set_previous(function->context());
- context->set_extension(NULL);
- context->set_global(function->context()->global());
-+ context->set_qml_global(function->context()->qml_global());
- return context;
- }
-
-@@ -4375,6 +4376,7 @@ MaybeObject* Heap::AllocateCatchContext(JSFunction* function,
- context->set_previous(previous);
- context->set_extension(name);
- context->set_global(previous->global());
-+ context->set_qml_global(previous->qml_global());
- context->set(Context::THROWN_OBJECT_INDEX, thrown_object);
- return context;
- }
-@@ -4393,6 +4395,7 @@ MaybeObject* Heap::AllocateWithContext(JSFunction* function,
- context->set_previous(previous);
- context->set_extension(extension);
- context->set_global(previous->global());
-+ context->set_qml_global(previous->qml_global());
- return context;
- }
-
-@@ -4411,6 +4414,7 @@ MaybeObject* Heap::AllocateBlockContext(JSFunction* function,
- context->set_previous(previous);
- context->set_extension(scope_info);
- context->set_global(previous->global());
-+ context->set_qml_global(previous->qml_global());
- return context;
- }
-
-diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
-index 6f46509..ac9728c 100644
---- a/src/hydrogen-instructions.cc
-+++ b/src/hydrogen-instructions.cc
-@@ -655,6 +655,11 @@ void HCallNamed::PrintDataTo(StringStream* stream) {
- }
-
-
-+void HGlobalObject::PrintDataTo(StringStream* stream) {
-+ stream->Add("qml_global: %s ", qml_global()?"true":"false");
-+ HUnaryOperation::PrintDataTo(stream);
-+}
-+
- void HCallGlobal::PrintDataTo(StringStream* stream) {
- stream->Add("%o ", *name());
- HUnaryCall::PrintDataTo(stream);
-diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
-index 65fc4df..ebf0030 100644
---- a/src/hydrogen-instructions.h
-+++ b/src/hydrogen-instructions.h
-@@ -1410,19 +1410,30 @@ class HOuterContext: public HUnaryOperation {
-
- class HGlobalObject: public HUnaryOperation {
- public:
-- explicit HGlobalObject(HValue* context) : HUnaryOperation(context) {
-+ explicit HGlobalObject(HValue* context) : HUnaryOperation(context), qml_global_(false) {
- set_representation(Representation::Tagged());
- SetFlag(kUseGVN);
- }
-
-+ virtual void PrintDataTo(StringStream* stream);
-+
- DECLARE_CONCRETE_INSTRUCTION(GlobalObject)
-
- virtual Representation RequiredInputRepresentation(int index) {
- return Representation::Tagged();
- }
-
-+ bool qml_global() { return qml_global_; }
-+ void set_qml_global(bool v) { qml_global_ = v; }
-+
- protected:
-- virtual bool DataEquals(HValue* other) { return true; }
-+ virtual bool DataEquals(HValue* other) {
-+ HGlobalObject* o = HGlobalObject::cast(other);
-+ return o->qml_global_ == qml_global_;
-+ }
-+
-+ private:
-+ bool qml_global_;
- };
-
-
-@@ -1601,7 +1612,7 @@ class HCallFunction: public HUnaryCall {
- class HCallGlobal: public HUnaryCall {
- public:
- HCallGlobal(HValue* context, Handle<String> name, int argument_count)
-- : HUnaryCall(context, argument_count), name_(name) {
-+ : HUnaryCall(context, argument_count), name_(name), qml_global_(false) {
- }
-
- virtual void PrintDataTo(StringStream* stream);
-@@ -1613,10 +1624,14 @@ class HCallGlobal: public HUnaryCall {
- return Representation::Tagged();
- }
-
-+ bool qml_global() { return qml_global_; }
-+ void set_qml_global(bool v) { qml_global_ = v; }
-+
- DECLARE_CONCRETE_INSTRUCTION(CallGlobal)
-
- private:
- Handle<String> name_;
-+ bool qml_global_;
- };
-
-
-diff --git a/src/hydrogen.cc b/src/hydrogen.cc
-index 3a4d172..0a7fad1 100644
---- a/src/hydrogen.cc
-+++ b/src/hydrogen.cc
-@@ -3185,6 +3185,7 @@ void HGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
- } else {
- HValue* context = environment()->LookupContext();
- HGlobalObject* global_object = new(zone()) HGlobalObject(context);
-+ if (variable->is_qml_global()) global_object->set_qml_global(true);
- AddInstruction(global_object);
- HLoadGlobalGeneric* instr =
- new(zone()) HLoadGlobalGeneric(context,
-@@ -3644,6 +3645,7 @@ void HGraphBuilder::HandleGlobalVariableAssignment(Variable* var,
- } else {
- HValue* context = environment()->LookupContext();
- HGlobalObject* global_object = new(zone()) HGlobalObject(context);
-+ if (var->is_qml_global()) global_object->set_qml_global(true);
- AddInstruction(global_object);
- HStoreGlobalGeneric* instr =
- new(zone()) HStoreGlobalGeneric(context,
-@@ -5106,11 +5108,13 @@ void HGraphBuilder::VisitCall(Call* expr) {
- } else {
- HValue* context = environment()->LookupContext();
- HGlobalObject* receiver = new(zone()) HGlobalObject(context);
-+ if (var->is_qml_global()) receiver->set_qml_global(true);
- AddInstruction(receiver);
- PushAndAdd(new(zone()) HPushArgument(receiver));
- CHECK_ALIVE(VisitArgumentList(expr->arguments()));
-
- call = new(zone()) HCallGlobal(context, var->name(), argument_count);
-+ if (var->is_qml_global()) static_cast<HCallGlobal*>(call)->set_qml_global(true);
- Drop(argument_count);
- }
-
-diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc
-index 37b519a..8a94a06 100644
---- a/src/ia32/code-stubs-ia32.cc
-+++ b/src/ia32/code-stubs-ia32.cc
-@@ -144,6 +144,11 @@ void FastNewContextStub::Generate(MacroAssembler* masm) {
- __ mov(ebx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
- __ mov(Operand(eax, Context::SlotOffset(Context::GLOBAL_INDEX)), ebx);
-
-+ // Copy the qml global object from the previous context.
-+ __ mov(ebx, Operand(esi, Context::SlotOffset(Context::QML_GLOBAL_INDEX)));
-+ __ mov(Operand(eax, Context::SlotOffset(Context::QML_GLOBAL_INDEX)), ebx);
-+
-+
- // Initialize the rest of the slots to undefined.
- __ mov(ebx, factory->undefined_value());
- for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) {
-diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
-index 25588c8..9cee4a3 100644
---- a/src/ia32/full-codegen-ia32.cc
-+++ b/src/ia32/full-codegen-ia32.cc
-@@ -178,12 +178,13 @@ void FullCodeGenerator::Generate(CompilationInfo* info) {
-
- // Possibly allocate a local context.
- int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
-- if (heap_slots > 0) {
-+ if (heap_slots > 0 ||
-+ (scope()->is_qml_mode() && scope()->is_global_scope())) {
- Comment cmnt(masm_, "[ Allocate local context");
- // Argument to NewContext is the function, which is still in edi.
- __ push(edi);
- if (heap_slots <= FastNewContextStub::kMaximumSlots) {
-- FastNewContextStub stub(heap_slots);
-+ FastNewContextStub stub((heap_slots < 0)?0:heap_slots);
- __ CallStub(&stub);
- } else {
- __ CallRuntime(Runtime::kNewFunctionContext, 1);
-@@ -1179,10 +1180,10 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var,
-
- // All extension objects were empty and it is safe to use a global
- // load IC call.
-- __ mov(eax, GlobalObjectOperand());
-+ __ mov(eax, var->is_qml_global()?QmlGlobalObjectOperand():GlobalObjectOperand());
- __ mov(ecx, var->name());
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
-- RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF)
-+ RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF || var->is_qml_global())
- ? RelocInfo::CODE_TARGET
- : RelocInfo::CODE_TARGET_CONTEXT;
- __ call(ic, mode);
-@@ -1263,10 +1264,10 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
- Comment cmnt(masm_, "Global variable");
- // Use inline caching. Variable name is passed in ecx and the global
- // object in eax.
-- __ mov(eax, GlobalObjectOperand());
-+ __ mov(eax, var->is_qml_global()?QmlGlobalObjectOperand():GlobalObjectOperand());
- __ mov(ecx, var->name());
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
-- __ call(ic, RelocInfo::CODE_TARGET_CONTEXT);
-+ __ call(ic, var->is_qml_global()?RelocInfo::CODE_TARGET:RelocInfo::CODE_TARGET_CONTEXT);
- context()->Plug(eax);
- break;
- }
-@@ -1920,7 +1921,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
- if (var->IsUnallocated()) {
- // Global var, const, or let.
- __ mov(ecx, var->name());
-- __ mov(edx, GlobalObjectOperand());
-+ __ mov(edx, var->is_qml_global()?QmlGlobalObjectOperand():GlobalObjectOperand());
- Handle<Code> ic = is_strict_mode()
- ? isolate()->builtins()->StoreIC_Initialize_Strict()
- : isolate()->builtins()->StoreIC_Initialize();
-@@ -2235,9 +2236,12 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag,
- FLAG_harmony_scoping ? kStrictMode : strict_mode_flag();
- __ push(Immediate(Smi::FromInt(strict_mode)));
-
-+ // Push the qml mode flag
-+ __ push(Immediate(Smi::FromInt(is_qml_mode())));
-+
- __ CallRuntime(flag == SKIP_CONTEXT_LOOKUP
- ? Runtime::kResolvePossiblyDirectEvalNoLookup
-- : Runtime::kResolvePossiblyDirectEval, 4);
-+ : Runtime::kResolvePossiblyDirectEval, 5);
- }
-
-
-@@ -2308,9 +2312,9 @@ void FullCodeGenerator::VisitCall(Call* expr) {
-
- } else if (proxy != NULL && proxy->var()->IsUnallocated()) {
- // Push global object as receiver for the call IC.
-- __ push(GlobalObjectOperand());
-+ __ push(proxy->var()->is_qml_global()?QmlGlobalObjectOperand():GlobalObjectOperand());
- increment_stack_height();
-- EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT);
-+ EmitCallWithIC(expr, proxy->name(), proxy->var()->is_qml_global()?RelocInfo::CODE_TARGET:RelocInfo::CODE_TARGET_CONTEXT);
-
- } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
- // Call to a lookup slot (dynamically introduced variable).
-@@ -3777,7 +3781,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
- // but "delete this" is allowed.
- ASSERT(strict_mode_flag() == kNonStrictMode || var->is_this());
- if (var->IsUnallocated()) {
-- __ push(GlobalObjectOperand());
-+ __ push(var->is_qml_global() ? QmlGlobalObjectOperand() : GlobalObjectOperand());
- __ push(Immediate(var->name()));
- __ push(Immediate(Smi::FromInt(kNonStrictMode)));
- __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
-@@ -4085,7 +4089,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
-
- if (proxy != NULL && proxy->var()->IsUnallocated()) {
- Comment cmnt(masm_, "Global variable");
-- __ mov(eax, GlobalObjectOperand());
-+ __ mov(eax, proxy->var()->is_qml_global() ? QmlGlobalObjectOperand() : GlobalObjectOperand());
- __ mov(ecx, Immediate(proxy->name()));
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
- // Use a regular load, not a contextual load, to avoid a reference
-diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc
-index d4cbbce..b381227 100644
---- a/src/ia32/lithium-codegen-ia32.cc
-+++ b/src/ia32/lithium-codegen-ia32.cc
-@@ -211,12 +211,13 @@ bool LCodeGen::GeneratePrologue() {
-
- // Possibly allocate a local context.
- int heap_slots = scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
-- if (heap_slots > 0) {
-+ if (heap_slots > 0 ||
-+ (scope()->is_qml_mode() && scope()->is_global_scope())) {
- Comment(";;; Allocate local context");
- // Argument to NewContext is the function, which is still in edi.
- __ push(edi);
- if (heap_slots <= FastNewContextStub::kMaximumSlots) {
-- FastNewContextStub stub(heap_slots);
-+ FastNewContextStub stub((heap_slots < 0)?0:heap_slots);
- __ CallStub(&stub);
- } else {
- __ CallRuntime(Runtime::kNewFunctionContext, 1);
-@@ -2661,7 +2662,7 @@ void LCodeGen::DoOuterContext(LOuterContext* instr) {
- void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
- Register context = ToRegister(instr->context());
- Register result = ToRegister(instr->result());
-- __ mov(result, Operand(context, Context::SlotOffset(Context::GLOBAL_INDEX)));
-+ __ mov(result, Operand(context, Context::SlotOffset(instr->qml_global()?Context::QML_GLOBAL_INDEX:Context::GLOBAL_INDEX)));
- }
-
-
-@@ -3131,7 +3132,7 @@ void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
- ASSERT(ToRegister(instr->result()).is(eax));
-
- int arity = instr->arity();
-- RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT;
-+ RelocInfo::Mode mode = instr->qml_global()?RelocInfo::CODE_TARGET:RelocInfo::CODE_TARGET_CONTEXT;
- Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arity, mode);
- __ mov(ecx, instr->name());
-diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc
-index 626f899..d09d55f 100644
---- a/src/ia32/lithium-ia32.cc
-+++ b/src/ia32/lithium-ia32.cc
-@@ -1144,7 +1144,7 @@ LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) {
-
- LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
- LOperand* context = UseRegisterAtStart(instr->value());
-- return DefineAsRegister(new LGlobalObject(context));
-+ return DefineAsRegister(new LGlobalObject(context, instr->qml_global()));
- }
-
-
-@@ -1228,7 +1228,7 @@ LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
- LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
- LOperand* context = UseFixed(instr->context(), esi);
- argument_count_ -= instr->argument_count();
-- LCallGlobal* result = new LCallGlobal(context);
-+ LCallGlobal* result = new LCallGlobal(context, instr->qml_global());
- return MarkAsCall(DefineFixed(result, eax), instr);
- }
-
-diff --git a/src/ia32/lithium-ia32.h b/src/ia32/lithium-ia32.h
-index 5f23afa..22541c8 100644
---- a/src/ia32/lithium-ia32.h
-+++ b/src/ia32/lithium-ia32.h
-@@ -1338,13 +1338,17 @@ class LOuterContext: public LTemplateInstruction<1, 1, 0> {
-
- class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
- public:
-- explicit LGlobalObject(LOperand* context) {
-+ explicit LGlobalObject(LOperand* context, bool qml_global) {
- inputs_[0] = context;
-+ qml_global_ = qml_global;
- }
-
- DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
-
- LOperand* context() { return InputAt(0); }
-+ bool qml_global() { return qml_global_; }
-+ private:
-+ bool qml_global_;
- };
-
-
-@@ -1443,7 +1447,7 @@ class LCallFunction: public LTemplateInstruction<1, 1, 0> {
-
- class LCallGlobal: public LTemplateInstruction<1, 1, 0> {
- public:
-- explicit LCallGlobal(LOperand* context) {
-+ explicit LCallGlobal(LOperand* context, bool qml_global) : qml_global_(qml_global) {
- inputs_[0] = context;
- }
-
-@@ -1455,6 +1459,10 @@ class LCallGlobal: public LTemplateInstruction<1, 1, 0> {
- LOperand* context() { return inputs_[0]; }
- Handle<String> name() const {return hydrogen()->name(); }
- int arity() const { return hydrogen()->argument_count() - 1; }
-+
-+ bool qml_global() { return qml_global_; }
-+ private:
-+ bool qml_global_;
- };
-
-
-diff --git a/src/ia32/macro-assembler-ia32.h b/src/ia32/macro-assembler-ia32.h
-index 8528c55..de3c3a0 100644
---- a/src/ia32/macro-assembler-ia32.h
-+++ b/src/ia32/macro-assembler-ia32.h
-@@ -935,6 +935,9 @@ static inline Operand GlobalObjectOperand() {
- return ContextOperand(esi, Context::GLOBAL_INDEX);
- }
-
-+static inline Operand QmlGlobalObjectOperand() {
-+ return ContextOperand(esi, Context::QML_GLOBAL_INDEX);
-+}
-
- // Generates an Operand for saving parameters after PrepareCallApiFunction.
- Operand ApiParameterOperand(int index);
-diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
-index 85e929d..a534b78 100644
---- a/src/mips/code-stubs-mips.cc
-+++ b/src/mips/code-stubs-mips.cc
-@@ -173,6 +173,11 @@ void FastNewContextStub::Generate(MacroAssembler* masm) {
- __ lw(a1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
- __ sw(a1, MemOperand(v0, Context::SlotOffset(Context::GLOBAL_INDEX)));
-
-+ // Copy the qml global object from the surrounding context.
-+ __ lw(a1, MemOperand(cp, Context::SlotOffset(Context::QML_GLOBAL_INDEX)));
-+ __ sw(a1, MemOperand(v0, Context::SlotOffset(Context::QML_GLOBAL_INDEX)));
-+
-+
- // Initialize the rest of the slots to undefined.
- __ LoadRoot(a1, Heap::kUndefinedValueRootIndex);
- for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) {
-diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc
-index 2f989bc..b6bd407 100644
---- a/src/mips/full-codegen-mips.cc
-+++ b/src/mips/full-codegen-mips.cc
-@@ -191,12 +191,13 @@ void FullCodeGenerator::Generate(CompilationInfo* info) {
-
- // Possibly allocate a local context.
- int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
-- if (heap_slots > 0) {
-+ if (heap_slots > 0 ||
-+ (scope()->is_qml_mode() && scope()->is_global_scope())) {
- Comment cmnt(masm_, "[ Allocate local context");
- // Argument to NewContext is the function, which is in a1.
- __ push(a1);
- if (heap_slots <= FastNewContextStub::kMaximumSlots) {
-- FastNewContextStub stub(heap_slots);
-+ FastNewContextStub stub((heap_slots < 0)?0:heap_slots);
- __ CallStub(&stub);
- } else {
- __ CallRuntime(Runtime::kNewFunctionContext, 1);
-@@ -1199,9 +1200,9 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var,
- __ bind(&fast);
- }
-
-- __ lw(a0, GlobalObjectOperand());
-+ __ lw(a0, var->is_qml_global() ? QmlGlobalObjectOperand():GlobalObjectOperand());
- __ li(a2, Operand(var->name()));
-- RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF)
-+ RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF || var->is_qml_global())
- ? RelocInfo::CODE_TARGET
- : RelocInfo::CODE_TARGET_CONTEXT;
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
-@@ -1286,10 +1287,10 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
- Comment cmnt(masm_, "Global variable");
- // Use inline caching. Variable name is passed in a2 and the global
- // object (receiver) in a0.
-- __ lw(a0, GlobalObjectOperand());
-+ __ lw(a0, var->is_qml_global()?QmlGlobalObjectOperand():GlobalObjectOperand());
- __ li(a2, Operand(var->name()));
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
-- __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT);
-+ __ Call(ic, var->is_qml_global()?RelocInfo::CODE_TARGET:RelocInfo::CODE_TARGET_CONTEXT);
- context()->Plug(v0);
- break;
- }
-@@ -1937,7 +1938,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
- // Global var, const, or let.
- __ mov(a0, result_register());
- __ li(a2, Operand(var->name()));
-- __ lw(a1, GlobalObjectOperand());
-+ __ lw(a1, var->is_qml_global()?QmlGlobalObjectOperand():GlobalObjectOperand());
- Handle<Code> ic = is_strict_mode()
- ? isolate()->builtins()->StoreIC_Initialize_Strict()
- : isolate()->builtins()->StoreIC_Initialize();
-@@ -2246,9 +2247,14 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag,
- __ li(a1, Operand(Smi::FromInt(strict_mode)));
- __ push(a1);
-
-+
-+ // Push the qml mode flag.
-+ __ li(a1, Operand(Smi::FromInt(is_qml_mode())));
-+ __ push(a1);
-+
- __ CallRuntime(flag == SKIP_CONTEXT_LOOKUP
- ? Runtime::kResolvePossiblyDirectEvalNoLookup
-- : Runtime::kResolvePossiblyDirectEval, 4);
-+ : Runtime::kResolvePossiblyDirectEval, 5);
- }
-
-
-@@ -2320,9 +2326,9 @@ void FullCodeGenerator::VisitCall(Call* expr) {
- context()->DropAndPlug(1, v0);
- } else if (proxy != NULL && proxy->var()->IsUnallocated()) {
- // Push global object as receiver for the call IC.
-- __ lw(a0, GlobalObjectOperand());
-+ __ lw(a0, proxy->var()->is_qml_global()?QmlGlobalObjectOperand():GlobalObjectOperand());
- __ push(a0);
-- EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT);
-+ EmitCallWithIC(expr, proxy->name(), proxy->var()->is_qml_global()?RelocInfo::CODE_TARGET:RelocInfo::CODE_TARGET_CONTEXT);
- } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
- // Call to a lookup slot (dynamically introduced variable).
- Label slow, done;
-@@ -3743,7 +3749,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
- // but "delete this" is allowed.
- ASSERT(strict_mode_flag() == kNonStrictMode || var->is_this());
- if (var->IsUnallocated()) {
-- __ lw(a2, GlobalObjectOperand());
-+ __ lw(a2, var->is_qml_global() ? QmlGlobalObjectOperand() : GlobalObjectOperand());
- __ li(a1, Operand(var->name()));
- __ li(a0, Operand(Smi::FromInt(kNonStrictMode)));
- __ Push(a2, a1, a0);
-@@ -4032,7 +4038,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
- VariableProxy* proxy = expr->AsVariableProxy();
- if (proxy != NULL && proxy->var()->IsUnallocated()) {
- Comment cmnt(masm_, "Global variable");
-- __ lw(a0, GlobalObjectOperand());
-+ __ lw(a0, proxy->var()->is_qml_global() ? QmlGlobalObjectOperand() : GlobalObjectOperand());
- __ li(a2, Operand(proxy->name()));
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
- // Use a regular load, not a contextual load, to avoid a reference
-diff --git a/src/mips/macro-assembler-mips.h b/src/mips/macro-assembler-mips.h
-index 84c55f7..5224db9 100644
---- a/src/mips/macro-assembler-mips.h
-+++ b/src/mips/macro-assembler-mips.h
-@@ -112,6 +112,11 @@ static inline MemOperand GlobalObjectOperand() {
- }
-
-
-+static inline MemOperand QmlGlobalObjectOperand() {
-+ return ContextOperand(cp, Context::QML_GLOBAL_INDEX);
-+}
-+
-+
- // Generate a MemOperand for loading a field from an object.
- static inline MemOperand FieldMemOperand(Register object, int offset) {
- return MemOperand(object, offset - kHeapObjectTag);
-diff --git a/src/objects-inl.h b/src/objects-inl.h
-index 6a80c9c..2e83fb7 100644
---- a/src/objects-inl.h
-+++ b/src/objects-inl.h
-@@ -3535,6 +3535,8 @@ void SharedFunctionInfo::set_strict_mode_flag(StrictModeFlag strict_mode_flag) {
-
- BOOL_GETTER(SharedFunctionInfo, compiler_hints, strict_mode,
- kStrictModeFunction)
-+BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, qml_mode,
-+ kQmlModeFunction)
- BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative)
- BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints,
- name_should_print_as_anonymous,
-diff --git a/src/objects.h b/src/objects.h
-index c38d461..b71eaac 100644
---- a/src/objects.h
-+++ b/src/objects.h
-@@ -3120,6 +3120,9 @@ class SerializedScopeInfo : public FixedArray {
- // Is this scope a strict mode scope?
- bool IsStrictMode();
-
-+ // Is this scope a qml mode scope?
-+ bool IsQmlMode();
-+
- // Return the number of stack slots for code.
- int NumberOfStackSlots();
-
-@@ -4929,6 +4932,9 @@ class SharedFunctionInfo: public HeapObject {
- inline StrictModeFlag strict_mode_flag();
- inline void set_strict_mode_flag(StrictModeFlag strict_mode_flag);
-
-+ // Indicates whether the function is a qml mode function.
-+ DECL_BOOLEAN_ACCESSORS(qml_mode)
-+
- // False if the function definitely does not allocate an arguments object.
- DECL_BOOLEAN_ACCESSORS(uses_arguments)
-
-@@ -5150,6 +5156,7 @@ class SharedFunctionInfo: public HeapObject {
- kCodeAgeShift,
- kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize,
- kStrictModeFunction,
-+ kQmlModeFunction,
- kUsesArguments,
- kHasDuplicateParameters,
- kNative,
-diff --git a/src/parser.cc b/src/parser.cc
-index 37204c9..357d340 100644
---- a/src/parser.cc
-+++ b/src/parser.cc
-@@ -607,7 +607,8 @@ Parser::Parser(Handle<Script> script,
-
- FunctionLiteral* Parser::ParseProgram(Handle<String> source,
- bool in_global_context,
-- StrictModeFlag strict_mode) {
-+ StrictModeFlag strict_mode,
-+ bool qml_mode) {
- ZoneScope zone_scope(isolate(), DONT_DELETE_ON_EXIT);
-
- HistogramTimerScope timer(isolate()->counters()->parse());
-@@ -623,11 +624,11 @@ FunctionLiteral* Parser::ParseProgram(Handle<String> source,
- ExternalTwoByteStringUC16CharacterStream stream(
- Handle<ExternalTwoByteString>::cast(source), 0, source->length());
- scanner_.Initialize(&stream);
-- return DoParseProgram(source, in_global_context, strict_mode, &zone_scope);
-+ return DoParseProgram(source, in_global_context, strict_mode, qml_mode, &zone_scope);
- } else {
- GenericStringUC16CharacterStream stream(source, 0, source->length());
- scanner_.Initialize(&stream);
-- return DoParseProgram(source, in_global_context, strict_mode, &zone_scope);
-+ return DoParseProgram(source, in_global_context, strict_mode, qml_mode, &zone_scope);
- }
- }
-
-@@ -635,6 +636,7 @@ FunctionLiteral* Parser::ParseProgram(Handle<String> source,
- FunctionLiteral* Parser::DoParseProgram(Handle<String> source,
- bool in_global_context,
- StrictModeFlag strict_mode,
-+ bool qml_mode,
- ZoneScope* zone_scope) {
- ASSERT(top_scope_ == NULL);
- ASSERT(target_stack_ == NULL);
-@@ -654,6 +656,9 @@ FunctionLiteral* Parser::DoParseProgram(Handle<String> source,
- LexicalScope lexical_scope(this, scope, isolate());
- ASSERT(top_scope_->strict_mode_flag() == kNonStrictMode);
- top_scope_->SetStrictModeFlag(strict_mode);
-+ if (qml_mode) {
-+ scope->EnableQmlMode();
-+ }
- ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16);
- bool ok = true;
- int beg_loc = scanner().location().beg_pos;
-@@ -747,6 +752,10 @@ FunctionLiteral* Parser::ParseLazy(CompilationInfo* info,
- scope->strict_mode_flag() == info->strict_mode_flag());
- ASSERT(info->strict_mode_flag() == shared_info->strict_mode_flag());
- scope->SetStrictModeFlag(shared_info->strict_mode_flag());
-+ if (shared_info->qml_mode()) {
-+ top_scope_->EnableQmlMode();
-+ }
-+
- FunctionLiteral::Type type = shared_info->is_expression()
- ? (shared_info->is_anonymous()
- ? FunctionLiteral::ANONYMOUS_EXPRESSION
-@@ -1856,6 +1865,11 @@ Block* Parser::ParseVariableDeclarations(
- arguments->Add(value);
- value = NULL; // zap the value to avoid the unnecessary assignment
-
-+ int qml_mode = 0;
-+ if (top_scope_->is_qml_mode() && !Isolate::Current()->global()->HasProperty(*name))
-+ qml_mode = 1;
-+ arguments->Add(NewNumberLiteral(qml_mode));
-+
- // Construct the call to Runtime_InitializeConstGlobal
- // and add it to the initialization statement block.
- // Note that the function does different things depending on
-@@ -1872,6 +1886,11 @@ Block* Parser::ParseVariableDeclarations(
- StrictModeFlag flag = initialization_scope->strict_mode_flag();
- arguments->Add(NewNumberLiteral(flag));
-
-+ int qml_mode = 0;
-+ if (top_scope_->is_qml_mode() && !Isolate::Current()->global()->HasProperty(*name))
-+ qml_mode = 1;
-+ arguments->Add(NewNumberLiteral(qml_mode));
-+
- // Be careful not to assign a value to the global variable if
- // we're in a with. The initialization value should not
- // necessarily be stored in the global object in that case,
-@@ -5418,7 +5437,8 @@ bool ParserApi::Parse(CompilationInfo* info) {
- Handle<String> source = Handle<String>(String::cast(script->source()));
- result = parser.ParseProgram(source,
- info->is_global(),
-- info->strict_mode_flag());
-+ info->strict_mode_flag(),
-+ info->is_qml_mode());
- }
- }
- info->SetFunction(result);
-diff --git a/src/parser.h b/src/parser.h
-index eaae6f7..a60951d 100644
---- a/src/parser.h
-+++ b/src/parser.h
-@@ -430,7 +430,8 @@ class Parser {
- // Returns NULL if parsing failed.
- FunctionLiteral* ParseProgram(Handle<String> source,
- bool in_global_context,
-- StrictModeFlag strict_mode);
-+ StrictModeFlag strict_mode,
-+ bool qml_mode = false);
-
- FunctionLiteral* ParseLazy(CompilationInfo* info);
-
-@@ -476,6 +477,7 @@ class Parser {
- FunctionLiteral* DoParseProgram(Handle<String> source,
- bool in_global_context,
- StrictModeFlag strict_mode,
-+ bool qml_mode,
- ZoneScope* zone_scope);
-
- // Report syntax error
-diff --git a/src/prettyprinter.cc b/src/prettyprinter.cc
-index 37c76ce..73812fd 100644
---- a/src/prettyprinter.cc
-+++ b/src/prettyprinter.cc
-@@ -618,6 +618,9 @@ void AstPrinter::PrintLiteralWithModeIndented(const char* info,
- EmbeddedVector<char, 256> buf;
- int pos = OS::SNPrintF(buf, "%s (mode = %s", info,
- Variable::Mode2String(var->mode()));
-+ if (var->is_qml_global()) {
-+ pos += OS::SNPrintF(buf + pos, ":QML");
-+ }
- OS::SNPrintF(buf + pos, ")");
- PrintLiteralIndented(buf.start(), value, true);
- }
-diff --git a/src/runtime.cc b/src/runtime.cc
-index 0e256c1..b64e66b 100644
---- a/src/runtime.cc
-+++ b/src/runtime.cc
-@@ -1307,19 +1307,23 @@ static Failure* ThrowRedeclarationError(Isolate* isolate,
- RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareGlobals) {
- ASSERT(args.length() == 3);
- HandleScope scope(isolate);
-- Handle<GlobalObject> global = Handle<GlobalObject>(
-- isolate->context()->global());
-
- Handle<Context> context = args.at<Context>(0);
- CONVERT_ARG_CHECKED(FixedArray, pairs, 1);
- CONVERT_SMI_ARG_CHECKED(flags, 2);
-
-+ Handle<JSObject> js_global = Handle<JSObject>(isolate->context()->global());
-+ Handle<JSObject> qml_global = Handle<JSObject>(isolate->context()->qml_global());
-+
- // Traverse the name/value pairs and set the properties.
- int length = pairs->length();
-- for (int i = 0; i < length; i += 2) {
-+ for (int i = 0; i < length; i += 3) {
- HandleScope scope(isolate);
- Handle<String> name(String::cast(pairs->get(i)));
- Handle<Object> value(pairs->get(i + 1), isolate);
-+ Handle<Smi> is_qml_global(Smi::cast(pairs->get(i + 2)));
-+
-+ Handle<JSObject> global = is_qml_global->value()?qml_global:js_global;
-
- // We have to declare a global const property. To capture we only
- // assign to it when evaluating the assignment for "const x =
-@@ -1506,19 +1510,24 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
- NoHandleAllocation nha;
- // args[0] == name
- // args[1] == strict_mode
-- // args[2] == value (optional)
-+ // args[2] == qml_mode
-+ // args[3] == value (optional)
-
- // Determine if we need to assign to the variable if it already
- // exists (based on the number of arguments).
-- RUNTIME_ASSERT(args.length() == 2 || args.length() == 3);
-- bool assign = args.length() == 3;
-+ RUNTIME_ASSERT(args.length() == 3 || args.length() == 4);
-+ bool assign = args.length() == 4;
-
- CONVERT_ARG_CHECKED(String, name, 0);
-- GlobalObject* global = isolate->context()->global();
- RUNTIME_ASSERT(args[1]->IsSmi());
- StrictModeFlag strict_mode = static_cast<StrictModeFlag>(args.smi_at(1));
- ASSERT(strict_mode == kStrictMode || strict_mode == kNonStrictMode);
-
-+ RUNTIME_ASSERT(args[2]->IsSmi());
-+ int qml_mode = Smi::cast(args[2])->value();
-+
-+ JSObject* global = qml_mode?isolate->context()->qml_global():isolate->context()->global();
-+
- // According to ECMA-262, section 12.2, page 62, the property must
- // not be deletable.
- PropertyAttributes attributes = DONT_DELETE;
-@@ -1546,7 +1555,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
- // Found an interceptor that's not read only.
- if (assign) {
- return raw_holder->SetProperty(
-- &lookup, *name, args[2], attributes, strict_mode);
-+ &lookup, *name, args[3], attributes, strict_mode);
- } else {
- return isolate->heap()->undefined_value();
- }
-@@ -1556,9 +1565,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
- }
-
- // Reload global in case the loop above performed a GC.
-- global = isolate->context()->global();
-+ global = qml_mode?isolate->context()->qml_global():isolate->context()->global();
- if (assign) {
-- return global->SetProperty(*name, args[2], attributes, strict_mode, true);
-+ return global->SetProperty(*name, args[3], attributes, strict_mode, true);
- }
- return isolate->heap()->undefined_value();
- }
-@@ -1568,12 +1577,15 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) {
- // All constants are declared with an initial value. The name
- // of the constant is the first argument and the initial value
- // is the second.
-- RUNTIME_ASSERT(args.length() == 2);
-+ RUNTIME_ASSERT(args.length() == 3);
- CONVERT_ARG_CHECKED(String, name, 0);
- Handle<Object> value = args.at<Object>(1);
-
-+ RUNTIME_ASSERT(args[2]->IsSmi());
-+ int qml_mode = Smi::cast(args[2])->value();
-+
- // Get the current global object from top.
-- GlobalObject* global = isolate->context()->global();
-+ JSObject* global = qml_mode?isolate->context()->qml_global():isolate->context()->global();
-
- // According to ECMA-262, section 12.2, page 62, the property must
- // not be deletable. Since it's a const, it must be READ_ONLY too.
-@@ -1597,7 +1609,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) {
- // Restore global object from context (in case of GC) and continue
- // with setting the value.
- HandleScope handle_scope(isolate);
-- Handle<GlobalObject> global(isolate->context()->global());
-+ Handle<JSObject> global(qml_mode?isolate->context()->qml_global():isolate->context()->global());
-
- // BUG 1213575: Handle the case where we have to set a read-only
- // property through an interceptor and only do it if it's
-@@ -9386,7 +9398,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileString) {
- Handle<SharedFunctionInfo> shared = Compiler::CompileEval(source,
- context,
- true,
-- kNonStrictMode);
-+ kNonStrictMode,
-+ false);
- if (shared.is_null()) return Failure::Exception();
- Handle<JSFunction> fun =
- isolate->factory()->NewFunctionFromSharedFunctionInfo(shared,
-@@ -9399,7 +9412,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileString) {
- static ObjectPair CompileGlobalEval(Isolate* isolate,
- Handle<String> source,
- Handle<Object> receiver,
-- StrictModeFlag strict_mode) {
-+ StrictModeFlag strict_mode,
-+ bool qml_mode) {
- Handle<Context> context = Handle<Context>(isolate->context());
- Handle<Context> global_context = Handle<Context>(context->global_context());
-
-@@ -9417,7 +9431,8 @@ static ObjectPair CompileGlobalEval(Isolate* isolate,
- source,
- Handle<Context>(isolate->context()),
- context->IsGlobalContext(),
-- strict_mode);
-+ strict_mode,
-+ qml_mode);
- if (shared.is_null()) return MakePair(Failure::Exception(), NULL);
- Handle<JSFunction> compiled =
- isolate->factory()->NewFunctionFromSharedFunctionInfo(
-@@ -9427,7 +9442,7 @@ static ObjectPair CompileGlobalEval(Isolate* isolate,
-
-
- RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEval) {
-- ASSERT(args.length() == 4);
-+ ASSERT(args.length() == 5);
-
- HandleScope scope(isolate);
- Handle<Object> callee = args.at<Object>(0);
-@@ -9490,15 +9505,17 @@ RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEval) {
- }
-
- ASSERT(args[3]->IsSmi());
-+ ASSERT(args[4]->IsSmi());
- return CompileGlobalEval(isolate,
- args.at<String>(1),
- args.at<Object>(2),
-- static_cast<StrictModeFlag>(args.smi_at(3)));
-+ static_cast<StrictModeFlag>(args.smi_at(3)),
-+ Smi::cast(args[4])->value());
- }
-
-
- RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEvalNoLookup) {
-- ASSERT(args.length() == 4);
-+ ASSERT(args.length() == 5);
-
- HandleScope scope(isolate);
- Handle<Object> callee = args.at<Object>(0);
-@@ -9511,10 +9528,12 @@ RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEvalNoLookup) {
- }
-
- ASSERT(args[3]->IsSmi());
-+ ASSERT(args[4]->IsSmi());
- return CompileGlobalEval(isolate,
- args.at<String>(1),
- args.at<Object>(2),
-- static_cast<StrictModeFlag>(args.smi_at(3)));
-+ static_cast<StrictModeFlag>(args.smi_at(3)),
-+ Smi::cast(args[4])->value());
- }
-
-
-@@ -11220,10 +11239,12 @@ class ScopeIterator {
- ZoneScope zone_scope(isolate, DELETE_ON_EXIT);
- Handle<Script> script(Script::cast(shared_info->script()));
- Scope* scope;
-- if (index >= 0) {
-+ if (index >= 0 || shared_info->qml_mode()) {
- // Global code
- CompilationInfo info(script);
- info.MarkAsGlobal();
-+ if (shared_info->qml_mode())
-+ info.MarkAsQmlMode();
- bool result = ParserApi::Parse(&info);
- ASSERT(result);
- result = Scope::Analyze(&info);
-@@ -11253,7 +11274,6 @@ class ScopeIterator {
- ScopeType scope_type = Type();
- if (scope_type == ScopeTypeGlobal) {
- // The global scope is always the last in the chain.
-- ASSERT(context_->IsGlobalContext());
- context_ = Handle<Context>();
- return;
- }
-@@ -11277,7 +11297,7 @@ class ScopeIterator {
- !scope_info->HasContext());
- return ScopeTypeLocal;
- case GLOBAL_SCOPE:
-- ASSERT(context_->IsGlobalContext());
-+ ASSERT(context_->IsGlobalContext() || scope_info->IsQmlMode());
- return ScopeTypeGlobal;
- case WITH_SCOPE:
- ASSERT(context_->IsWithContext());
-@@ -11315,10 +11335,15 @@ class ScopeIterator {
- switch (Type()) {
- case ScopeIterator::ScopeTypeGlobal:
- return Handle<JSObject>(CurrentContext()->global());
-- case ScopeIterator::ScopeTypeLocal:
-+ case ScopeIterator::ScopeTypeLocal: {
-+ Handle<SerializedScopeInfo> scope_info = nested_scope_chain_.last();
-+ if (scope_info->IsQmlMode())
-+ ASSERT(nested_scope_chain_.length() == 2);
-+ else
-+ ASSERT(nested_scope_chain_.length() == 1);
- // Materialize the content of the local scope into a JSObject.
-- ASSERT(nested_scope_chain_.length() == 1);
- return MaterializeLocalScope(isolate_, frame_, inlined_frame_index_);
-+ }
- case ScopeIterator::ScopeTypeWith:
- // Return the with object.
- return Handle<JSObject>(JSObject::cast(CurrentContext()->extension()));
-@@ -12034,6 +12059,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
- Handle<JSFunction> function(JSFunction::cast(frame->function()));
- Handle<SerializedScopeInfo> scope_info(function->shared()->scope_info());
- ScopeInfo<> sinfo(*scope_info);
-+ bool qml_mode = function->shared()->qml_mode();
-
- // Traverse the saved contexts chain to find the active context for the
- // selected frame.
-@@ -12107,7 +12133,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
- Compiler::CompileEval(function_source,
- context,
- context->IsGlobalContext(),
-- kNonStrictMode);
-+ kNonStrictMode,
-+ qml_mode);
- if (shared.is_null()) return Failure::Exception();
- Handle<JSFunction> compiled_function =
- isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context);
-@@ -12117,7 +12144,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
- Handle<Object> receiver(frame->receiver(), isolate);
- Handle<Object> evaluation_function =
- Execution::Call(compiled_function, receiver, 0, NULL,
-- &has_pending_exception);
-+ &has_pending_exception, false,
-+ Handle<Object>(function->context()->qml_global()));
- if (has_pending_exception) return Failure::Exception();
-
- Handle<Object> arguments = GetArgumentsObject(isolate,
-@@ -12198,7 +12226,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluateGlobal) {
- // Currently, the eval code will be executed in non-strict mode,
- // even in the strict code context.
- Handle<SharedFunctionInfo> shared =
-- Compiler::CompileEval(source, context, is_global, kNonStrictMode);
-+ Compiler::CompileEval(source, context, is_global, kNonStrictMode, false);
- if (shared.is_null()) return Failure::Exception();
- Handle<JSFunction> compiled_function =
- Handle<JSFunction>(
-diff --git a/src/runtime.h b/src/runtime.h
-index 67fc628..aada06d 100644
---- a/src/runtime.h
-+++ b/src/runtime.h
-@@ -257,8 +257,8 @@ namespace internal {
- \
- /* Eval */ \
- F(GlobalReceiver, 1, 1) \
-- F(ResolvePossiblyDirectEval, 4, 2) \
-- F(ResolvePossiblyDirectEvalNoLookup, 4, 2) \
-+ F(ResolvePossiblyDirectEval, 5, 2) \
-+ F(ResolvePossiblyDirectEvalNoLookup, 5, 2) \
- \
- F(SetProperty, -1 /* 4 or 5 */, 1) \
- F(DefineOrRedefineDataProperty, 4, 1) \
-@@ -336,8 +336,8 @@ namespace internal {
- /* Declarations and initialization */ \
- F(DeclareGlobals, 3, 1) \
- F(DeclareContextSlot, 4, 1) \
-- F(InitializeVarGlobal, -1 /* 2 or 3 */, 1) \
-- F(InitializeConstGlobal, 2, 1) \
-+ F(InitializeVarGlobal, -1 /* 3 or 4 */, 1) \
-+ F(InitializeConstGlobal, 3, 1) \
- F(InitializeConstContextSlot, 3, 1) \
- F(OptimizeObjectForAddingMultipleProperties, 2, 1) \
- \
-diff --git a/src/scopeinfo.cc b/src/scopeinfo.cc
-index 8ea5f1e..a61b787 100644
---- a/src/scopeinfo.cc
-+++ b/src/scopeinfo.cc
-@@ -51,6 +51,7 @@ ScopeInfo<Allocator>::ScopeInfo(Scope* scope)
- : function_name_(FACTORY->empty_symbol()),
- calls_eval_(scope->calls_eval()),
- is_strict_mode_(scope->is_strict_mode()),
-+ is_qml_mode_(scope->is_qml_mode()),
- type_(scope->type()),
- parameters_(scope->num_parameters()),
- stack_slots_(scope->num_stack_slots()),
-@@ -153,6 +154,8 @@ ScopeInfo<Allocator>::ScopeInfo(Scope* scope)
- //
- // - is strict mode scope
- //
-+// - is qml mode scope
-+//
- // - scope type
- //
- // - number of variables in the context object (smi) (= function context
-@@ -252,6 +255,7 @@ ScopeInfo<Allocator>::ScopeInfo(SerializedScopeInfo* data)
- p = ReadObject(p, &function_name_);
- p = ReadBool(p, &calls_eval_);
- p = ReadBool(p, &is_strict_mode_);
-+ p = ReadBool(p, &is_qml_mode_);
- p = ReadInt(p, &type_);
- p = ReadList<Allocator>(p, &context_slots_, &context_modes_);
- p = ReadList<Allocator>(p, &parameters_);
-@@ -307,9 +311,9 @@ static Object** WriteList(Object** p,
-
- template<class Allocator>
- Handle<SerializedScopeInfo> ScopeInfo<Allocator>::Serialize() {
-- // function name, calls eval, is_strict_mode, scope type,
-+ // function name, calls eval, is_strict_mode, is_qml_mode, scope type,
- // length for 3 tables:
-- const int extra_slots = 1 + 1 + 1 + 1 + 3;
-+ const int extra_slots = 1 + 1 + 1 + 1 + 1 + 3;
- int length = extra_slots +
- context_slots_.length() * 2 +
- parameters_.length() +
-@@ -324,6 +328,7 @@ Handle<SerializedScopeInfo> ScopeInfo<Allocator>::Serialize() {
- p = WriteObject(p, function_name_);
- p = WriteBool(p, calls_eval_);
- p = WriteBool(p, is_strict_mode_);
-+ p = WriteBool(p, is_qml_mode_);
- p = WriteInt(p, type_);
- p = WriteList(p, &context_slots_, &context_modes_);
- p = WriteList(p, &parameters_);
-@@ -372,8 +377,8 @@ SerializedScopeInfo* SerializedScopeInfo::Empty() {
-
- Object** SerializedScopeInfo::ContextEntriesAddr() {
- ASSERT(length() > 0);
-- // +4 for function name, calls eval, strict mode, scope type.
-- return data_start() + 4;
-+ // +5 for function name, calls eval, strict mode, qml mode, scope type.
-+ return data_start() + 5;
- }
-
-
-@@ -417,10 +422,21 @@ bool SerializedScopeInfo::IsStrictMode() {
- }
-
-
-+bool SerializedScopeInfo::IsQmlMode() {
-+ if (length() > 0) {
-+ Object** p = data_start() + 3; // +3 for function name, calls eval, strict mode.
-+ bool qml_mode;
-+ p = ReadBool(p, &qml_mode);
-+ return qml_mode;
-+ }
-+ return false;
-+}
-+
-+
- ScopeType SerializedScopeInfo::Type() {
- ASSERT(length() > 0);
-- // +3 for function name, calls eval, strict mode.
-- Object** p = data_start() + 3;
-+ // +4 for function name, calls eval, strict mode, qml mode.
-+ Object** p = data_start() + 4;
- ScopeType type;
- p = ReadInt(p, &type);
- return type;
-diff --git a/src/scopeinfo.h b/src/scopeinfo.h
-index eeb3047..2ca4503 100644
---- a/src/scopeinfo.h
-+++ b/src/scopeinfo.h
-@@ -88,6 +88,7 @@ class ScopeInfo BASE_EMBEDDED {
- Handle<String> function_name_;
- bool calls_eval_;
- bool is_strict_mode_;
-+ bool is_qml_mode_;
- ScopeType type_;
- List<Handle<String>, Allocator > parameters_;
- List<Handle<String>, Allocator > stack_slots_;
-diff --git a/src/scopes.cc b/src/scopes.cc
-index 3167c4d..6503d07 100644
---- a/src/scopes.cc
-+++ b/src/scopes.cc
-@@ -35,6 +35,8 @@
-
- #include "allocation-inl.h"
-
-+#include "debug.h"
-+
- namespace v8 {
- namespace internal {
-
-@@ -202,6 +204,7 @@ void Scope::SetDefaults(ScopeType type,
- // Inherit the strict mode from the parent scope.
- strict_mode_flag_ = (outer_scope != NULL)
- ? outer_scope->strict_mode_flag_ : kNonStrictMode;
-+ qml_mode_ = (outer_scope != NULL) && outer_scope->qml_mode_;
- outer_scope_calls_non_strict_eval_ = false;
- inner_scope_calls_eval_ = false;
- force_eager_compilation_ = false;
-@@ -907,6 +910,26 @@ void Scope::ResolveVariable(Scope* global_scope,
- // by 'eval' introduced variable bindings.
- if (var->is_global()) {
- var = NonLocal(proxy->name(), DYNAMIC_GLOBAL);
-+
-+ if (qml_mode_) {
-+ Handle<GlobalObject> global = isolate_->global();
-+
-+#ifdef ENABLE_DEBUGGER_SUPPORT
-+ if (isolate_->debug()->IsLoaded() && isolate_->debug()->InDebugger()) {
-+ //Get the context before the debugger was entered.
-+ SaveContext *save = isolate_->save_context();
-+ while (save != NULL && *save->context() == *isolate_->debug()->debug_context())
-+ save = save->prev();
-+
-+ global = Handle<GlobalObject>(save->context()->global());
-+ }
-+#endif
-+
-+ if (qml_mode_ && !global->HasProperty(*(proxy->name()))) {
-+ var->set_is_qml_global(true);
-+ }
-+ }
-+
- } else {
- Variable* invalidated = var;
- var = NonLocal(proxy->name(), DYNAMIC_LOCAL);
-@@ -918,12 +941,52 @@ void Scope::ResolveVariable(Scope* global_scope,
- // No binding has been found. Declare a variable in global scope.
- ASSERT(global_scope != NULL);
- var = global_scope->DeclareGlobal(proxy->name());
-+
-+ if (qml_mode_) {
-+ Handle<GlobalObject> global = isolate_->global();
-+
-+#ifdef ENABLE_DEBUGGER_SUPPORT
-+ if (isolate_->debug()->IsLoaded() && isolate_->debug()->InDebugger()) {
-+ //Get the context before the debugger was entered.
-+ SaveContext *save = isolate_->save_context();
-+ while (save != NULL && *save->context() == *isolate_->debug()->debug_context())
-+ save = save->prev();
-+
-+ global = Handle<GlobalObject>(save->context()->global());
-+ }
-+#endif
-+
-+ if (!global->HasProperty(*(proxy->name()))) {
-+ var->set_is_qml_global(true);
-+ }
-+ }
-+
- break;
-
- case UNBOUND_EVAL_SHADOWED:
- // No binding has been found. But some scope makes a
- // non-strict 'eval' call.
- var = NonLocal(proxy->name(), DYNAMIC_GLOBAL);
-+
-+ if (qml_mode_) {
-+ Handle<GlobalObject> global = isolate_->global();
-+
-+#ifdef ENABLE_DEBUGGER_SUPPORT
-+ if (isolate_->debug()->IsLoaded() && isolate_->debug()->InDebugger()) {
-+ //Get the context before the debugger was entered.
-+ SaveContext *save = isolate_->save_context();
-+ while (save != NULL && *save->context() == *isolate_->debug()->debug_context())
-+ save = save->prev();
-+
-+ global = Handle<GlobalObject>(save->context()->global());
-+ }
-+#endif
-+
-+ if (qml_mode_ && !global->HasProperty(*(proxy->name()))) {
-+ var->set_is_qml_global(true);
-+ }
-+ }
-+
- break;
-
- case DYNAMIC_LOOKUP:
-diff --git a/src/scopes.h b/src/scopes.h
-index a1418874..41e5f5c 100644
---- a/src/scopes.h
-+++ b/src/scopes.h
-@@ -228,6 +228,11 @@ class Scope: public ZoneObject {
- end_position_ = statement_pos;
- }
-
-+ // Enable qml mode for this scope
-+ void EnableQmlMode() {
-+ qml_mode_ = true;
-+ }
-+
- // ---------------------------------------------------------------------------
- // Predicates.
-
-@@ -242,6 +247,7 @@ class Scope: public ZoneObject {
- return is_eval_scope() || is_function_scope() || is_global_scope();
- }
- bool is_strict_mode() const { return strict_mode_flag() == kStrictMode; }
-+ bool is_qml_mode() const { return qml_mode_; }
- bool is_strict_mode_eval_scope() const {
- return is_eval_scope() && is_strict_mode();
- }
-@@ -427,6 +433,8 @@ class Scope: public ZoneObject {
- // Source positions.
- int start_position_;
- int end_position_;
-+ // This scope is a qml mode scope.
-+ bool qml_mode_;
-
- // Computed via PropagateScopeInfo.
- bool outer_scope_calls_non_strict_eval_;
-diff --git a/src/variables.cc b/src/variables.cc
-index d85e1b2..1887935 100644
---- a/src/variables.cc
-+++ b/src/variables.cc
-@@ -68,7 +68,8 @@ Variable::Variable(Scope* scope,
- local_if_not_shadowed_(NULL),
- is_valid_LHS_(is_valid_LHS),
- is_accessed_from_inner_scope_(false),
-- is_used_(false) {
-+ is_used_(false),
-+ is_qml_global_(false) {
- // names must be canonicalized for fast equality checks
- ASSERT(name->IsSymbol());
- }
-diff --git a/src/variables.h b/src/variables.h
-index 8b2d869..33561b0 100644
---- a/src/variables.h
-+++ b/src/variables.h
-@@ -155,6 +155,8 @@ class Variable: public ZoneObject {
- index_ = index;
- }
-
-+ bool is_qml_global() const { return is_qml_global_; }
-+ void set_is_qml_global(bool is_qml_global) { is_qml_global_ = is_qml_global; }
- private:
- Scope* scope_;
- Handle<String> name_;
-@@ -175,6 +177,9 @@ class Variable: public ZoneObject {
- // Usage info.
- bool is_accessed_from_inner_scope_; // set by variable resolver
- bool is_used_;
-+
-+ // QML info
-+ bool is_qml_global_;
- };
-
-
-diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
-index f62c517..f30221f 100644
---- a/src/x64/code-stubs-x64.cc
-+++ b/src/x64/code-stubs-x64.cc
-@@ -139,6 +139,10 @@ void FastNewContextStub::Generate(MacroAssembler* masm) {
- __ movq(rbx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
- __ movq(Operand(rax, Context::SlotOffset(Context::GLOBAL_INDEX)), rbx);
-
-+ // Copy the qmlglobal object from the previous context.
-+ __ movq(rbx, Operand(rsi, Context::SlotOffset(Context::QML_GLOBAL_INDEX)));
-+ __ movq(Operand(rax, Context::SlotOffset(Context::QML_GLOBAL_INDEX)), rbx);
-+
- // Initialize the rest of the slots to undefined.
- __ LoadRoot(rbx, Heap::kUndefinedValueRootIndex);
- for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) {
-diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc
-index bf640db..b1e5d35 100644
---- a/src/x64/full-codegen-x64.cc
-+++ b/src/x64/full-codegen-x64.cc
-@@ -173,12 +173,13 @@ void FullCodeGenerator::Generate(CompilationInfo* info) {
-
- // Possibly allocate a local context.
- int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
-- if (heap_slots > 0) {
-+ if (heap_slots > 0 ||
-+ (scope()->is_qml_mode() && scope()->is_global_scope())) {
- Comment cmnt(masm_, "[ Allocate local context");
- // Argument to NewContext is the function, which is still in rdi.
- __ push(rdi);
- if (heap_slots <= FastNewContextStub::kMaximumSlots) {
-- FastNewContextStub stub(heap_slots);
-+ FastNewContextStub stub((heap_slots < 0)?0:heap_slots);
- __ CallStub(&stub);
- } else {
- __ CallRuntime(Runtime::kNewFunctionContext, 1);
-@@ -1155,10 +1156,10 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var,
-
- // All extension objects were empty and it is safe to use a global
- // load IC call.
-- __ movq(rax, GlobalObjectOperand());
-+ __ movq(rax, var->is_qml_global() ? QmlGlobalObjectOperand() : GlobalObjectOperand());
- __ Move(rcx, var->name());
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
-- RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF)
-+ RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF || var->is_qml_global())
- ? RelocInfo::CODE_TARGET
- : RelocInfo::CODE_TARGET_CONTEXT;
- __ call(ic, mode);
-@@ -1240,9 +1241,9 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
- // Use inline caching. Variable name is passed in rcx and the global
- // object on the stack.
- __ Move(rcx, var->name());
-- __ movq(rax, GlobalObjectOperand());
-+ __ movq(rax, var->is_qml_global() ? QmlGlobalObjectOperand() : GlobalObjectOperand());
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
-- __ call(ic, RelocInfo::CODE_TARGET_CONTEXT);
-+ __ call(ic, var->is_qml_global() ? RelocInfo::CODE_TARGET : RelocInfo::CODE_TARGET_CONTEXT);
- context()->Plug(rax);
- break;
- }
-@@ -1834,7 +1835,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
- if (var->IsUnallocated()) {
- // Global var, const, or let.
- __ Move(rcx, var->name());
-- __ movq(rdx, GlobalObjectOperand());
-+ __ movq(rdx, var->is_qml_global() ? QmlGlobalObjectOperand() : GlobalObjectOperand());
- Handle<Code> ic = is_strict_mode()
- ? isolate()->builtins()->StoreIC_Initialize_Strict()
- : isolate()->builtins()->StoreIC_Initialize();
-@@ -2117,9 +2118,12 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag,
- FLAG_harmony_scoping ? kStrictMode : strict_mode_flag();
- __ Push(Smi::FromInt(strict_mode));
-
-+ // Push the qml mode flag
-+ __ Push(Smi::FromInt(is_qml_mode()));
-+
- __ CallRuntime(flag == SKIP_CONTEXT_LOOKUP
- ? Runtime::kResolvePossiblyDirectEvalNoLookup
-- : Runtime::kResolvePossiblyDirectEval, 4);
-+ : Runtime::kResolvePossiblyDirectEval, 5);
- }
-
-
-@@ -2188,8 +2192,8 @@ void FullCodeGenerator::VisitCall(Call* expr) {
- } else if (proxy != NULL && proxy->var()->IsUnallocated()) {
- // Call to a global variable. Push global object as receiver for the
- // call IC lookup.
-- __ push(GlobalObjectOperand());
-- EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT);
-+ __ push(proxy->var()->is_qml_global() ? QmlGlobalObjectOperand() : GlobalObjectOperand());
-+ EmitCallWithIC(expr, proxy->name(), proxy->var()->is_qml_global() ? RelocInfo::CODE_TARGET : RelocInfo::CODE_TARGET_CONTEXT);
- } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
- // Call to a lookup slot (dynamically introduced variable).
- Label slow, done;
-@@ -3638,7 +3642,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
- // but "delete this" is allowed.
- ASSERT(strict_mode_flag() == kNonStrictMode || var->is_this());
- if (var->IsUnallocated()) {
-- __ push(GlobalObjectOperand());
-+ __ push(var->is_qml_global() ? QmlGlobalObjectOperand() : GlobalObjectOperand());
- __ Push(var->name());
- __ Push(Smi::FromInt(kNonStrictMode));
- __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
-@@ -3936,7 +3940,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
- if (proxy != NULL && proxy->var()->IsUnallocated()) {
- Comment cmnt(masm_, "Global variable");
- __ Move(rcx, proxy->name());
-- __ movq(rax, GlobalObjectOperand());
-+ __ movq(rax, proxy->var()->is_qml_global() ? QmlGlobalObjectOperand() : GlobalObjectOperand());
- Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
- // Use a regular load, not a contextual load, to avoid a reference
- // error.
-diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
-index 38a8c18..2a95fee 100644
---- a/src/x64/lithium-codegen-x64.cc
-+++ b/src/x64/lithium-codegen-x64.cc
-@@ -196,12 +196,13 @@ bool LCodeGen::GeneratePrologue() {
-
- // Possibly allocate a local context.
- int heap_slots = scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
-- if (heap_slots > 0) {
-+ if (heap_slots > 0 ||
-+ (scope()->is_qml_mode() && scope()->is_global_scope())) {
- Comment(";;; Allocate local context");
- // Argument to NewContext is the function, which is still in rdi.
- __ push(rdi);
- if (heap_slots <= FastNewContextStub::kMaximumSlots) {
-- FastNewContextStub stub(heap_slots);
-+ FastNewContextStub stub((heap_slots < 0)?0:heap_slots);
- __ CallStub(&stub);
- } else {
- __ CallRuntime(Runtime::kNewFunctionContext, 1);
-@@ -2610,7 +2611,7 @@ void LCodeGen::DoOuterContext(LOuterContext* instr) {
-
- void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
- Register result = ToRegister(instr->result());
-- __ movq(result, GlobalObjectOperand());
-+ __ movq(result, instr->qml_global()?QmlGlobalObjectOperand():GlobalObjectOperand());
- }
-
-
-@@ -3049,7 +3050,7 @@ void LCodeGen::DoCallFunction(LCallFunction* instr) {
- void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
- ASSERT(ToRegister(instr->result()).is(rax));
- int arity = instr->arity();
-- RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT;
-+ RelocInfo::Mode mode = instr->qml_global()?RelocInfo::CODE_TARGET:RelocInfo::CODE_TARGET_CONTEXT;
- Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arity, mode);
- __ Move(rcx, instr->name());
-diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc
-index 0af2ce4..9e2731f 100644
---- a/src/x64/lithium-x64.cc
-+++ b/src/x64/lithium-x64.cc
-@@ -1123,7 +1123,7 @@ LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) {
-
-
- LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
-- return DefineAsRegister(new LGlobalObject);
-+ return DefineAsRegister(new LGlobalObject(instr->qml_global()));
- }
-
-
-@@ -1193,7 +1193,7 @@ LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
-
- LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
- argument_count_ -= instr->argument_count();
-- return MarkAsCall(DefineFixed(new LCallGlobal, rax), instr);
-+ return MarkAsCall(DefineFixed(new LCallGlobal(instr->qml_global()), rax), instr);
- }
-
-
-diff --git a/src/x64/lithium-x64.h b/src/x64/lithium-x64.h
-index 20a6937..8f1a3d8 100644
---- a/src/x64/lithium-x64.h
-+++ b/src/x64/lithium-x64.h
-@@ -1303,7 +1303,13 @@ class LOuterContext: public LTemplateInstruction<1, 1, 0> {
-
- class LGlobalObject: public LTemplateInstruction<1, 0, 0> {
- public:
-+ explicit LGlobalObject(bool qml_global) : qml_global_(qml_global) {}
-+
- DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
-+
-+ bool qml_global() { return qml_global_; }
-+ private:
-+ bool qml_global_;
- };
-
-
-@@ -1393,10 +1399,16 @@ class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
- DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
- DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
-
-+ explicit LCallGlobal(bool qml_global) : qml_global_(qml_global) {}
-+
- virtual void PrintDataTo(StringStream* stream);
-
- Handle<String> name() const {return hydrogen()->name(); }
- int arity() const { return hydrogen()->argument_count() - 1; }
-+
-+ bool qml_global() { return qml_global_; }
-+ private:
-+ bool qml_global_;
- };
-
-
-diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h
-index f5f81b1..5caa6cf 100644
---- a/src/x64/macro-assembler-x64.h
-+++ b/src/x64/macro-assembler-x64.h
-@@ -1418,6 +1418,11 @@ static inline Operand GlobalObjectOperand() {
- }
-
-
-+static inline Operand QmlGlobalObjectOperand() {
-+ return ContextOperand(rsi, Context::QML_GLOBAL_INDEX);
-+}
-+
-+
- // Provides access to exit frame stack space (not GCed).
- static inline Operand StackSpaceOperand(int index) {
- #ifdef _WIN64
---
-1.7.7.3
-
diff --git a/src/v8/0005-Allow-access-to-the-calling-script-data.patch b/src/v8/0005-Allow-access-to-the-calling-script-data.patch
deleted file mode 100644
index 3c41a036ee..0000000000
--- a/src/v8/0005-Allow-access-to-the-calling-script-data.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From d01b0fc24542eb6128bcbd3a8a02da9659b8433e Mon Sep 17 00:00:00 2001
-From: Aaron Kennedy <aaron.kennedy@nokia.com>
-Date: Fri, 14 Oct 2011 17:03:06 +1000
-Subject: [PATCH 05/12] Allow access to the calling script data
-
----
- include/v8.h | 1 +
- src/api.cc | 12 ++++++++++++
- 2 files changed, 13 insertions(+), 0 deletions(-)
-
-diff --git a/include/v8.h b/include/v8.h
-index 193e2fe..c094d08 100644
---- a/include/v8.h
-+++ b/include/v8.h
-@@ -3517,6 +3517,7 @@ class V8EXPORT Context {
- */
- static Local<Context> GetCalling();
- static Local<Object> GetCallingQmlGlobal();
-+ static Local<Value> GetCallingScriptData();
-
- /**
- * Sets the security token for the context. To access an object in
-diff --git a/src/api.cc b/src/api.cc
-index 2d3d97a..54df40d 100644
---- a/src/api.cc
-+++ b/src/api.cc
-@@ -4370,6 +4370,18 @@ v8::Local<v8::Object> Context::GetCallingQmlGlobal() {
- }
- }
-
-+v8::Local<v8::Value> Context::GetCallingScriptData()
-+{
-+ i::Isolate* isolate = i::Isolate::Current();
-+ if (IsDeadCheck(isolate, "v8::Context::GetCallingScriptData()")) {
-+ return Local<Object>();
-+ }
-+
-+ i::JavaScriptFrameIterator it;
-+ if (it.done()) return Local<Object>();
-+ i::Handle<i::Script> script(i::Script::cast(i::JSFunction::cast(it.frame()->function())->shared()->script()));
-+ return Utils::ToLocal(i::Handle<i::Object>(script->data()));
-+}
-
- v8::Local<v8::Object> Context::Global() {
- if (IsDeadCheck(i::Isolate::Current(), "v8::Context::Global()")) {
---
-1.7.7.3
-
diff --git a/src/v8/0006-Add-custom-object-compare-callback.patch b/src/v8/0006-Add-custom-object-compare-callback.patch
deleted file mode 100644
index 51c933580f..0000000000
--- a/src/v8/0006-Add-custom-object-compare-callback.patch
+++ /dev/null
@@ -1,548 +0,0 @@
-From 59b3da4073971aa725eea8f303f37948dc3bb376 Mon Sep 17 00:00:00 2001
-From: Aaron Kennedy <aaron.kennedy@nokia.com>
-Date: Thu, 27 Oct 2011 13:40:00 +0100
-Subject: [PATCH 06/12] Add custom object compare callback
-
-A global custom object comparison callback can be set with:
- V8::SetUserObjectComparisonCallbackFunction()
-When two JSObjects are compared (== or !=), if either one has
-the MarkAsUseUserObjectComparison() bit set, the custom comparison
-callback is invoked to do the actual comparison.
-
-This is useful when you have "value" objects that you want to
-compare as equal, even though they are actually different JS object
-instances.
----
- include/v8.h | 13 +++++++++++++
- src/api.cc | 22 ++++++++++++++++++++++
- src/arm/code-stubs-arm.cc | 43 +++++++++++++++++++++++++++++++++++++++++--
- src/factory.cc | 8 ++++++++
- src/ia32/code-stubs-ia32.cc | 39 +++++++++++++++++++++++++++++++++++++++
- src/isolate.cc | 7 +++++++
- src/isolate.h | 8 ++++++++
- src/objects-inl.h | 21 ++++++++++++++++++---
- src/objects.cc | 8 ++++----
- src/objects.h | 12 ++++++++++--
- src/runtime.cc | 23 +++++++++++++++++++++++
- src/runtime.h | 1 +
- src/x64/code-stubs-x64.cc | 37 +++++++++++++++++++++++++++++++++++++
- 13 files changed, 231 insertions(+), 11 deletions(-)
-
-diff --git a/include/v8.h b/include/v8.h
-index c094d08..6baf2b2 100644
---- a/include/v8.h
-+++ b/include/v8.h
-@@ -2501,6 +2501,12 @@ class V8EXPORT ObjectTemplate : public Template {
- bool HasExternalResource();
- void SetHasExternalResource(bool value);
-
-+ /**
-+ * Mark object instances of the template as using the user object
-+ * comparison callback.
-+ */
-+ void MarkAsUseUserObjectComparison();
-+
- private:
- ObjectTemplate();
- static Local<ObjectTemplate> New(Handle<FunctionTemplate> constructor);
-@@ -2720,6 +2726,10 @@ typedef void (*FailedAccessCheckCallback)(Local<Object> target,
- AccessType type,
- Local<Value> data);
-
-+// --- User Object Comparisoa nCallback ---
-+typedef bool (*UserObjectComparisonCallback)(Local<Object> lhs,
-+ Local<Object> rhs);
-+
- // --- AllowCodeGenerationFromStrings callbacks ---
-
- /**
-@@ -3046,6 +3056,9 @@ class V8EXPORT V8 {
- /** Callback function for reporting failed access checks.*/
- static void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback);
-
-+ /** Callback for user object comparisons */
-+ static void SetUserObjectComparisonCallbackFunction(UserObjectComparisonCallback);
-+
- /**
- * Enables the host application to receive a notification before a
- * garbage collection. Allocations are not allowed in the
-diff --git a/src/api.cc b/src/api.cc
-index 54df40d..974d702 100644
---- a/src/api.cc
-+++ b/src/api.cc
-@@ -1464,6 +1464,17 @@ void ObjectTemplate::SetHasExternalResource(bool value)
- }
-
-
-+void ObjectTemplate::MarkAsUseUserObjectComparison()
-+{
-+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
-+ if (IsDeadCheck(isolate, "v8::ObjectTemplate::MarkAsUseUserObjectComparison()")) {
-+ return;
-+ }
-+ ENTER_V8(isolate);
-+ EnsureConstructor(this);
-+ Utils::OpenHandle(this)->set_use_user_object_comparison(i::Smi::FromInt(1));
-+}
-+
- // --- S c r i p t D a t a ---
-
-
-@@ -5113,6 +5124,17 @@ void V8::SetFailedAccessCheckCallbackFunction(
- isolate->SetFailedAccessCheckCallback(callback);
- }
-
-+
-+void V8::SetUserObjectComparisonCallbackFunction(
-+ UserObjectComparisonCallback callback) {
-+ i::Isolate* isolate = i::Isolate::Current();
-+ if (IsDeadCheck(isolate, "v8::V8::SetUserObjectComparisonCallbackFunction()")) {
-+ return;
-+ }
-+ isolate->SetUserObjectComparisonCallback(callback);
-+}
-+
-+
- void V8::AddObjectGroup(Persistent<Value>* objects,
- size_t length,
- RetainedObjectInfo* info) {
-diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc
-index f5be938..1e1aebd 100644
---- a/src/arm/code-stubs-arm.cc
-+++ b/src/arm/code-stubs-arm.cc
-@@ -1569,6 +1569,37 @@ void CompareStub::Generate(MacroAssembler* masm) {
- // NOTICE! This code is only reached after a smi-fast-case check, so
- // it is certain that at least one operand isn't a smi.
-
-+ {
-+ Label not_user_equal, user_equal;
-+ __ and_(r2, r1, Operand(r0));
-+ __ tst(r2, Operand(kSmiTagMask));
-+ __ b(eq, &not_user_equal);
-+
-+ __ CompareObjectType(r0, r2, r4, JS_OBJECT_TYPE);
-+ __ b(ne, &not_user_equal);
-+
-+ __ CompareObjectType(r1, r3, r4, JS_OBJECT_TYPE);
-+ __ b(ne, &not_user_equal);
-+
-+ __ ldrb(r2, FieldMemOperand(r2, Map::kBitField2Offset));
-+ __ and_(r2, r2, Operand(1 << Map::kUseUserObjectComparison));
-+ __ cmp(r2, Operand(1 << Map::kUseUserObjectComparison));
-+ __ b(eq, &user_equal);
-+
-+ __ ldrb(r3, FieldMemOperand(r3, Map::kBitField2Offset));
-+ __ and_(r3, r3, Operand(1 << Map::kUseUserObjectComparison));
-+ __ cmp(r3, Operand(1 << Map::kUseUserObjectComparison));
-+ __ b(ne, &not_user_equal);
-+
-+ __ bind(&user_equal);
-+
-+ __ Push(r0, r1);
-+ __ TailCallRuntime(Runtime::kUserObjectEquals, 2, 1);
-+
-+ __ bind(&not_user_equal);
-+ }
-+
-+
- // Handle the case where the objects are identical. Either returns the answer
- // or goes to slow. Only falls through if the objects were not identical.
- EmitIdenticalObjectComparison(masm, &slow, cc_, never_nan_nan_);
-@@ -6615,10 +6646,18 @@ void ICCompareStub::GenerateObjects(MacroAssembler* masm) {
- __ and_(r2, r1, Operand(r0));
- __ JumpIfSmi(r2, &miss);
-
-- __ CompareObjectType(r0, r2, r2, JS_OBJECT_TYPE);
-+ __ CompareObjectType(r0, r2, r3, JS_OBJECT_TYPE);
- __ b(ne, &miss);
-- __ CompareObjectType(r1, r2, r2, JS_OBJECT_TYPE);
-+ __ ldrb(r2, FieldMemOperand(r2, Map::kBitField2Offset));
-+ __ and_(r2, r2, Operand(1 << Map::kUseUserObjectComparison));
-+ __ cmp(r2, Operand(1 << Map::kUseUserObjectComparison));
-+ __ b(eq, &miss);
-+ __ CompareObjectType(r1, r2, r3, JS_OBJECT_TYPE);
- __ b(ne, &miss);
-+ __ ldrb(r2, FieldMemOperand(r2, Map::kBitField2Offset));
-+ __ and_(r2, r2, Operand(1 << Map::kUseUserObjectComparison));
-+ __ cmp(r2, Operand(1 << Map::kUseUserObjectComparison));
-+ __ b(eq, &miss);
-
- ASSERT(GetCondition() == eq);
- __ sub(r0, r0, Operand(r1));
-diff --git a/src/factory.cc b/src/factory.cc
-index 8c96944..76ca69d 100644
---- a/src/factory.cc
-+++ b/src/factory.cc
-@@ -1153,6 +1153,7 @@ Handle<JSFunction> Factory::CreateApiFunction(
-
- int internal_field_count = 0;
- bool has_external_resource = false;
-+ bool use_user_object_comparison = false;
-
- if (!obj->instance_template()->IsUndefined()) {
- Handle<ObjectTemplateInfo> instance_template =
-@@ -1162,6 +1163,8 @@ Handle<JSFunction> Factory::CreateApiFunction(
- Smi::cast(instance_template->internal_field_count())->value();
- has_external_resource =
- !instance_template->has_external_resource()->IsUndefined();
-+ use_user_object_comparison =
-+ !instance_template->use_user_object_comparison()->IsUndefined();
- }
-
- int instance_size = kPointerSize * internal_field_count;
-@@ -1206,6 +1209,11 @@ Handle<JSFunction> Factory::CreateApiFunction(
- map->set_has_external_resource(true);
- }
-
-+ // Mark as using user object comparison if needed
-+ if (use_user_object_comparison) {
-+ map->set_use_user_object_comparison(true);
-+ }
-+
- // Mark as undetectable if needed.
- if (obj->undetectable()) {
- map->set_is_undetectable();
-diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc
-index 8a94a06..e73753e 100644
---- a/src/ia32/code-stubs-ia32.cc
-+++ b/src/ia32/code-stubs-ia32.cc
-@@ -4020,6 +4020,39 @@ void CompareStub::Generate(MacroAssembler* masm) {
- // NOTICE! This code is only reached after a smi-fast-case check, so
- // it is certain that at least one operand isn't a smi.
-
-+ {
-+ Label not_user_equal, user_equal;
-+ __ test(eax, Immediate(kSmiTagMask));
-+ __ j(zero, &not_user_equal);
-+ __ test(edx, Immediate(kSmiTagMask));
-+ __ j(zero, &not_user_equal);
-+
-+ __ CmpObjectType(eax, JS_OBJECT_TYPE, ebx);
-+ __ j(not_equal, &not_user_equal);
-+
-+ __ CmpObjectType(edx, JS_OBJECT_TYPE, ecx);
-+ __ j(not_equal, &not_user_equal);
-+
-+ __ test_b(FieldOperand(ebx, Map::kBitField2Offset),
-+ 1 << Map::kUseUserObjectComparison);
-+ __ j(not_zero, &user_equal);
-+ __ test_b(FieldOperand(ecx, Map::kBitField2Offset),
-+ 1 << Map::kUseUserObjectComparison);
-+ __ j(not_zero, &user_equal);
-+
-+ __ jmp(&not_user_equal);
-+
-+ __ bind(&user_equal);
-+
-+ __ pop(ebx); // Return address.
-+ __ push(eax);
-+ __ push(edx);
-+ __ push(ebx);
-+ __ TailCallRuntime(Runtime::kUserObjectEquals, 2, 1);
-+
-+ __ bind(&not_user_equal);
-+ }
-+
- // Identical objects can be compared fast, but there are some tricky cases
- // for NaN and undefined.
- {
-@@ -6497,8 +6530,14 @@ void ICCompareStub::GenerateObjects(MacroAssembler* masm) {
-
- __ CmpObjectType(eax, JS_OBJECT_TYPE, ecx);
- __ j(not_equal, &miss, Label::kNear);
-+ __ test_b(FieldOperand(ecx, Map::kBitField2Offset),
-+ 1 << Map::kUseUserObjectComparison);
-+ __ j(not_zero, &miss, Label::kNear);
- __ CmpObjectType(edx, JS_OBJECT_TYPE, ecx);
- __ j(not_equal, &miss, Label::kNear);
-+ __ test_b(FieldOperand(ecx, Map::kBitField2Offset),
-+ 1 << Map::kUseUserObjectComparison);
-+ __ j(not_zero, &miss, Label::kNear);
-
- ASSERT(GetCondition() == equal);
- __ sub(eax, edx);
-diff --git a/src/isolate.cc b/src/isolate.cc
-index a073af9..36c1dfd 100644
---- a/src/isolate.cc
-+++ b/src/isolate.cc
-@@ -96,6 +96,7 @@ void ThreadLocalTop::InitializeInternal() {
- thread_id_ = ThreadId::Invalid();
- external_caught_exception_ = false;
- failed_access_check_callback_ = NULL;
-+ user_object_comparison_callback_ = NULL;
- save_context_ = NULL;
- catcher_ = NULL;
- top_lookup_result_ = NULL;
-@@ -729,6 +730,12 @@ void Isolate::SetFailedAccessCheckCallback(
- thread_local_top()->failed_access_check_callback_ = callback;
- }
-
-+
-+void Isolate::SetUserObjectComparisonCallback(
-+ v8::UserObjectComparisonCallback callback) {
-+ thread_local_top()->user_object_comparison_callback_ = callback;
-+}
-+
-
- void Isolate::ReportFailedAccessCheck(JSObject* receiver, v8::AccessType type) {
- if (!thread_local_top()->failed_access_check_callback_) return;
-diff --git a/src/isolate.h b/src/isolate.h
-index 5453bf2..9919e83 100644
---- a/src/isolate.h
-+++ b/src/isolate.h
-@@ -258,6 +258,9 @@ class ThreadLocalTop BASE_EMBEDDED {
- // Head of the list of live LookupResults.
- LookupResult* top_lookup_result_;
-
-+ // Call back function for user object comparisons
-+ v8::UserObjectComparisonCallback user_object_comparison_callback_;
-+
- // Whether out of memory exceptions should be ignored.
- bool ignore_out_of_memory_;
-
-@@ -703,6 +706,11 @@ class Isolate {
- void SetFailedAccessCheckCallback(v8::FailedAccessCheckCallback callback);
- void ReportFailedAccessCheck(JSObject* receiver, v8::AccessType type);
-
-+ void SetUserObjectComparisonCallback(v8::UserObjectComparisonCallback callback);
-+ inline v8::UserObjectComparisonCallback UserObjectComparisonCallback() {
-+ return thread_local_top()->user_object_comparison_callback_;
-+ }
-+
- // Exception throwing support. The caller should use the result
- // of Throw() as its return value.
- Failure* Throw(Object* exception, MessageLocation* location = NULL);
-diff --git a/src/objects-inl.h b/src/objects-inl.h
-index 2e83fb7..13d7591 100644
---- a/src/objects-inl.h
-+++ b/src/objects-inl.h
-@@ -2749,14 +2749,14 @@ bool Map::is_extensible() {
-
- void Map::set_attached_to_shared_function_info(bool value) {
- if (value) {
-- set_bit_field2(bit_field2() | (1 << kAttachedToSharedFunctionInfo));
-+ set_bit_field3(bit_field3() | (1 << kAttachedToSharedFunctionInfo));
- } else {
-- set_bit_field2(bit_field2() & ~(1 << kAttachedToSharedFunctionInfo));
-+ set_bit_field3(bit_field3() & ~(1 << kAttachedToSharedFunctionInfo));
- }
- }
-
- bool Map::attached_to_shared_function_info() {
-- return ((1 << kAttachedToSharedFunctionInfo) & bit_field2()) != 0;
-+ return ((1 << kAttachedToSharedFunctionInfo) & bit_field3()) != 0;
- }
-
-
-@@ -2786,6 +2786,19 @@ bool Map::has_external_resource()
- }
-
-
-+void Map::set_use_user_object_comparison(bool value) {
-+ if (value) {
-+ set_bit_field2(bit_field2() | (1 << kUseUserObjectComparison));
-+ } else {
-+ set_bit_field2(bit_field2() & ~(1 << kUseUserObjectComparison));
-+ }
-+}
-+
-+bool Map::use_user_object_comparison() {
-+ return ((1 << kUseUserObjectComparison) & bit_field2()) != 0;
-+}
-+
-+
- void Map::set_named_interceptor_is_fallback(bool value)
- {
- if (value) {
-@@ -3334,6 +3347,8 @@ ACCESSORS(ObjectTemplateInfo, internal_field_count, Object,
- kInternalFieldCountOffset)
- ACCESSORS(ObjectTemplateInfo, has_external_resource, Object,
- kHasExternalResourceOffset)
-+ACCESSORS(ObjectTemplateInfo, use_user_object_comparison, Object,
-+ kUseUserObjectComparisonOffset)
-
- ACCESSORS(SignatureInfo, receiver, Object, kReceiverOffset)
- ACCESSORS(SignatureInfo, args, Object, kArgsOffset)
-diff --git a/src/objects.cc b/src/objects.cc
-index f5b6bee..6a4eff9 100644
---- a/src/objects.cc
-+++ b/src/objects.cc
-@@ -7686,8 +7686,8 @@ void SharedFunctionInfo::DetachInitialMap() {
- Map* map = reinterpret_cast<Map*>(initial_map());
-
- // Make the map remember to restore the link if it survives the GC.
-- map->set_bit_field2(
-- map->bit_field2() | (1 << Map::kAttachedToSharedFunctionInfo));
-+ map->set_bit_field3(
-+ map->bit_field3() | (1 << Map::kAttachedToSharedFunctionInfo));
-
- // Undo state changes made by StartInobjectTracking (except the
- // construction_count). This way if the initial map does not survive the GC
-@@ -7707,8 +7707,8 @@ void SharedFunctionInfo::DetachInitialMap() {
-
- // Called from GC, hence reinterpret_cast and unchecked accessors.
- void SharedFunctionInfo::AttachInitialMap(Map* map) {
-- map->set_bit_field2(
-- map->bit_field2() & ~(1 << Map::kAttachedToSharedFunctionInfo));
-+ map->set_bit_field3(
-+ map->bit_field3() & ~(1 << Map::kAttachedToSharedFunctionInfo));
-
- // Resume inobject slack tracking.
- set_initial_map(map);
-diff --git a/src/objects.h b/src/objects.h
-index b71eaac..3137437 100644
---- a/src/objects.h
-+++ b/src/objects.h
-@@ -4258,6 +4258,11 @@ class Map: public HeapObject {
- inline void set_has_external_resource(bool value);
- inline bool has_external_resource();
-
-+ // Tells whether the user object comparison callback should be used for
-+ // comparisons involving this object
-+ inline void set_use_user_object_comparison(bool value);
-+ inline bool use_user_object_comparison();
-+
- // [prototype]: implicit prototype object.
- DECL_ACCESSORS(prototype, Object)
-
-@@ -4505,7 +4510,7 @@ class Map: public HeapObject {
- static const int kIsExtensible = 0;
- static const int kFunctionWithPrototype = 1;
- static const int kStringWrapperSafeForDefaultValueOf = 2;
-- static const int kAttachedToSharedFunctionInfo = 3;
-+ static const int kUseUserObjectComparison = 3;
- // No bits can be used after kElementsKindFirstBit, they are all reserved for
- // storing ElementKind.
- static const int kElementsKindShift = 4;
-@@ -4524,6 +4529,7 @@ class Map: public HeapObject {
- static const int kIsShared = 0;
- static const int kNamedInterceptorIsFallback = 1;
- static const int kHasInstanceCallHandler = 2;
-+ static const int kAttachedToSharedFunctionInfo = 3;
-
- // Layout of the default cache. It holds alternating name and code objects.
- static const int kCodeCacheEntrySize = 2;
-@@ -7556,6 +7562,7 @@ class ObjectTemplateInfo: public TemplateInfo {
- DECL_ACCESSORS(constructor, Object)
- DECL_ACCESSORS(internal_field_count, Object)
- DECL_ACCESSORS(has_external_resource, Object)
-+ DECL_ACCESSORS(use_user_object_comparison, Object)
-
- static inline ObjectTemplateInfo* cast(Object* obj);
-
-@@ -7573,7 +7580,8 @@ class ObjectTemplateInfo: public TemplateInfo {
- static const int kInternalFieldCountOffset =
- kConstructorOffset + kPointerSize;
- static const int kHasExternalResourceOffset = kInternalFieldCountOffset + kPointerSize;
-- static const int kSize = kHasExternalResourceOffset + kPointerSize;
-+ static const int kUseUserObjectComparisonOffset = kHasExternalResourceOffset + kPointerSize;
-+ static const int kSize = kUseUserObjectComparisonOffset + kPointerSize;
- };
-
-
-diff --git a/src/runtime.cc b/src/runtime.cc
-index b64e66b..8010169 100644
---- a/src/runtime.cc
-+++ b/src/runtime.cc
-@@ -7095,6 +7095,29 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringEquals) {
- }
-
-
-+RUNTIME_FUNCTION(MaybeObject*, Runtime_UserObjectEquals) {
-+ NoHandleAllocation ha;
-+ ASSERT(args.length() == 2);
-+
-+ CONVERT_CHECKED(JSObject, lhs, args[1]);
-+ CONVERT_CHECKED(JSObject, rhs, args[0]);
-+
-+ bool result;
-+
-+ v8::UserObjectComparisonCallback callback = isolate->UserObjectComparisonCallback();
-+ if (callback) {
-+ HandleScope scope(isolate);
-+ Handle<JSObject> lhs_handle(lhs);
-+ Handle<JSObject> rhs_handle(rhs);
-+ result = callback(v8::Utils::ToLocal(lhs_handle), v8::Utils::ToLocal(rhs_handle));
-+ } else {
-+ result = (lhs == rhs);
-+ }
-+
-+ return Smi::FromInt(result?0:1);
-+}
-+
-+
- RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberCompare) {
- NoHandleAllocation ha;
- ASSERT(args.length() == 3);
-diff --git a/src/runtime.h b/src/runtime.h
-index aada06d..cd36da9 100644
---- a/src/runtime.h
-+++ b/src/runtime.h
-@@ -157,6 +157,7 @@ namespace internal {
- /* Comparisons */ \
- F(NumberEquals, 2, 1) \
- F(StringEquals, 2, 1) \
-+ F(UserObjectEquals, 2, 1) \
- \
- F(NumberCompare, 3, 1) \
- F(SmiLexicographicCompare, 2, 1) \
-diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
-index f30221f..ff8337f 100644
---- a/src/x64/code-stubs-x64.cc
-+++ b/src/x64/code-stubs-x64.cc
-@@ -3088,6 +3088,37 @@ void CompareStub::Generate(MacroAssembler* masm) {
- // NOTICE! This code is only reached after a smi-fast-case check, so
- // it is certain that at least one operand isn't a smi.
-
-+ {
-+ Label not_user_equal, user_equal;
-+ __ JumpIfSmi(rax, &not_user_equal);
-+ __ JumpIfSmi(rdx, &not_user_equal);
-+
-+ __ CmpObjectType(rax, JS_OBJECT_TYPE, rbx);
-+ __ j(not_equal, &not_user_equal);
-+
-+ __ CmpObjectType(rdx, JS_OBJECT_TYPE, rcx);
-+ __ j(not_equal, &not_user_equal);
-+
-+ __ testb(FieldOperand(rbx, Map::kBitField2Offset),
-+ Immediate(1 << Map::kUseUserObjectComparison));
-+ __ j(not_zero, &user_equal);
-+ __ testb(FieldOperand(rcx, Map::kBitField2Offset),
-+ Immediate(1 << Map::kUseUserObjectComparison));
-+ __ j(not_zero, &user_equal);
-+
-+ __ jmp(&not_user_equal);
-+
-+ __ bind(&user_equal);
-+
-+ __ pop(rbx); // Return address.
-+ __ push(rax);
-+ __ push(rdx);
-+ __ push(rbx);
-+ __ TailCallRuntime(Runtime::kUserObjectEquals, 2, 1);
-+
-+ __ bind(&not_user_equal);
-+ }
-+
- // Two identical objects are equal unless they are both NaN or undefined.
- {
- Label not_identical;
-@@ -5421,8 +5452,14 @@ void ICCompareStub::GenerateObjects(MacroAssembler* masm) {
-
- __ CmpObjectType(rax, JS_OBJECT_TYPE, rcx);
- __ j(not_equal, &miss, Label::kNear);
-+ __ testb(FieldOperand(rcx, Map::kBitField2Offset),
-+ Immediate(1 << Map::kUseUserObjectComparison));
-+ __ j(not_zero, &miss, Label::kNear);
- __ CmpObjectType(rdx, JS_OBJECT_TYPE, rcx);
- __ j(not_equal, &miss, Label::kNear);
-+ __ testb(FieldOperand(rcx, Map::kBitField2Offset),
-+ Immediate(1 << Map::kUseUserObjectComparison));
-+ __ j(not_zero, &miss, Label::kNear);
-
- ASSERT(GetCondition() == equal);
- __ subq(rax, rdx);
---
-1.7.7.3
-
diff --git a/src/v8/0007-Allow-a-script-to-be-flagged-as-native.patch b/src/v8/0007-Allow-a-script-to-be-flagged-as-native.patch
deleted file mode 100644
index b6380b1b8e..0000000000
--- a/src/v8/0007-Allow-a-script-to-be-flagged-as-native.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 519fec2ddc92193760dc2a6599f91ff4eb11563c Mon Sep 17 00:00:00 2001
-From: Aaron Kennedy <aaron.kennedy@nokia.com>
-Date: Fri, 9 Sep 2011 14:16:12 +1000
-Subject: [PATCH 07/12] Allow a script to be flagged as "native"
-
-Native scripts do not appear in backtraces, or in the source and
-line number when exceptions are thrown from within them. This is
-useful to be able to write code in JavaScript instead of C++ and
-still have it appear sensibly to the user.
----
- include/v8.h | 5 +++--
- src/compiler.cc | 2 +-
- 2 files changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/include/v8.h b/include/v8.h
-index 6baf2b2..229ddbd 100644
---- a/include/v8.h
-+++ b/include/v8.h
-@@ -588,8 +588,9 @@ class ScriptOrigin {
- class V8EXPORT Script {
- public:
- enum CompileFlags {
-- Default = 0x00,
-- QmlMode = 0x01
-+ Default = 0x00,
-+ QmlMode = 0x01,
-+ NativeMode = 0x02
- };
-
- /**
-diff --git a/src/compiler.cc b/src/compiler.cc
-index 4902e72..cabca74 100644
---- a/src/compiler.cc
-+++ b/src/compiler.cc
-@@ -499,7 +499,7 @@ Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source,
-
- // Create a script object describing the script to be compiled.
- Handle<Script> script = FACTORY->NewScript(source);
-- if (natives == NATIVES_CODE) {
-+ if (natives == NATIVES_CODE || compile_flags & v8::Script::NativeMode) {
- script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
- }
- if (!script_name.is_null()) {
---
-1.7.7.3
-
diff --git a/src/v8/0008-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch b/src/v8/0008-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch
deleted file mode 100644
index 5e36024232..0000000000
--- a/src/v8/0008-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From de3e14564f163d808a3d10397a3018e6aaeb727b Mon Sep 17 00:00:00 2001
-From: Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
-Date: Tue, 7 Dec 2010 11:56:42 +0100
-Subject: [PATCH 08/12] QtScript/V8: Add new v8 api to check if a value is an
- error.
-
-New function v8::Value::IsError was created.
-
-This API is experimental and added only for the purposes of our
-research.
----
- include/v8.h | 5 +++++
- src/api.cc | 6 ++++++
- src/heap.h | 1 +
- 3 files changed, 12 insertions(+), 0 deletions(-)
-
-diff --git a/include/v8.h b/include/v8.h
-index 229ddbd..d995e54 100644
---- a/include/v8.h
-+++ b/include/v8.h
-@@ -967,6 +967,11 @@ class Value : public Data {
- */
- V8EXPORT bool IsRegExp() const;
-
-+ /**
-+ * Returns true if this value is an Error.
-+ */
-+ V8EXPORT bool IsError() const;
-+
- V8EXPORT Local<Boolean> ToBoolean() const;
- V8EXPORT Local<Number> ToNumber() const;
- V8EXPORT Local<String> ToString() const;
-diff --git a/src/api.cc b/src/api.cc
-index 974d702..a16ef65 100644
---- a/src/api.cc
-+++ b/src/api.cc
-@@ -2316,6 +2316,12 @@ bool Value::IsRegExp() const {
- return obj->IsJSRegExp();
- }
-
-+bool Value::IsError() const {
-+ if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsError()")) return false;
-+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
-+ return obj->HasSpecificClassOf(HEAP->Error_symbol());
-+}
-+
-
- Local<String> Value::ToString() const {
- i::Handle<i::Object> obj = Utils::OpenHandle(this);
-diff --git a/src/heap.h b/src/heap.h
-index 5e90964..6166cde 100644
---- a/src/heap.h
-+++ b/src/heap.h
-@@ -190,6 +190,7 @@ inline Heap* _inline_get_heap_();
- V(string_symbol, "string") \
- V(String_symbol, "String") \
- V(Date_symbol, "Date") \
-+ V(Error_symbol, "Error") \
- V(this_symbol, "this") \
- V(to_string_symbol, "toString") \
- V(char_at_symbol, "CharAt") \
---
-1.7.7.3
-
diff --git a/src/v8/0009-Fix-deprecated-Python-code.patch b/src/v8/0009-Fix-deprecated-Python-code.patch
deleted file mode 100644
index c0ca24a9ff..0000000000
--- a/src/v8/0009-Fix-deprecated-Python-code.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 7084bd94a99db246baa4f1d050a6f23cfd6adc14 Mon Sep 17 00:00:00 2001
-From: Kent Hansen <kent.hansen@nokia.com>
-Date: Fri, 2 Sep 2011 12:03:09 +0200
-Subject: [PATCH 09/12] Fix deprecated Python code
-
-Needed to make the scripts run on Python 3, which is the
-default python interpreter on some newer distros.
-
-Patch from http://code.google.com/p/v8/issues/detail?id=1391
----
- tools/js2c.py | 4 ++--
- tools/jsmin.py | 2 +-
- 2 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/tools/js2c.py b/tools/js2c.py
-index a2ea8ea..fe6a72e 100644
---- a/tools/js2c.py
-+++ b/tools/js2c.py
-@@ -194,14 +194,14 @@ def ReadMacros(lines):
- macro_match = MACRO_PATTERN.match(line)
- if macro_match:
- name = macro_match.group(1)
-- args = map(string.strip, macro_match.group(2).split(','))
-+ args = args = [match.strip() for match in macro_match.group(2).split(',')]
- body = macro_match.group(3).strip()
- macros.append((re.compile("\\b%s\\(" % name), TextMacro(args, body)))
- else:
- python_match = PYTHON_MACRO_PATTERN.match(line)
- if python_match:
- name = python_match.group(1)
-- args = map(string.strip, python_match.group(2).split(','))
-+ args = [match.strip() for match in python_match.group(2).split(',')]
- body = python_match.group(3).strip()
- fun = eval("lambda " + ",".join(args) + ': ' + body)
- macros.append((re.compile("\\b%s\\(" % name), PythonMacro(args, fun)))
-diff --git a/tools/jsmin.py b/tools/jsmin.py
-index 646bf14..395441b 100644
---- a/tools/jsmin.py
-+++ b/tools/jsmin.py
-@@ -154,7 +154,7 @@ class JavaScriptMinifier(object):
- return var_name
- while True:
- identifier_first_char = self.identifier_counter % 52
-- identifier_second_char = self.identifier_counter / 52
-+ identifier_second_char = self.identifier_counter // 52
- new_identifier = self.CharFromNumber(identifier_first_char)
- if identifier_second_char != 0:
- new_identifier = (
---
-1.7.7.3
-
diff --git a/src/v8/0010-Remove-execute-flag-from-v8-debug.h.patch b/src/v8/0010-Remove-execute-flag-from-v8-debug.h.patch
deleted file mode 100644
index 243692e9ee..0000000000
--- a/src/v8/0010-Remove-execute-flag-from-v8-debug.h.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-From 04779c9a6f99fc097af68cf75a27b1d6a76c3e9d Mon Sep 17 00:00:00 2001
-From: Aaron Kennedy <aaron.kennedy@nokia.com>
-Date: Thu, 25 Aug 2011 11:09:58 +1000
-Subject: [PATCH 10/12] Remove execute flag from v8-debug.h
-
----
- 0 files changed, 0 insertions(+), 0 deletions(-)
- mode change 100755 => 100644 include/v8-debug.h
-
-diff --git a/include/v8-debug.h b/include/v8-debug.h
-old mode 100755
-new mode 100644
---
-1.7.7.3
-
diff --git a/src/v8/0011-Fix-warnings.patch b/src/v8/0011-Fix-warnings.patch
deleted file mode 100644
index 39b5438e23..0000000000
--- a/src/v8/0011-Fix-warnings.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From eb7bb4628dc4480210818e371934a76ae1f7fb91 Mon Sep 17 00:00:00 2001
-From: Aaron Kennedy <aaron.kennedy@nokia.com>
-Date: Fri, 27 May 2011 13:04:15 +1000
-Subject: [PATCH 11/12] Fix warnings
-
----
- include/v8.h | 16 ++++++++--------
- 1 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/include/v8.h b/include/v8.h
-index d995e54..a7b5c8a 100644
---- a/include/v8.h
-+++ b/include/v8.h
-@@ -2579,7 +2579,7 @@ class V8EXPORT Extension { // NOLINT
- int source_length = -1);
- virtual ~Extension() { }
- virtual v8::Handle<v8::FunctionTemplate>
-- GetNativeFunction(v8::Handle<v8::String> name) {
-+ GetNativeFunction(v8::Handle<v8::String>) {
- return v8::Handle<v8::FunctionTemplate>();
- }
-
-@@ -3946,13 +3946,13 @@ class Internals {
- return *reinterpret_cast<T*>(addr);
- }
-
-- static inline bool CanCastToHeapObject(void* o) { return false; }
-- static inline bool CanCastToHeapObject(Context* o) { return true; }
-- static inline bool CanCastToHeapObject(String* o) { return true; }
-- static inline bool CanCastToHeapObject(Object* o) { return true; }
-- static inline bool CanCastToHeapObject(Message* o) { return true; }
-- static inline bool CanCastToHeapObject(StackTrace* o) { return true; }
-- static inline bool CanCastToHeapObject(StackFrame* o) { return true; }
-+ static inline bool CanCastToHeapObject(void*) { return false; }
-+ static inline bool CanCastToHeapObject(Context*) { return true; }
-+ static inline bool CanCastToHeapObject(String*) { return true; }
-+ static inline bool CanCastToHeapObject(Object*) { return true; }
-+ static inline bool CanCastToHeapObject(Message*) { return true; }
-+ static inline bool CanCastToHeapObject(StackTrace*) { return true; }
-+ static inline bool CanCastToHeapObject(StackFrame*) { return true; }
- };
-
- } // namespace internal
---
-1.7.7.3
-
diff --git a/src/v8/0012-Add-flag-to-avoid-breakpoint-relocation.patch b/src/v8/0012-Add-flag-to-avoid-breakpoint-relocation.patch
deleted file mode 100644
index 922b011776..0000000000
--- a/src/v8/0012-Add-flag-to-avoid-breakpoint-relocation.patch
+++ /dev/null
@@ -1,147 +0,0 @@
-From d28b6a024826aaa48a8b3e69c096d01c91aff2c9 Mon Sep 17 00:00:00 2001
-From: Kai Koehne <kai.koehne@nokia.com>
-Date: Thu, 10 Nov 2011 16:00:37 +0100
-Subject: [PATCH 12/12] Add flag to avoid breakpoint relocation
-
-Add a flag that prevents v8 from relocating breakpoints across
-line boundaries.
----
- src/debug.cc | 29 +++++++++++++++++++---
- src/flag-definitions.h | 1 +
- test/cctest/test-debug.cc | 59 +++++++++++++++++++++++++++++++++++++++++++++
- 3 files changed, 85 insertions(+), 4 deletions(-)
-
-diff --git a/src/debug.cc b/src/debug.cc
-index dc9f297..d32574b 100644
---- a/src/debug.cc
-+++ b/src/debug.cc
-@@ -1131,6 +1131,17 @@ Handle<DebugInfo> Debug::GetDebugInfo(Handle<SharedFunctionInfo> shared) {
- return Handle<DebugInfo>(DebugInfo::cast(shared->debug_info()));
- }
-
-+static bool ContainsLineBreak(String *string, int from, int to)
-+{
-+ ASSERT(from >= 0);
-+ ASSERT(from <= to);
-+ const int end = (string->length() < to) ? string->length() : to;
-+ for (int pos = from; pos < end; ++pos) {
-+ if (string->Get(pos) == '\n')
-+ return true;
-+ }
-+ return false;
-+}
-
- void Debug::SetBreakPoint(Handle<SharedFunctionInfo> shared,
- Handle<Object> break_point_object,
-@@ -1151,12 +1162,22 @@ void Debug::SetBreakPoint(Handle<SharedFunctionInfo> shared,
- // Find the break point and change it.
- BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS);
- it.FindBreakLocationFromPosition(*source_position);
-- it.SetBreakPoint(break_point_object);
-
-- *source_position = it.position();
-+ bool acceptBreak = true;
-+ if (!FLAG_breakpoint_relocation) {
-+ if (String *sourceStr = String::cast(shared->GetSourceCode())) {
-+ acceptBreak = !ContainsLineBreak(sourceStr, *source_position, it.position());
-+ }
-+ }
-+
-+ if (acceptBreak) {
-+ it.SetBreakPoint(break_point_object);
-
-- // At least one active break point now.
-- ASSERT(debug_info->GetBreakPointCount() > 0);
-+ *source_position = it.position();
-+
-+ // At least one active break point now.
-+ ASSERT(debug_info->GetBreakPointCount() > 0);
-+ }
- }
-
-
-diff --git a/src/flag-definitions.h b/src/flag-definitions.h
-index ee6ef01..fe64a96 100644
---- a/src/flag-definitions.h
-+++ b/src/flag-definitions.h
-@@ -233,6 +233,7 @@ DEFINE_bool(trace_debug_json, false, "trace debugging JSON request/response")
- DEFINE_bool(debugger_auto_break, true,
- "automatically set the debug break flag when debugger commands are "
- "in the queue")
-+DEFINE_bool(breakpoint_relocation, true, "relocate breakpoints to the next executable line")
- DEFINE_bool(enable_liveedit, true, "enable liveedit experimental feature")
-
- // execution.cc
-diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
-index cf723ba..7e51c34 100644
---- a/test/cctest/test-debug.cc
-+++ b/test/cctest/test-debug.cc
-@@ -2305,6 +2305,65 @@ TEST(ScriptBreakPointTopLevelCrash) {
- CheckDebuggerUnloaded();
- }
-
-+// Test that breakpoint_relocation flag is honored
-+TEST(ScriptBreakPointNoRelocation) {
-+ i::FLAG_breakpoint_relocation = false;
-+
-+ v8::HandleScope scope;
-+ DebugLocalContext env;
-+ env.ExposeDebug();
-+
-+ // Create a function for checking the function when hitting a break point.
-+ frame_function_name = CompileFunction(&env,
-+ frame_function_name_source,
-+ "frame_function_name");
-+
-+ v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount,
-+ v8::Undefined());
-+
-+ v8::Local<v8::String> script1 = v8::String::New(
-+ "a = 0 // line 0\n"
-+ " // line 1\n"
-+ " // line 2\n"
-+ " // line 3\n"
-+ "function f() { // line 4\n"
-+ " return 0; // line 5\n"
-+ "} // line 6");
-+
-+ // Set the script break point on the empty line
-+ SetScriptBreakPointByNameFromJS("test.html", 2, -1);
-+
-+ // Compile the script and call the function.
-+ v8::ScriptOrigin origin(v8::String::New("test.html"), v8::Integer::New(0));
-+ v8::Script::Compile(script1, &origin)->Run();
-+ v8::Local<v8::Function> f
-+ = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
-+ f->Call(env->Global(), 0, NULL);
-+
-+ // Check that a break point was not hit
-+ CHECK_EQ(0, break_point_hit_count);
-+
-+ v8::Local<v8::String> script2 = v8::String::New(
-+ "a = 0 // line 0\n"
-+ "function g() { // line 1\n"
-+ " return 0; // line 2\n"
-+ "} // line 3\n"
-+ "function f() { // line 4\n"
-+ " return 0; // line 5\n"
-+ "} // line 6");
-+
-+ // Compile the script and call the new function
-+ v8::Script::Compile(script2, &origin)->Run();
-+ v8::Local<v8::Function> g
-+ = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("g")));
-+ g->Call(env->Global(), 0, NULL);
-+
-+ // Check that a break point was not hit
-+ CHECK_EQ(1, break_point_hit_count);
-+
-+ v8::Debug::SetDebugEventListener(NULL);
-+ CheckDebuggerUnloaded();
-+}
-
- // Test that it is possible to remove the last break point for a function
- // inside the break handling of that break point.
---
-1.7.7.3
-
diff --git a/src/v8/README b/src/v8/README
deleted file mode 100644
index 850f70326e..0000000000
--- a/src/v8/README
+++ /dev/null
@@ -1 +0,0 @@
-These patches apply cleanly against v8 at e123c9dfe54146f8bfca38841255f63a95a00a19
diff --git a/src/v8/v8.pri b/src/v8/v8.pri
deleted file mode 100644
index 11b74c8151..0000000000
--- a/src/v8/v8.pri
+++ /dev/null
@@ -1,304 +0,0 @@
-isEmpty(QT_ARCH) {
- # We're most likely being parsed in a fromfile() call, in which case the
- # QMake environment isn't complete. Load qt_config in an attempt to set
- # the variables we need (QT_ARCH and CONFIG, in particular).
- load(qt_config)
-}
-
-isEmpty(V8_TARGET_ARCH) {
- # Detect target
- equals(QT_ARCH, x86_64)|contains(CONFIG, x86_64):V8_TARGET_ARCH = x64
- else:equals(QT_ARCH, "i386"): V8_TARGET_ARCH = ia32
- else:equals(QT_ARCH, "mips"): V8_TARGET_ARCH = mips
- else:equals(QT_ARCH, "arm"): V8_TARGET_ARCH = arm
- else:equals(QMAKE_HOST.arch, armv7l): V8_TARGET_ARCH = arm
- else:equals(QMAKE_HOST.arch, armv5tel): V8_TARGET_ARCH = arm
- else:equals(QMAKE_HOST.arch, x86_64): V8_TARGET_ARCH = x64
- else:equals(QMAKE_HOST.arch, x86): V8_TARGET_ARCH = ia32
- else:equals(QMAKE_HOST.arch, i386): V8_TARGET_ARCH = ia32
- else:equals(QMAKE_HOST.arch, i686): V8_TARGET_ARCH = ia32
- else:error("Couldn't detect supported v8 architecture ($$QMAKE_HOST.arch/$$QT_ARCH). Currently supported architectures are: x64, x86 and arm")
-}
-
-include($$PWD/v8base.pri)
-
-# In debug-and-release builds, generated sources must not go to the same
-# directory, or they could clobber each other in highly parallelized builds
-CONFIG(debug, debug|release):V8_GENERATED_SOURCES_DIR = generated-debug
-else: V8_GENERATED_SOURCES_DIR = generated-release
-
-# this maybe removed in future
-DEFINES += ENABLE_DEBUGGER_SUPPORT
-
-# this is needed by crankshaft ( http://code.google.com/p/v8/issues/detail?id=1271 )
-DEFINES += ENABLE_VMSTATE_TRACKING ENABLE_LOGGING_AND_PROFILING
-
-CONFIG(debug, debug|release) {
- DEFINES += DEBUG V8_ENABLE_CHECKS OBJECT_PRINT ENABLE_DISASSEMBLER
-} else {
- DEFINES += NDEBUG
-}
-
-V8SRC = $$V8DIR/src
-
-INCLUDEPATH += \
- $$V8SRC
-
-SOURCES += \
- $$V8SRC/accessors.cc \
- $$V8SRC/allocation.cc \
- $$V8SRC/api.cc \
- $$V8SRC/assembler.cc \
- $$V8SRC/ast.cc \
- $$V8SRC/atomicops_internals_x86_gcc.cc \
- $$V8SRC/bignum.cc \
- $$V8SRC/bignum-dtoa.cc \
- $$V8SRC/bootstrapper.cc \
- $$V8SRC/builtins.cc \
- $$V8SRC/cached-powers.cc \
- $$V8SRC/checks.cc \
- $$V8SRC/circular-queue.cc \
- $$V8SRC/code-stubs.cc \
- $$V8SRC/codegen.cc \
- $$V8SRC/compilation-cache.cc \
- $$V8SRC/compiler.cc \
- $$V8SRC/contexts.cc \
- $$V8SRC/conversions.cc \
- $$V8SRC/counters.cc \
- $$V8SRC/cpu-profiler.cc \
- $$V8SRC/data-flow.cc \
- $$V8SRC/dateparser.cc \
- $$V8SRC/debug-agent.cc \
- $$V8SRC/debug.cc \
- $$V8SRC/deoptimizer.cc \
- $$V8SRC/disassembler.cc \
- $$V8SRC/diy-fp.cc \
- $$V8SRC/dtoa.cc \
- $$V8SRC/elements.cc \
- $$V8SRC/execution.cc \
- $$V8SRC/factory.cc \
- $$V8SRC/flags.cc \
- $$V8SRC/frames.cc \
- $$V8SRC/full-codegen.cc \
- $$V8SRC/func-name-inferrer.cc \
- $$V8SRC/gdb-jit.cc \
- $$V8SRC/global-handles.cc \
- $$V8SRC/fast-dtoa.cc \
- $$V8SRC/fixed-dtoa.cc \
- $$V8SRC/handles.cc \
- $$V8SRC/hashmap.cc \
- $$V8SRC/heap-profiler.cc \
- $$V8SRC/heap.cc \
- $$V8SRC/hydrogen.cc \
- $$V8SRC/hydrogen-instructions.cc \
- $$V8SRC/ic.cc \
- $$V8SRC/incremental-marking.cc \
- $$V8SRC/inspector.cc \
- $$V8SRC/interpreter-irregexp.cc \
- $$V8SRC/isolate.cc \
- $$V8SRC/jsregexp.cc \
- $$V8SRC/lithium-allocator.cc \
- $$V8SRC/lithium.cc \
- $$V8SRC/liveedit.cc \
- $$V8SRC/liveobjectlist.cc \
- $$V8SRC/log-utils.cc \
- $$V8SRC/log.cc \
- $$V8SRC/mark-compact.cc \
- $$V8SRC/messages.cc \
- $$V8SRC/objects.cc \
- $$V8SRC/objects-printer.cc \
- $$V8SRC/objects-visiting.cc \
- $$V8SRC/parser.cc \
- $$V8SRC/preparser.cc \
- $$V8SRC/preparse-data.cc \
- $$V8SRC/profile-generator.cc \
- $$V8SRC/property.cc \
- $$V8SRC/regexp-macro-assembler-irregexp.cc \
- $$V8SRC/regexp-macro-assembler.cc \
- $$V8SRC/regexp-stack.cc \
- $$V8SRC/rewriter.cc \
- $$V8SRC/runtime.cc \
- $$V8SRC/runtime-profiler.cc \
- $$V8SRC/safepoint-table.cc \
- $$V8SRC/scanner.cc \
- $$V8SRC/scanner-character-streams.cc \
- $$V8SRC/scopeinfo.cc \
- $$V8SRC/scopes.cc \
- $$V8SRC/serialize.cc \
- $$V8SRC/snapshot-common.cc \
- $$V8SRC/spaces.cc \
- $$V8SRC/string-search.cc \
- $$V8SRC/string-stream.cc \
- $$V8SRC/strtod.cc \
- $$V8SRC/stub-cache.cc \
- $$V8SRC/token.cc \
- $$V8SRC/type-info.cc \
- $$V8SRC/unicode.cc \
- $$V8SRC/utils.cc \
- $$V8SRC/v8-counters.cc \
- $$V8SRC/v8.cc \
- $$V8SRC/v8conversions.cc \
- $$V8SRC/v8threads.cc \
- $$V8SRC/v8utils.cc \
- $$V8SRC/variables.cc \
- $$V8SRC/version.cc \
- $$V8SRC/store-buffer.cc \
- $$V8SRC/zone.cc \
- $$V8SRC/extensions/gc-extension.cc \
- $$V8SRC/extensions/externalize-string-extension.cc
-
-equals(V8_TARGET_ARCH, arm) {
-DEFINES += V8_TARGET_ARCH_ARM
-DEFINES += USE_EABI_HARDFLOAT=1 CAN_USE_VFP_INSTRUCTIONS
-SOURCES += \
- $$V8SRC/arm/builtins-arm.cc \
- $$V8SRC/arm/code-stubs-arm.cc \
- $$V8SRC/arm/codegen-arm.cc \
- $$V8SRC/arm/constants-arm.cc \
- $$V8SRC/arm/cpu-arm.cc \
- $$V8SRC/arm/debug-arm.cc \
- $$V8SRC/arm/deoptimizer-arm.cc \
- $$V8SRC/arm/disasm-arm.cc \
- $$V8SRC/arm/frames-arm.cc \
- $$V8SRC/arm/full-codegen-arm.cc \
- $$V8SRC/arm/ic-arm.cc \
- $$V8SRC/arm/lithium-arm.cc \
- $$V8SRC/arm/lithium-codegen-arm.cc \
- $$V8SRC/arm/lithium-gap-resolver-arm.cc \
- $$V8SRC/arm/macro-assembler-arm.cc \
- $$V8SRC/arm/regexp-macro-assembler-arm.cc \
- $$V8SRC/arm/stub-cache-arm.cc \
- $$V8SRC/arm/assembler-arm.cc
-} else:equals(V8_TARGET_ARCH, ia32) {
-DEFINES += V8_TARGET_ARCH_IA32
-SOURCES += \
- $$V8SRC/ia32/assembler-ia32.cc \
- $$V8SRC/ia32/builtins-ia32.cc \
- $$V8SRC/ia32/code-stubs-ia32.cc \
- $$V8SRC/ia32/codegen-ia32.cc \
- $$V8SRC/ia32/cpu-ia32.cc \
- $$V8SRC/ia32/debug-ia32.cc \
- $$V8SRC/ia32/deoptimizer-ia32.cc \
- $$V8SRC/ia32/disasm-ia32.cc \
- $$V8SRC/ia32/frames-ia32.cc \
- $$V8SRC/ia32/full-codegen-ia32.cc \
- $$V8SRC/ia32/ic-ia32.cc \
- $$V8SRC/ia32/lithium-codegen-ia32.cc \
- $$V8SRC/ia32/lithium-gap-resolver-ia32.cc \
- $$V8SRC/ia32/lithium-ia32.cc \
- $$V8SRC/ia32/macro-assembler-ia32.cc \
- $$V8SRC/ia32/regexp-macro-assembler-ia32.cc \
- $$V8SRC/ia32/stub-cache-ia32.cc
-} else:equals(V8_TARGET_ARCH, x64) {
-# FIXME What about 32-bit Macs?
-DEFINES += V8_TARGET_ARCH_X64
-SOURCES += \
- $$V8SRC/x64/assembler-x64.cc \
- $$V8SRC/x64/builtins-x64.cc \
- $$V8SRC/x64/code-stubs-x64.cc \
- $$V8SRC/x64/codegen-x64.cc \
- $$V8SRC/x64/cpu-x64.cc \
- $$V8SRC/x64/debug-x64.cc \
- $$V8SRC/x64/deoptimizer-x64.cc \
- $$V8SRC/x64/disasm-x64.cc \
- $$V8SRC/x64/frames-x64.cc \
- $$V8SRC/x64/full-codegen-x64.cc \
- $$V8SRC/x64/ic-x64.cc \
- $$V8SRC/x64/lithium-codegen-x64.cc \
- $$V8SRC/x64/lithium-gap-resolver-x64.cc \
- $$V8SRC/x64/lithium-x64.cc \
- $$V8SRC/x64/macro-assembler-x64.cc \
- $$V8SRC/x64/regexp-macro-assembler-x64.cc \
- $$V8SRC/x64/stub-cache-x64.cc
-} else:equals(V8_TARGET_ARCH, mips) {
-DEFINES += V8_TARGET_MIPS
-SOURCES += \
- $$V8SRC/mips/assembler-mips.cc \
- $$V8SRC/mips/builtins-mips.cc \
- $$V8SRC/mips/codegen-mips.cc \
- $$V8SRC/mips/code-stubs-mips.cc \
- $$V8SRC/mips/constants-mips.cc \
- $$V8SRC/mips/cpu-mips.cc \
- $$V8SRC/mips/debug-mips.cc \
- $$V8SRC/mips/deoptimizer-mips.cc \
- $$V8SRC/mips/disasm-mips.cc \
- $$V8SRC/mips/frames-mips.cc \
- $$V8SRC/mips/full-codegen-mips.cc \
- $$V8SRC/mips/ic-mips.cc \
- $$V8SRC/mips/macro-assembler-mips.cc \
- $$V8SRC/mips/regexp-macro-assembler-mips.cc \
- $$V8SRC/mips/simulator-mips.cc \
- $$V8SRC/mips/stub-cache-mips.cc
-}
-
-unix:!symbian:!macx {
-SOURCES += \
- $$V8SRC/platform-linux.cc \
- $$V8SRC/platform-posix.cc
-}
-
-#os:macos
-macx {
-SOURCES += \
- $$V8SRC/platform-macos.cc \
- $$V8SRC/platform-posix.cc
-}
-
-win32 {
-SOURCES += \
- $$V8SRC/platform-win32.cc \
- $$V8SRC/win32-math.cc
-LIBS += -lWs2_32 -lWinmm
-win32-msvc*: QMAKE_CXXFLAGS += -wd4100 -wd 4291 -wd4351 -wd4355 -wd4800
-win32-msvc*:arch_i386: DEFINES += _USE_32BIT_TIME_T
-}
-
-#mode:debug
-CONFIG(debug) {
- SOURCES += \
- $$V8SRC/objects-debug.cc \
- $$V8SRC/prettyprinter.cc \
- $$V8SRC/regexp-macro-assembler-tracer.cc
-}
-
-V8_LIBRARY_FILES = \
- $$V8SRC/runtime.js \
- $$V8SRC/v8natives.js \
- $$V8SRC/array.js \
- $$V8SRC/string.js \
- $$V8SRC/uri.js \
- $$V8SRC/math.js \
- $$V8SRC/messages.js \
- $$V8SRC/apinatives.js \
- $$V8SRC/date.js \
- $$V8SRC/regexp.js \
- $$V8SRC/json.js \
- $$V8SRC/liveedit-debugger.js \
- $$V8SRC/mirror-debugger.js \
- $$V8SRC/debug-debugger.js
-
-V8_EXPERIMENTAL_LIBRARY_FILES = \
- $$V8SRC/proxy.js \
-
-v8_js2c.commands = python $$V8DIR/tools/js2c.py $$V8_GENERATED_SOURCES_DIR/libraries.cpp CORE off
-v8_js2c.commands += $$V8SRC/macros.py ${QMAKE_FILE_IN}
-v8_js2c.output = $$V8_GENERATED_SOURCES_DIR/libraries.cpp
-v8_js2c.input = V8_LIBRARY_FILES
-v8_js2c.variable_out = SOURCES
-v8_js2c.dependency_type = TYPE_C
-v8_js2c.depends = $$V8DIR/tools/js2c.py $$V8SRC/macros.py
-v8_js2c.CONFIG += combine
-v8_js2c.name = generating[v8] ${QMAKE_FILE_IN}
-silent:v8_js2c.commands = @echo generating[v8] ${QMAKE_FILE_IN} && $$v8_js2c.commands
-
-v8_js2c_experimental.commands = python $$V8DIR/tools/js2c.py $$V8_GENERATED_SOURCES_DIR/experimental-libraries.cpp EXPERIMENTAL off
-v8_js2c_experimental.commands += $$V8SRC/macros.py ${QMAKE_FILE_IN}
-v8_js2c_experimental.output = $$V8_GENERATED_SOURCES_DIR/experimental-libraries.cpp
-v8_js2c_experimental.input = V8_EXPERIMENTAL_LIBRARY_FILES
-v8_js2c_experimental.variable_out = SOURCES
-v8_js2c_experimental.dependency_type = TYPE_C
-v8_js2c_experimental.depends = $$V8DIR/tools/js2c.py $$V8SRC/macros.py
-v8_js2c_experimental.CONFIG += combine
-v8_js2c_experimental.name = generating[v8] ${QMAKE_FILE_IN}
-
-QMAKE_EXTRA_COMPILERS += v8_js2c v8_js2c_experimental
diff --git a/src/v8/v8.pro b/src/v8/v8.pro
deleted file mode 100644
index 6f8ed703aa..0000000000
--- a/src/v8/v8.pro
+++ /dev/null
@@ -1,41 +0,0 @@
-load(qt_module)
-
-TARGET = QtV8
-QPRO_PWD = $$PWD
-QT =
-
-CONFIG += module
-MODULE_PRI = ../modules/qt_v8.pri
-
-win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000
-
-load(qt_module_config)
-CONFIG += warn_off
-
-# Remove includepaths that were added by qt_module_config.
-# These cause compilation of V8 to fail because they appear before
-# 3rdparty/v8/src; 3rdparty/v8/src/v8.h will then be "shadowed" by
-# the public v8.h API header (they are not the same!).
-INCLUDEPATH -= $$MODULE_PRIVATE_INCLUDES
-INCLUDEPATH -= $$MODULE_PRIVATE_INCLUDES/$$TARGET
-INCLUDEPATH -= $$MODULE_INCLUDES $$MODULE_INCLUDES/..
-
-HEADERS += $$QT_SOURCE_TREE/src/v8/qtv8version.h
-
-!contains(QT_CONFIG, static): DEFINES += V8_SHARED BUILDING_V8_SHARED
-
-include(v8.pri)
-
-contains(QT_CONFIG, v8snapshot) {
- mkv8snapshot.commands = ../../bin/mkv8snapshot$$qtPlatformTargetSuffix() ${QMAKE_FILE_OUT}
- DUMMY_FILE = v8.pro
- mkv8snapshot.input = DUMMY_FILE
- mkv8snapshot.output = $$V8_GENERATED_SOURCES_DIR/snapshot.cpp
- mkv8snapshot.variable_out = SOURCES
- mkv8snapshot.dependency_type = TYPE_C
- mkv8snapshot.name = generating[v8] ${QMAKE_FILE_IN}
- silent:mkv8snapshot.commands = @echo generating[v8] ${QMAKE_FILE_IN} && $$mkv8snapshot.commands
- QMAKE_EXTRA_COMPILERS += mkv8snapshot
-} else {
- SOURCES += $$V8SRC/snapshot-empty.cc
-}
diff --git a/src/v8/v8base.pri b/src/v8/v8base.pri
deleted file mode 100644
index f0d7c00451..0000000000
--- a/src/v8/v8base.pri
+++ /dev/null
@@ -1,19 +0,0 @@
-V8DIR = $$(V8DIR)
-isEmpty(V8DIR) {
- V8DIR = $$PWD/../3rdparty/v8
-} else {
- message(using external V8 from $$V8DIR)
-}
-
-*-g++*: {
- QMAKE_CFLAGS_WARN_ON += -Wno-unused-parameter
- QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
-
- # mksnapshot hangs if gcc 4.5 is used
- # for reference look at http://code.google.com/p/v8/issues/detail?id=884
- equals(QT_GCC_MAJOR_VERSION, 4): equals(QT_GCC_MINOR_VERSION, 5) {
- message(because of a bug in gcc / v8 we need to add -fno-strict-aliasing)
- QMAKE_CFLAGS += -fno-strict-aliasing
- QMAKE_CXXFLAGS += -fno-strict-aliasing
- }
-}
diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
index b7e4594ca1..baf34b2fbc 100644
--- a/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+++ b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
@@ -2,4 +2,4 @@
get_filename_component(_qt5_widgets_install_prefix ${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR} ABSOLUTE)
# Not Required by default:
-set(QT_UIC_EXECUTABLE \"${_qt5_widgets_install_prefix}/$$CMAKE_BIN_DIR/uic\")
+set(QT_UIC_EXECUTABLE \"${_qt5_widgets_install_prefix}/$$CMAKE_BIN_DIR/uic$$CMAKE_BIN_SUFFIX\")
diff --git a/src/widgets/Qt5WidgetsMacros.cmake b/src/widgets/Qt5WidgetsMacros.cmake
index 7ebc7e6673..88f259191e 100644
--- a/src/widgets/Qt5WidgetsMacros.cmake
+++ b/src/widgets/Qt5WidgetsMacros.cmake
@@ -39,27 +39,27 @@
include(CMakeParseArguments)
-# QT5_WRAP_UI(outfiles inputfile ... )
+# qt5_wrap_ui(outfiles inputfile ... )
-MACRO (QT5_WRAP_UI outfiles )
- set(options)
- set(oneValueArgs)
- set(multiValueArgs OPTIONS)
+function(QT5_WRAP_UI outfiles )
+ set(options)
+ set(oneValueArgs)
+ set(multiValueArgs OPTIONS)
- cmake_parse_arguments(_WRAP_UI "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+ cmake_parse_arguments(_WRAP_UI "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
- set(ui_files ${_WRAP_UI_UNPARSED_ARGUMENTS})
- set(ui_options ${_WRAP_UI_OPTIONS})
+ set(ui_files ${_WRAP_UI_UNPARSED_ARGUMENTS})
+ set(ui_options ${_WRAP_UI_OPTIONS})
- FOREACH (it ${ui_files})
- GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
- GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
- SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h)
- ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
- COMMAND ${QT_UIC_EXECUTABLE}
- ARGS ${ui_options} -o ${outfile} ${infile}
- MAIN_DEPENDENCY ${infile} VERBATIM)
- SET(${outfiles} ${${outfiles}} ${outfile})
- ENDFOREACH (it)
-
-ENDMACRO (QT5_WRAP_UI)
+ foreach(it ${ui_files})
+ get_filename_component(outfile ${it} NAME_WE)
+ get_filename_component(infile ${it} ABSOLUTE)
+ set(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h)
+ add_custom_command(OUTPUT ${outfile}
+ COMMAND ${QT_UIC_EXECUTABLE}
+ ARGS ${ui_options} -o ${outfile} ${infile}
+ MAIN_DEPENDENCY ${infile} VERBATIM)
+ list(APPEND ${outfiles} ${outfile})
+ endforeach()
+ set(${outfiles} ${${outfiles}} PARENT_SCOPE)
+endfunction()
diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp
index a1c53e934e..ae09b011dd 100644
--- a/src/widgets/accessible/qaccessiblewidget.cpp
+++ b/src/widgets/accessible/qaccessiblewidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -159,6 +159,8 @@ public:
\ingroup accessibility
\inmodule QtWidgets
+ This class is part of \l {Accessibility for QWidget Applications}.
+
This class is convenient to use as a base class for custom
implementations of QAccessibleInterfaces that provide information
about widget objects.
@@ -188,6 +190,7 @@ QAccessibleWidget::QAccessibleWidget(QWidget *w, QAccessible::Role role, const Q
d->asking = 0;
}
+/*! \reimp */
QWindow *QAccessibleWidget::window() const
{
return widget()->windowHandle();
@@ -222,28 +225,6 @@ QObject *QAccessibleWidget::parentObject() const
}
/*! \reimp */
-int QAccessibleWidget::childAt(int x, int y) const
-{
- QWidget *w = widget();
- if (!w->isVisible())
- return -1;
- QPoint gp = w->mapToGlobal(QPoint(0, 0));
- if (!QRect(gp.x(), gp.y(), w->width(), w->height()).contains(x, y))
- return -1;
-
- for (int i = 0; i < childCount(); ++i) {
- QAccessibleInterface *childIface = child(i);
- bool found = false;
- if (childIface->rect().contains(x, y))
- found = true;
- delete childIface;
- if (found)
- return i + 1;
- }
- return 0;
-}
-
-/*! \reimp */
QRect QAccessibleWidget::rect() const
{
QWidget *w = widget();
@@ -385,11 +366,7 @@ QAccessible::Relation QAccessibleWidget::relationTo(const QAccessibleInterface *
}
QObject *parent = object()->parent();
- if (o == parent)
- return relation | QAccessible::Child;
-
if (o->parent() == parent) {
- relation |= QAccessible::Sibling;
QAccessibleInterface *sibIface = QAccessible::queryAccessibleInterface(o);
Q_ASSERT(sibIface);
QRect wg = rect();
@@ -397,7 +374,7 @@ QAccessible::Relation QAccessibleWidget::relationTo(const QAccessibleInterface *
if (wg.intersects(sg)) {
QAccessibleInterface *pIface = 0;
pIface = sibIface->parent();
- if (pIface && !((sibIface->state() | state()) & QAccessible::Invisible)) {
+ if (pIface && !(sibIface->state().invisible | state().invisible)) {
int wi = pIface->indexOfChild(this);
int si = pIface->indexOfChild(sibIface);
@@ -407,31 +384,16 @@ QAccessible::Relation QAccessibleWidget::relationTo(const QAccessibleInterface *
relation |= QAccessible::Covered;
}
delete pIface;
- } else {
- QPoint wc = wg.center();
- QPoint sc = sg.center();
- if (wc.x() < sc.x())
- relation |= QAccessible::Left;
- else if(wc.x() > sc.x())
- relation |= QAccessible::Right;
- if (wc.y() < sc.y())
- relation |= QAccessible::Up;
- else if (wc.y() > sc.y())
- relation |= QAccessible::Down;
}
delete sibIface;
return relation;
}
- if (isAncestor(o, object()))
- return relation | QAccessible::Descendent;
- if (isAncestor(object(), o))
- return relation | QAccessible::Ancestor;
-
return relation;
}
+/*! \reimp */
QAccessibleInterface *QAccessibleWidget::parent() const
{
QObject *parentWidget= widget()->parentWidget();
@@ -440,6 +402,7 @@ QAccessibleInterface *QAccessibleWidget::parent() const
return QAccessible::queryAccessibleInterface(parentWidget);
}
+/*! \reimp */
QAccessibleInterface *QAccessibleWidget::child(int index) const
{
QWidgetList childList = childWidgets(widget());
@@ -459,132 +422,20 @@ int QAccessibleWidget::navigate(QAccessible::RelationFlag relation, int entry,
QObject *targetObject = 0;
switch (relation) {
- // Hierarchical
- case QAccessible::Self:
- targetObject = object();
- break;
- case QAccessible::Child:
- qWarning() << "QAccessibleWidget::navigate is deprecated for QAccessible::Child in:" << object()->metaObject()->className();
- *target = child(entry - 1);
- return *target ? 0 : -1;
- case QAccessible::Ancestor:
- qWarning() << "QAccessibleWidget::navigate is deprecated for QAccessible::Ancestor in:" << object()->metaObject()->className();
- *target = parent();
- return *target ? 0 : -1;
- case QAccessible::Sibling:
- {
- QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(parentObject());
- if (!iface)
- return -1;
-
- *target = iface->child(entry - 1);
- delete iface;
- if (*target)
- return 0;
- }
- break;
-
- // Geometrical
- case QAccessible::Left:
- // fall through
- case QAccessible::Right:
- // fall through
- case QAccessible::Up:
- // fall through
- case QAccessible::Down:
- {
- QAccessibleInterface *pIface = parent();
- if (!pIface)
- return -1;
-
- QRect startg = rect();
- QPoint startc = startg.center();
- QAccessibleInterface *candidate = 0;
- int mindist = 100000;
- int sibCount = pIface->childCount();
- for (int i = 0; i < sibCount; ++i) {
- QAccessibleInterface *sibling = 0;
- sibling = pIface->child(i);
- Q_ASSERT(sibling);
- if ((relationTo(sibling) & QAccessible::Self) || (sibling->state() & QAccessible::Invisible)) {
- //ignore ourself and invisible siblings
- delete sibling;
- continue;
- }
-
- QRect sibg = sibling->rect();
- QPoint sibc = sibg.center();
- QPoint sibp;
- QPoint startp;
- QPoint distp;
- switch (relation) {
- case QAccessible::Left:
- startp = QPoint(startg.left(), startg.top() + startg.height() / 2);
- sibp = QPoint(sibg.right(), sibg.top() + sibg.height() / 2);
- if (QPoint(sibc - startc).x() >= 0) {
- delete sibling;
- continue;
- }
- distp = sibp - startp;
- break;
- case QAccessible::Right:
- startp = QPoint(startg.right(), startg.top() + startg.height() / 2);
- sibp = QPoint(sibg.left(), sibg.top() + sibg.height() / 2);
- if (QPoint(sibc - startc).x() <= 0) {
- delete sibling;
- continue;
- }
- distp = sibp - startp;
- break;
- case QAccessible::Up:
- startp = QPoint(startg.left() + startg.width() / 2, startg.top());
- sibp = QPoint(sibg.left() + sibg.width() / 2, sibg.bottom());
- if (QPoint(sibc - startc).y() >= 0) {
- delete sibling;
- continue;
- }
- distp = sibp - startp;
- break;
- case QAccessible::Down:
- startp = QPoint(startg.left() + startg.width() / 2, startg.bottom());
- sibp = QPoint(sibg.left() + sibg.width() / 2, sibg.top());
- if (QPoint(sibc - startc).y() <= 0) {
- delete sibling;
- continue;
- }
- distp = sibp - startp;
- break;
- default:
- break;
- }
-
- int dist = (int)qSqrt((qreal)distp.x() * distp.x() + distp.y() * distp.y());
- if (dist < mindist) {
- delete candidate;
- candidate = sibling;
- mindist = dist;
- } else {
- delete sibling;
- }
- }
- delete pIface;
- *target = candidate;
- if (*target)
- return 0;
- }
- break;
case QAccessible::Covers:
if (entry > 0) {
- QAccessibleInterface *pIface = QAccessible::queryAccessibleInterface(parentObject());
+ QAccessibleInterface *pIface = parent();
if (!pIface)
return -1;
QRect r = rect();
int sibCount = pIface->childCount();
QAccessibleInterface *sibling = 0;
- for (int i = pIface->indexOfChild(this) + 1; i <= sibCount && entry; ++i) {
+ // FIXME: this code looks very suspicious
+ // why start at this index?
+ for (int i = pIface->indexOfChild(this) + 2; i <= sibCount && entry; ++i) {
sibling = pIface->child(i - 1);
- if (!sibling || (sibling->state() & QAccessible::Invisible)) {
+ if (!sibling || (sibling->state().invisible)) {
delete sibling;
sibling = 0;
continue;
@@ -611,10 +462,11 @@ int QAccessibleWidget::navigate(QAccessible::RelationFlag relation, int entry,
QRect r = rect();
int index = pIface->indexOfChild(this);
QAccessibleInterface *sibling = 0;
- for (int i = 1; i < index && entry; ++i) {
- sibling = pIface->child(i - 1);
+ // FIXME: why end at index?
+ for (int i = 0; i < index && entry; ++i) {
+ sibling = pIface->child(i);
Q_ASSERT(sibling);
- if (!sibling || (sibling->state() & QAccessible::Invisible)) {
+ if (!sibling || (sibling->state().invisible)) {
delete sibling;
sibling = 0;
continue;
@@ -746,10 +598,7 @@ int QAccessibleWidget::childCount() const
int QAccessibleWidget::indexOfChild(const QAccessibleInterface *child) const
{
QWidgetList cl = childWidgets(widget());
- int index = cl.indexOf(qobject_cast<QWidget *>(child->object()));
- if (index != -1)
- ++index;
- return index;
+ return cl.indexOf(qobject_cast<QWidget *>(child->object()));
}
// from qwidget.cpp
@@ -808,6 +657,7 @@ QString QAccessibleWidget::text(QAccessible::Text t) const
return str;
}
+/*! \reimp */
QStringList QAccessibleWidget::actionNames() const
{
QStringList names;
@@ -818,6 +668,7 @@ QStringList QAccessibleWidget::actionNames() const
return names;
}
+/*! \reimp */
void QAccessibleWidget::doAction(const QString &actionName)
{
if (!widget()->isEnabled())
@@ -830,6 +681,7 @@ void QAccessibleWidget::doAction(const QString &actionName)
}
}
+/*! \reimp */
QStringList QAccessibleWidget::keyBindingsForAction(const QString & /* actionName */) const
{
return QStringList();
@@ -844,37 +696,40 @@ QAccessible::Role QAccessibleWidget::role() const
/*! \reimp */
QAccessible::State QAccessibleWidget::state() const
{
- QAccessible::State state = QAccessible::Normal;
+ QAccessible::State state;
QWidget *w = widget();
if (w->testAttribute(Qt::WA_WState_Visible) == false)
- state |= QAccessible::Invisible;
+ state.invisible = true;
if (w->focusPolicy() != Qt::NoFocus && w->isActiveWindow())
- state |= QAccessible::Focusable;
+ state.focusable = true;
if (w->hasFocus())
- state |= QAccessible::Focused;
+ state.focused = true;
if (!w->isEnabled())
- state |= QAccessible::Unavailable;
+ state.disabled = true;
if (w->isWindow()) {
if (w->windowFlags() & Qt::WindowSystemMenuHint)
- state |= QAccessible::Movable;
+ state.movable = true;
if (w->minimumSize() != w->maximumSize())
- state |= QAccessible::Sizeable;
+ state.sizeable = true;
}
return state;
}
+/*! \reimp */
QColor QAccessibleWidget::foregroundColor() const
{
return widget()->palette().color(widget()->foregroundRole());
}
+/*! \reimp */
QColor QAccessibleWidget::backgroundColor() const
{
return widget()->palette().color(widget()->backgroundRole());
}
+/*! \reimp */
void *QAccessibleWidget::interface_cast(QAccessible::InterfaceType t)
{
if (t == QAccessible::ActionInterface)
diff --git a/src/widgets/accessible/qaccessiblewidget.h b/src/widgets/accessible/qaccessiblewidget.h
index b807dbc088..da217b94ca 100644
--- a/src/widgets/accessible/qaccessiblewidget.h
+++ b/src/widgets/accessible/qaccessiblewidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -64,7 +64,6 @@ public:
int indexOfChild(const QAccessibleInterface *child) const;
QAccessible::Relation relationTo(const QAccessibleInterface *other) const;
- int childAt(int x, int y) const;
QRect rect() const;
QAccessibleInterface *parent() const;
diff --git a/src/widgets/animation/qguivariantanimation.cpp b/src/widgets/animation/qguivariantanimation.cpp
index f99b74e2ab..2167e4a173 100644
--- a/src/widgets/animation/qguivariantanimation.cpp
+++ b/src/widgets/animation/qguivariantanimation.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 1803cba01d..777e4cc4ba 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -425,34 +425,13 @@ void QWellArray::keyPressEvent(QKeyEvent* e)
//////////// QWellArray END
-static bool initrgb = false;
-static QRgb stdrgb[6*8];
-static QRgb cusrgb[2*8];
-static bool customSet = false;
-
-
-static void initRGB()
-{
- if (initrgb)
- return;
- initrgb = true;
- int i = 0;
- for (int g = 0; g < 4; g++)
- for (int r = 0; r < 4; r++)
- for (int b = 0; b < 3; b++)
- stdrgb[i++] = qRgb(r * 255 / 3, g * 255 / 3, b * 255 / 2);
-
- for (i = 0; i < 2*8; i++)
- cusrgb[i] = 0xffffffff;
-}
-
/*!
Returns the number of custom colors supported by QColorDialog. All
color dialogs share the same custom colors.
*/
int QColorDialog::customCount()
{
- return 2 * 8;
+ return QColorDialogOptions::customColorCount();
}
/*!
@@ -462,10 +441,7 @@ int QColorDialog::customCount()
*/
QRgb QColorDialog::customColor(int index)
{
- if (uint(index) >= uint(customCount()))
- return qRgb(255, 255, 255);
- initRGB();
- return cusrgb[index];
+ return QColorDialogOptions::customColor(index);
}
/*!
@@ -477,11 +453,7 @@ QRgb QColorDialog::customColor(int index)
*/
void QColorDialog::setCustomColor(int index, QRgb color)
{
- if (uint(index) >= uint(customCount()))
- return;
- initRGB();
- customSet = true;
- cusrgb[index] = color;
+ QColorDialogOptions::setCustomColor(index, color);
}
/*!
@@ -494,10 +466,7 @@ void QColorDialog::setCustomColor(int index, QRgb color)
void QColorDialog::setStandardColor(int index, QRgb color)
{
- if (uint(index) >= uint(6 * 8))
- return;
- initRGB();
- stdrgb[index] = color;
+ QColorDialogOptions::setStandardColor(index, color);
}
static inline void rgb2hsv(QRgb rgb, int &h, int &s, int &v)
@@ -1421,9 +1390,10 @@ bool QColorDialogPrivate::selectColor(const QColor &col)
int i = 0, j = 0;
// Check standard colors
if (standard) {
+ const QRgb *standardColors = QColorDialogOptions::standardColors();
for (i = 0; i < 6; i++) {
for (j = 0; j < 8; j++) {
- if (color == stdrgb[i + j*6]) {
+ if (color == standardColors[i + j*6]) {
_q_newStandard(i, j);
standard->setCurrent(i, j);
standard->setSelected(i, j);
@@ -1435,9 +1405,10 @@ bool QColorDialogPrivate::selectColor(const QColor &col)
}
// Check custom colors
if (custom) {
+ const QRgb *customColors = QColorDialogOptions::customColors();
for (i = 0; i < 2; i++) {
for (j = 0; j < 8; j++) {
- if (color == cusrgb[i + j*2]) {
+ if (color == customColors[i + j*2]) {
_q_newCustom(i, j);
custom->setCurrent(i, j);
custom->setSelected(i, j);
@@ -1461,8 +1432,8 @@ void QColorDialogPrivate::_q_newColorTypedIn(QRgb rgb)
void QColorDialogPrivate::_q_newCustom(int r, int c)
{
- int i = r+2*c;
- setCurrentColor(cusrgb[i]);
+ const int i = r + 2 * c;
+ setCurrentColor(QColorDialogOptions::customColor(i));
nextCust = i;
if (standard)
standard->setSelected(-1,-1);
@@ -1470,7 +1441,7 @@ void QColorDialogPrivate::_q_newCustom(int r, int c)
void QColorDialogPrivate::_q_newStandard(int r, int c)
{
- setCurrentColor(stdrgb[r+c*6]);
+ setCurrentColor(QColorDialogOptions::standardColor(r + c * 6));
if (custom)
custom->setSelected(-1,-1);
}
@@ -1509,21 +1480,6 @@ void QColorDialogPrivate::init(const QColor &initial)
topLay->addLayout(leftLay);
}
- initRGB();
-
-#ifndef QT_NO_SETTINGS
- if (!customSet) {
- QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
- for (int i = 0; i < 2*8; ++i) {
- QVariant v = settings.value(QLatin1String("Qt/customColors/") + QString::number(i));
- if (v.isValid()) {
- QRgb rgb = v.toUInt();
- cusrgb[i] = rgb;
- }
- }
- }
-#endif
-
#if defined(QT_SMALL_COLORDIALOG)
# if defined(Q_WS_S60)
const bool nonTouchUI = !S60->hasTouchscreen;
@@ -1533,7 +1489,7 @@ void QColorDialogPrivate::init(const QColor &initial)
#endif
if (!smallDisplay) {
- standard = new QColorWell(q, 6, 8, stdrgb);
+ standard = new QColorWell(q, 6, 8, QColorDialogOptions::standardColors());
lblBasicColors = new QLabel(q);
#ifndef QT_NO_SHORTCUT
lblBasicColors->setBuddy(standard);
@@ -1546,7 +1502,7 @@ void QColorDialogPrivate::init(const QColor &initial)
leftLay->addStretch();
#endif
- custom = new QColorWell(q, 2, 8, cusrgb);
+ custom = new QColorWell(q, 2, 8, QColorDialogOptions::customColors());
custom->setAcceptDrops(true);
q->connect(custom, SIGNAL(selected(int,int)), SLOT(_q_newCustom(int,int)));
@@ -1657,22 +1613,22 @@ void QColorDialogPrivate::initHelper(QPlatformDialogHelper *h)
QColorDialog *d = q_func();
QObject::connect(h, SIGNAL(currentColorChanged(QColor)), d, SIGNAL(currentColorChanged(QColor)));
QObject::connect(h, SIGNAL(colorSelected(QColor)), d, SIGNAL(colorSelected(QColor)));
+ static_cast<QPlatformColorDialogHelper *>(h)->setOptions(options);
+}
+
+void QColorDialogPrivate::helperPrepareShow(QPlatformDialogHelper *)
+{
+ options->setWindowTitle(q_func()->windowTitle());
}
void QColorDialogPrivate::_q_addCustom()
{
- cusrgb[nextCust] = cs->currentColor();
+ QColorDialogOptions::setCustomColor(nextCust, cs->currentColor());
if (custom)
custom->update();
nextCust = (nextCust+1) % 16;
}
-void QColorDialogPrivate::_q_platformRunNativeAppModalPanel()
-{
- if (nativeDialogInUse)
- platformHelper()->_q_platformRunNativeAppModalPanel();
-}
-
void QColorDialogPrivate::retranslateStrings()
{
if (!smallDisplay) {
@@ -1800,8 +1756,7 @@ QColor QColorDialog::selectedColor() const
void QColorDialog::setOption(ColorDialogOption option, bool on)
{
Q_D(QColorDialog);
- if (!(d->opts & option) != !on)
- setOptions(d->opts ^ option);
+ d->options->setOption(static_cast<QColorDialogOptions::ColorDialogOption>(option), on);
}
/*!
@@ -1815,7 +1770,7 @@ void QColorDialog::setOption(ColorDialogOption option, bool on)
bool QColorDialog::testOption(ColorDialogOption option) const
{
Q_D(const QColorDialog);
- return (d->opts & option) != 0;
+ return d->options->testOption(static_cast<QColorDialogOptions::ColorDialogOption>(option));
}
/*!
@@ -1834,11 +1789,10 @@ void QColorDialog::setOptions(ColorDialogOptions options)
{
Q_D(QColorDialog);
- ColorDialogOptions changed = (options ^ d->opts);
- if (!changed)
+ if (QColorDialog::options() == options)
return;
- d->opts = options;
+ d->options->setOptions(QColorDialogOptions::ColorDialogOptions(int(options)));
d->buttons->setVisible(!(options & NoButtons));
d->showAlpha(options & ShowAlphaChannel);
}
@@ -1846,7 +1800,7 @@ void QColorDialog::setOptions(ColorDialogOptions options)
QColorDialog::ColorDialogOptions QColorDialog::options() const
{
Q_D(const QColorDialog);
- return d->opts;
+ return QColorDialog::ColorDialogOptions(int(d->options->options()));
}
/*!
@@ -1922,7 +1876,7 @@ void QColorDialog::setVisible(bool visible)
}
#else
- if (!(d->opts & DontUseNativeDialog))
+ if (!(options() & DontUseNativeDialog))
d->setNativeDialogVisible(visible);
if (d->nativeDialogInUse) {
@@ -2026,14 +1980,6 @@ QColorDialog::~QColorDialog()
QColorDialogPrivate::sharedColorPanelAvailable = true;
}
#endif
-
-#ifndef QT_NO_SETTINGS
- if (!customSet) {
- QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
- for (int i = 0; i < 2*8; ++i)
- settings.setValue(QLatin1String("Qt/customColors/") + QString::number(i), cusrgb[i]);
- }
-#endif
}
/*!
diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h
index 1d21c06f99..1bdb0b41a2 100644
--- a/src/widgets/dialogs/qcolordialog.h
+++ b/src/widgets/dialogs/qcolordialog.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qcolordialog_mac.mm b/src/widgets/dialogs/qcolordialog_mac.mm
index 1d77751e2b..bdf5e1cccd 100644
--- a/src/widgets/dialogs/qcolordialog_mac.mm
+++ b/src/widgets/dialogs/qcolordialog_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qcolordialog_p.h b/src/widgets/dialogs/qcolordialog_p.h
index 39d7192b1d..a6149017d7 100644
--- a/src/widgets/dialogs/qcolordialog_p.h
+++ b/src/widgets/dialogs/qcolordialog_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -56,6 +56,7 @@
#include "private/qdialog_p.h"
#include "qcolordialog.h"
+#include "qsharedpointer.h"
#ifndef QT_NO_COLORDIALOG
@@ -75,6 +76,8 @@ class QColorDialogPrivate : public QDialogPrivate
Q_DECLARE_PUBLIC(QColorDialog)
public:
+ QColorDialogPrivate() : options(new QColorDialogOptions) {}
+
QPlatformColorDialogHelper *platformColorDialogHelper() const
{ return static_cast<QPlatformColorDialogHelper *>(platformHelper()); }
@@ -92,7 +95,6 @@ public:
void retranslateStrings();
void _q_addCustom();
- void _q_platformRunNativeAppModalPanel();
void _q_newHsv(int h, int s, int v);
void _q_newColorTypedIn(QRgb rgb);
@@ -115,7 +117,8 @@ public:
QColor selectedQColor;
int nextCust;
bool smallDisplay;
- QColorDialog::ColorDialogOptions opts;
+ QSharedPointer<QColorDialogOptions> options;
+
QPointer<QObject> receiverToDisconnectOnClose;
QByteArray memberToDisconnectOnClose;
@@ -138,6 +141,7 @@ public:
#endif
private:
virtual void initHelper(QPlatformDialogHelper *h);
+ virtual void helperPrepareShow(QPlatformDialogHelper *h);
};
#endif // QT_NO_COLORDIALOG
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 363d3bf592..af11fc971d 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -66,10 +66,16 @@ QPlatformDialogHelper *QDialogPrivate::platformHelper() const
if (!m_platformHelperCreated) {
QDialogPrivate *ncThis = const_cast<QDialogPrivate *>(this);
m_platformHelperCreated = true;
+ QDialog *dialog = ncThis->q_func();
m_platformHelper = QGuiApplicationPrivate::platformTheme()
- ->createPlatformDialogHelper(ncThis->q_func());
- if (m_platformHelper)
+ ->createPlatformDialogHelper(dialog);
+ if (m_platformHelper) {
+ QObject::connect(m_platformHelper, SIGNAL(accept()), dialog, SLOT(accept()));
+ QObject::connect(m_platformHelper, SIGNAL(reject()), dialog, SLOT(reject()));
+ QObject::connect(m_platformHelper, SIGNAL(launchNativeAppModalPanel()),
+ dialog, SLOT(_q_platformRunNativeAppModalPanel()));
ncThis->initHelper(m_platformHelper);
+ }
}
return m_platformHelper;
}
@@ -85,7 +91,11 @@ bool QDialogPrivate::setNativeDialogVisible(bool visible)
{
if (QPlatformDialogHelper *helper = platformHelper()) {
if (visible) {
- nativeDialogInUse = helper->show_sys(parentWindow());
+ helperPrepareShow(helper);
+ QPlatformDialogHelper::ShowFlags flags(0);
+ if (q_func()->isModal())
+ flags |= QPlatformDialogHelper::ShowModal;
+ nativeDialogInUse = helper->show_sys(flags, q_func()->windowFlags(), parentWindow());
} else {
helper->hide_sys();
}
@@ -93,6 +103,13 @@ bool QDialogPrivate::setNativeDialogVisible(bool visible)
return nativeDialogInUse;
}
+void QDialogPrivate::_q_platformRunNativeAppModalPanel()
+{
+ if (nativeDialogInUse)
+ platformHelper()->_q_platformRunNativeAppModalPanel();
+}
+
+
QVariant QDialogPrivate::styleHint(QPlatformDialogHelper::StyleHint hint) const
{
if (const QPlatformDialogHelper *helper = platformHelper())
@@ -503,6 +520,8 @@ int QDialog::exec()
setAttribute(Qt::WA_ShowModal, wasShowModal);
int res = result();
+ if (d->nativeDialogInUse)
+ d->helperDone(static_cast<QDialog::DialogCode>(res), d->platformHelper());
if (deleteOnClose)
delete this;
return res;
diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h
index d4171ece47..8329e6460a 100644
--- a/src/widgets/dialogs/qdialog.h
+++ b/src/widgets/dialogs/qdialog.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -118,7 +118,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QDialog)
Q_DISABLE_COPY(QDialog)
-
+ Q_PRIVATE_SLOT(d_func(), void _q_platformRunNativeAppModalPanel())
#ifdef Q_WS_WINCE_WM
Q_PRIVATE_SLOT(d_func(), void _q_doneAction())
diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h
index 3d90686b6d..ecdfff03fd 100644
--- a/src/widgets/dialogs/qdialog_p.h
+++ b/src/widgets/dialogs/qdialog_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -79,6 +79,7 @@ public:
nativeDialogInUse(false), m_platformHelper(0), m_platformHelperCreated(false)
{}
~QDialogPrivate() { delete m_platformHelper; }
+ void _q_platformRunNativeAppModalPanel();
QWindow *parentWindow() const;
bool setNativeDialogVisible(bool visible);
@@ -115,6 +116,8 @@ public:
private:
virtual void initHelper(QPlatformDialogHelper *) {}
+ virtual void helperPrepareShow(QPlatformDialogHelper *) {}
+ virtual void helperDone(QDialog::DialogCode, QPlatformDialogHelper *) {}
mutable QPlatformDialogHelper *m_platformHelper;
mutable bool m_platformHelperCreated;
diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp
index e87551cd80..1c950a7158 100644
--- a/src/widgets/dialogs/qerrormessage.cpp
+++ b/src/widgets/dialogs/qerrormessage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qerrormessage.h b/src/widgets/dialogs/qerrormessage.h
index 3736526f93..c43df749f7 100644
--- a/src/widgets/dialogs/qerrormessage.h
+++ b/src/widgets/dialogs/qerrormessage.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 0f107c6b0a..2f49a226e9 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -507,16 +507,14 @@ QFileDialogPrivate::QFileDialogPrivate()
proxyModel(0),
#endif
model(0),
- fileMode(QFileDialog::AnyFile),
- acceptMode(QFileDialog::AcceptOpen),
currentHistoryLocation(-1),
renameAction(0),
deleteAction(0),
showHiddenAction(0),
useDefaultCaption(true),
defaultFileTypes(true),
- fileNameLabelExplicitlySat(false),
- qFileDialogUi(0)
+ qFileDialogUi(0),
+ options(new QFileDialogOptions)
{
}
@@ -524,12 +522,49 @@ QFileDialogPrivate::~QFileDialogPrivate()
{
}
+void QFileDialogPrivate::initHelper(QPlatformDialogHelper *h)
+{
+ QFileDialog *d = q_func();
+ QObject::connect(h, SIGNAL(fileSelected(QString)), d, SIGNAL(fileSelected(QString)));
+ QObject::connect(h, SIGNAL(filesSelected(QStringList)), d, SIGNAL(filesSelected(QStringList)));
+ QObject::connect(h, SIGNAL(currentChanged(QString)), d, SIGNAL(currentChanged(QString)));
+ QObject::connect(h, SIGNAL(directoryEntered(QString)), d, SIGNAL(directoryEntered(QString)));
+ QObject::connect(h, SIGNAL(filterSelected(QString)), d, SIGNAL(filterSelected(QString)));
+ static_cast<QPlatformFileDialogHelper *>(h)->setOptions(options);
+}
+
+void QFileDialogPrivate::helperPrepareShow(QPlatformDialogHelper *)
+{
+ Q_Q(QFileDialog);
+ options->setWindowTitle(q->windowTitle());
+ options->setViewMode(static_cast<QFileDialogOptions::ViewMode>(q->viewMode()));
+ options->setHistory(q->history());
+ options->setSidebarUrls(qFileDialogUi->sidebar->urls());
+ const QDir directory = q->directory();
+ options->setInitialDirectory(directory.exists() ?
+ directory.absolutePath() :
+ QString());
+ options->setInitiallySelectedNameFilter(q->selectedNameFilter());
+ options->setInitiallySelectedFiles(q->selectedFiles());
+}
+
+void QFileDialogPrivate::helperDone(QDialog::DialogCode code, QPlatformDialogHelper *)
+{
+ if (code == QDialog::Accepted) {
+ Q_Q(QFileDialog);
+ q->setViewMode(static_cast<QFileDialog::ViewMode>(options->viewMode()));
+ q->setSidebarUrls(options->sidebarUrls());
+ q->setHistory(options->history());
+ }
+}
+
void QFileDialogPrivate::retranslateWindowTitle()
{
Q_Q(QFileDialog);
if (!useDefaultCaption || setWindowTitle != q->windowTitle())
return;
- if (acceptMode == QFileDialog::AcceptOpen) {
+ if (q->acceptMode() == QFileDialog::AcceptOpen) {
+ const QFileDialog::FileMode fileMode = q->fileMode();
if (fileMode == QFileDialog::DirectoryOnly || fileMode == QFileDialog::Directory)
q->setWindowTitle(QFileDialog::tr("Find Directory"));
else
@@ -545,6 +580,46 @@ void QFileDialogPrivate::setLastVisitedDirectory(const QString &dir)
*lastVisitedDir() = dir;
}
+void QFileDialogPrivate::updateFileNameLabel()
+{
+ if (!options->isLabelExplicitlySet(QFileDialogOptions::FileName)) {
+ switch (q_func()->fileMode()) {
+ case QFileDialog::DirectoryOnly:
+ case QFileDialog::Directory:
+ setLabelTextControl(QFileDialog::FileName, QFileDialog::tr("Directory:"));
+ break;
+ default:
+ setLabelTextControl(QFileDialog::FileName, QFileDialog::tr("File &name:"));
+ break;
+ }
+ }
+}
+
+void QFileDialogPrivate::updateOkButtonText(bool saveAsOnFolder)
+{
+ Q_Q(QFileDialog);
+ // 'Save as' at a folder: Temporarily change to "Open".
+ if (saveAsOnFolder) {
+ setLabelTextControl(QFileDialog::Accept, QFileDialog::tr("&Open"));
+ } else if (options->isLabelExplicitlySet(QFileDialogOptions::Accept)) {
+ setLabelTextControl(QFileDialog::Accept, options->labelText(QFileDialogOptions::Accept));
+ return;
+ } else {
+ switch (q->fileMode()) {
+ case QFileDialog::DirectoryOnly:
+ case QFileDialog::Directory:
+ setLabelTextControl(QFileDialog::Accept, QFileDialog::tr("&Choose"));
+ break;
+ default:
+ setLabelTextControl(QFileDialog::Accept,
+ q->acceptMode() == QFileDialog::AcceptOpen ?
+ QFileDialog::tr("&Open") :
+ QFileDialog::tr("&Save"));
+ break;
+ }
+ }
+}
+
void QFileDialogPrivate::retranslateStrings()
{
Q_Q(QFileDialog);
@@ -569,15 +644,7 @@ void QFileDialogPrivate::retranslateStrings()
showHiddenAction->setText(QFileDialog::tr("Show &hidden files"));
newFolderAction->setText(QFileDialog::tr("&New Folder"));
qFileDialogUi->retranslateUi(q);
-
- if (!fileNameLabelExplicitlySat){
- if (fileMode == QFileDialog::DirectoryOnly || fileMode == QFileDialog::Directory) {
- q->setLabelText(QFileDialog::FileName, QFileDialog::tr("Directory:"));
- } else {
- q->setLabelText(QFileDialog::FileName, QFileDialog::tr("File &name:"));
- }
- fileNameLabelExplicitlySat = false;
- }
+ updateFileNameLabel();
}
void QFileDialogPrivate::emitFilesSelected(const QStringList &files)
@@ -595,7 +662,7 @@ bool QFileDialogPrivate::canBeNativeDialog()
return true;
if (q->testAttribute(Qt::WA_DontShowOnScreen))
return false;
- if (opts & QFileDialog::DontUseNativeDialog)
+ if (q->options() & QFileDialog::DontUseNativeDialog)
return false;
QLatin1String staticName(QFileDialog::staticMetaObject.className());
@@ -612,9 +679,9 @@ bool QFileDialogPrivate::canBeNativeDialog()
*/
void QFileDialog::setOption(Option option, bool on)
{
- Q_D(QFileDialog);
- if (!(d->opts & option) != !on)
- setOptions(d->opts ^ option);
+ const QFileDialog::Options previousOptions = options();
+ if (!(previousOptions & option) != !on)
+ setOptions(previousOptions ^ option);
}
/*!
@@ -628,7 +695,7 @@ void QFileDialog::setOption(Option option, bool on)
bool QFileDialog::testOption(Option option) const
{
Q_D(const QFileDialog);
- return (d->opts & option) != 0;
+ return d->options->testOption(static_cast<QFileDialogOptions::FileDialogOption>(option));
}
/*!
@@ -648,11 +715,11 @@ void QFileDialog::setOptions(Options options)
{
Q_D(QFileDialog);
- Options changed = (options ^ d->opts);
+ Options changed = (options ^ QFileDialog::options());
if (!changed)
return;
- d->opts = options;
+ d->options->setOptions(QFileDialogOptions::FileDialogOptions(int(options)));
if (changed & DontResolveSymlinks)
d->model->setResolveSymlinks(!(options & DontResolveSymlinks));
if (changed & ReadOnly) {
@@ -663,7 +730,7 @@ void QFileDialog::setOptions(Options options)
d->deleteAction->setEnabled(!ro);
}
if (changed & HideNameFilterDetails)
- setNameFilters(d->nameFilters);
+ setNameFilters(d->options->nameFilters());
if (changed & ShowDirsOnly)
setFilter((options & ShowDirsOnly) ? filter() & ~QDir::Files : filter() | QDir::Files);
@@ -672,7 +739,7 @@ void QFileDialog::setOptions(Options options)
QFileDialog::Options QFileDialog::options() const
{
Q_D(const QFileDialog);
- return d->opts;
+ return QFileDialog::Options(int(d->options->options()));
}
/*!
@@ -942,6 +1009,7 @@ QStringList QFileDialogPrivate::addDefaultSuffixToFiles(const QStringList filesT
QString name = toInternal(filesToFix.at(i));
QFileInfo info(name);
// if the filename has no suffix, add the default suffix
+ const QString defaultSuffix = options->defaultSuffix();
if (!defaultSuffix.isEmpty() && !info.isDir() && name.lastIndexOf(QLatin1Char('.')) == -1)
name += QLatin1Char('.') + defaultSuffix;
if (info.isAbsolute()) {
@@ -981,8 +1049,8 @@ QStringList QFileDialog::selectedFiles() const
if (files.isEmpty() && !d->lineEdit()->text().isEmpty())
files = d->typedFiles();
-
- if (files.isEmpty() && !(d->fileMode == ExistingFile || d->fileMode == ExistingFiles))
+ const FileMode fm = fileMode();
+ if (files.isEmpty() && !(fm == ExistingFile || fm == ExistingFiles))
files.append(d->rootIndex().data(QFileSystemModel::FilePathRole).toString());
return files;
}
@@ -1095,12 +1163,7 @@ void QFileDialog::setNameFilters(const QStringList &filters)
for (int i = 0; i < filters.count(); ++i) {
cleanedFilters << filters[i].simplified();
}
- d->nameFilters = cleanedFilters;
-
- if (d->nativeDialogInUse){
- d->setNameFilters_sys(cleanedFilters);
- return;
- }
+ d->options->setNameFilters(cleanedFilters);
d->qFileDialogUi->fileTypeCombo->clear();
if (cleanedFilters.isEmpty())
@@ -1132,7 +1195,7 @@ void QFileDialog::setFilters(const QStringList &filters)
*/
QStringList QFileDialog::nameFilters() const
{
- return d_func()->nameFilters;
+ return d_func()->options->nameFilters();
}
/*!
@@ -1236,6 +1299,7 @@ void QFileDialog::setFilter(QDir::Filters filters)
{
Q_D(QFileDialog);
d->model->setFilter(filters);
+ d->options->setFilter(filters);
if (d->nativeDialogInUse){
d->setFilter_sys();
return;
@@ -1286,7 +1350,7 @@ QFileDialog::ViewMode QFileDialog::viewMode() const
void QFileDialog::setFileMode(QFileDialog::FileMode mode)
{
Q_D(QFileDialog);
- d->fileMode = mode;
+ d->options->setFileMode(static_cast<QFileDialogOptions::FileMode>(mode));
d->retranslateWindowTitle();
// keep ShowDirsOnly option in sync with fileMode (BTW, DirectoryOnly is obsolete)
@@ -1303,24 +1367,13 @@ void QFileDialog::setFileMode(QFileDialog::FileMode mode)
// set filter
d->model->setFilter(d->filterForMode(filter()));
// setup file type for directory
- QString buttonText = (d->acceptMode == AcceptOpen ? tr("&Open") : tr("&Save"));
if (mode == DirectoryOnly || mode == Directory) {
d->qFileDialogUi->fileTypeCombo->clear();
d->qFileDialogUi->fileTypeCombo->addItem(tr("Directories"));
d->qFileDialogUi->fileTypeCombo->setEnabled(false);
-
- if (!d->fileNameLabelExplicitlySat){
- setLabelText(FileName, tr("Directory:"));
- d->fileNameLabelExplicitlySat = false;
- }
- buttonText = tr("&Choose");
- } else {
- if (!d->fileNameLabelExplicitlySat){
- setLabelText(FileName, tr("File &name:"));
- d->fileNameLabelExplicitlySat = false;
- }
}
- setLabelText(Accept, buttonText);
+ d->updateFileNameLabel();
+ d->updateOkButtonText();
if (d->nativeDialogInUse){
d->setFilter_sys();
return;
@@ -1333,7 +1386,7 @@ void QFileDialog::setFileMode(QFileDialog::FileMode mode)
QFileDialog::FileMode QFileDialog::fileMode() const
{
Q_D(const QFileDialog);
- return d->fileMode;
+ return static_cast<FileMode>(d->options->fileMode());
}
/*!
@@ -1349,16 +1402,11 @@ QFileDialog::FileMode QFileDialog::fileMode() const
void QFileDialog::setAcceptMode(QFileDialog::AcceptMode mode)
{
Q_D(QFileDialog);
- d->acceptMode = mode;
- bool directoryMode = (d->fileMode == Directory || d->fileMode == DirectoryOnly);
+ d->options->setAcceptMode(static_cast<QFileDialogOptions::AcceptMode>(mode));
QDialogButtonBox::StandardButton button = (mode == AcceptOpen ? QDialogButtonBox::Open : QDialogButtonBox::Save);
d->qFileDialogUi->buttonBox->setStandardButtons(button | QDialogButtonBox::Cancel);
d->qFileDialogUi->buttonBox->button(button)->setEnabled(false);
d->_q_updateOkButton();
- if (mode == AcceptOpen && directoryMode)
- setLabelText(Accept, tr("&Choose"));
- else
- setLabelText(Accept, (mode == AcceptOpen ? tr("&Open") : tr("&Save")));
if (mode == AcceptSave) {
d->qFileDialogUi->lookInCombo->setEditable(false);
}
@@ -1415,7 +1463,7 @@ QModelIndex QFileDialogPrivate::select(const QModelIndex &index) const {
QFileDialog::AcceptMode QFileDialog::acceptMode() const
{
Q_D(const QFileDialog);
- return d->acceptMode;
+ return static_cast<AcceptMode>(d->options->acceptMode());
}
/*!
@@ -1490,13 +1538,13 @@ bool QFileDialog::confirmOverwrite() const
void QFileDialog::setDefaultSuffix(const QString &suffix)
{
Q_D(QFileDialog);
- d->defaultSuffix = suffix;
+ d->options->setDefaultSuffix(suffix);
}
QString QFileDialog::defaultSuffix() const
{
Q_D(const QFileDialog);
- return d->defaultSuffix;
+ return d->options->defaultSuffix();
}
/*!
@@ -1587,42 +1635,46 @@ QFileIconProvider *QFileDialog::iconProvider() const
return d->model->iconProvider();
}
-/*!
- Sets the \a text shown in the filedialog in the specified \a label.
-*/
-void QFileDialog::setLabelText(DialogLabel label, const QString &text)
+void QFileDialogPrivate::setLabelTextControl(QFileDialog::DialogLabel label, const QString &text)
{
- Q_D(QFileDialog);
- QPushButton *button;
switch (label) {
- case LookIn:
- d->qFileDialogUi->lookInLabel->setText(text);
+ case QFileDialog::LookIn:
+ qFileDialogUi->lookInLabel->setText(text);
break;
- case FileName:
- d->qFileDialogUi->fileNameLabel->setText(text);
- d->fileNameLabelExplicitlySat = true;
+ case QFileDialog::FileName:
+ qFileDialogUi->fileNameLabel->setText(text);
break;
- case FileType:
- d->qFileDialogUi->fileTypeLabel->setText(text);
+ case QFileDialog::FileType:
+ qFileDialogUi->fileTypeLabel->setText(text);
break;
- case Accept:
- d->acceptLabel = text;
- if (acceptMode() == AcceptOpen)
- button = d->qFileDialogUi->buttonBox->button(QDialogButtonBox::Open);
- else
- button = d->qFileDialogUi->buttonBox->button(QDialogButtonBox::Save);
- if (button)
- button->setText(text);
+ case QFileDialog::Accept:
+ if (q_func()->acceptMode() == QFileDialog::AcceptOpen) {
+ if (QPushButton *button = qFileDialogUi->buttonBox->button(QDialogButtonBox::Open))
+ button->setText(text);
+ } else {
+ if (QPushButton *button = qFileDialogUi->buttonBox->button(QDialogButtonBox::Save))
+ button->setText(text);
+ }
break;
- case Reject:
- button = d->qFileDialogUi->buttonBox->button(QDialogButtonBox::Cancel);
- if (button)
+ case QFileDialog::Reject:
+ if (QPushButton *button = qFileDialogUi->buttonBox->button(QDialogButtonBox::Cancel))
button->setText(text);
break;
}
}
/*!
+ Sets the \a text shown in the filedialog in the specified \a label.
+*/
+
+void QFileDialog::setLabelText(DialogLabel label, const QString &text)
+{
+ Q_D(QFileDialog);
+ d->options->setLabelText(static_cast<QFileDialogOptions::DialogLabel>(label), text);
+ d->setLabelTextControl(label, text);
+}
+
+/*!
Returns the text shown in the filedialog in the specified \a label.
*/
QString QFileDialog::labelText(DialogLabel label) const
@@ -2136,7 +2188,7 @@ void QFileDialog::accept()
return;
}
- switch (d->fileMode) {
+ switch (fileMode()) {
case DirectoryOnly:
case Directory: {
QString fn = files.first();
@@ -2235,7 +2287,7 @@ void QFileDialogPrivate::init(const QString &directory, const QString &nameFilte
createWidgets();
createMenuActions();
retranslateStrings();
- q->setFileMode(fileMode);
+ q->setFileMode(QFileDialog::AnyFile);
#ifndef QT_NO_SETTINGS
QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
@@ -2271,6 +2323,7 @@ void QFileDialogPrivate::createWidgets()
{
Q_Q(QFileDialog);
model = new QFileSystemModel(q);
+ options->setFilter(model->filter());
model->setObjectName(QLatin1String("qt_filesystem_model"));
if (QPlatformFileDialogHelper *helper = platformFileDialogHelper())
model->setNameFilterDisables(helper->defaultNameFilterDisables());
@@ -2290,22 +2343,21 @@ void QFileDialogPrivate::createWidgets()
QList<QUrl> initialBookmarks;
initialBookmarks << QUrl::fromLocalFile(QLatin1String(""))
<< QUrl::fromLocalFile(QDir::homePath());
- qFileDialogUi->sidebar->init(model, initialBookmarks);
+ qFileDialogUi->sidebar->setModelAndUrls(model, initialBookmarks);
QFileDialog::connect(qFileDialogUi->sidebar, SIGNAL(goToUrl(QUrl)),
q, SLOT(_q_goToUrl(QUrl)));
QObject::connect(qFileDialogUi->buttonBox, SIGNAL(accepted()), q, SLOT(accept()));
QObject::connect(qFileDialogUi->buttonBox, SIGNAL(rejected()), q, SLOT(reject()));
-
- qFileDialogUi->lookInCombo->init(this);
+ qFileDialogUi->lookInCombo->setFileDialogPrivate(this);
QObject::connect(qFileDialogUi->lookInCombo, SIGNAL(activated(QString)), q, SLOT(_q_goToDirectory(QString)));
qFileDialogUi->lookInCombo->setInsertPolicy(QComboBox::NoInsert);
qFileDialogUi->lookInCombo->setDuplicatesEnabled(false);
// filename
- qFileDialogUi->fileNameEdit->init(this);
+ qFileDialogUi->fileNameEdit->setFileDialogPrivate(this);
#ifndef QT_NO_SHORTCUT
qFileDialogUi->fileNameLabel->setBuddy(qFileDialogUi->fileNameEdit);
#endif
@@ -2329,7 +2381,7 @@ void QFileDialogPrivate::createWidgets()
QObject::connect(qFileDialogUi->fileTypeCombo, SIGNAL(activated(QString)),
q, SIGNAL(filterSelected(QString)));
- qFileDialogUi->listView->init(this);
+ qFileDialogUi->listView->setFileDialogPrivate(this);
qFileDialogUi->listView->setModel(model);
QObject::connect(qFileDialogUi->listView, SIGNAL(activated(QModelIndex)),
q, SLOT(_q_enterDirectory(QModelIndex)));
@@ -2341,7 +2393,7 @@ void QFileDialogPrivate::createWidgets()
QObject::connect(shortcut, SIGNAL(activated()), q, SLOT(_q_deleteCurrent()));
#endif
- qFileDialogUi->treeView->init(this);
+ qFileDialogUi->treeView->setFileDialogPrivate(this);
qFileDialogUi->treeView->setModel(model);
QHeaderView *treeHeader = qFileDialogUi->treeView->header();
QFontMetrics fm(q->font());
@@ -2850,10 +2902,11 @@ void QFileDialogPrivate::_q_autoCompleteFileName(const QString &text)
void QFileDialogPrivate::_q_updateOkButton()
{
Q_Q(QFileDialog);
- QPushButton *button = qFileDialogUi->buttonBox->button((acceptMode == QFileDialog::AcceptOpen)
+ QPushButton *button = qFileDialogUi->buttonBox->button((q->acceptMode() == QFileDialog::AcceptOpen)
? QDialogButtonBox::Open : QDialogButtonBox::Save);
if (!button)
return;
+ const QFileDialog::FileMode fileMode = q->fileMode();
bool enableButton = true;
bool isOpenDirectory = false;
@@ -2863,8 +2916,7 @@ void QFileDialogPrivate::_q_updateOkButton()
if (lineEditText.startsWith(QLatin1String("//")) || lineEditText.startsWith(QLatin1Char('\\'))) {
button->setEnabled(true);
- if (acceptMode == QFileDialog::AcceptSave)
- button->setText(acceptLabel);
+ updateOkButtonText();
return;
}
@@ -2938,8 +2990,7 @@ void QFileDialogPrivate::_q_updateOkButton()
}
button->setEnabled(enableButton);
- if (acceptMode == QFileDialog::AcceptSave)
- button->setText(isOpenDirectory ? QFileDialog::tr("&Open") : acceptLabel);
+ updateOkButtonText(isOpenDirectory);
}
/*!
@@ -2964,6 +3015,7 @@ void QFileDialogPrivate::_q_enterDirectory(const QModelIndex &index)
QModelIndex sourceIndex = index.model() == proxyModel ? mapToSource(index) : index;
QString path = sourceIndex.data(QFileSystemModel::FilePathRole).toString();
if (path.isEmpty() || model->isDir(sourceIndex)) {
+ const QFileDialog::FileMode fileMode = q->fileMode();
q->setDirectory(path);
emit q->directoryEntered(path);
if (fileMode == QFileDialog::Directory
@@ -3032,14 +3084,16 @@ QStringList QFileDialogPrivate::qt_clean_filter_list(const QString &filter)
*/
void QFileDialogPrivate::_q_useNameFilter(int index)
{
+ QStringList nameFilters = options->nameFilters();
if (index == nameFilters.size()) {
QAbstractItemModel *comboModel = qFileDialogUi->fileTypeCombo->model();
nameFilters.append(comboModel->index(comboModel->rowCount() - 1, 0).data().toString());
+ options->setNameFilters(nameFilters);
}
QString nameFilter = nameFilters.at(index);
QStringList newNameFilters = qt_clean_filter_list(nameFilter);
- if (acceptMode == QFileDialog::AcceptSave) {
+ if (q_func()->acceptMode() == QFileDialog::AcceptSave) {
QString newNameFilterExtension;
if (newNameFilters.count() > 0)
newNameFilterExtension = QFileInfo(newNameFilters.at(0)).suffix();
@@ -3066,6 +3120,7 @@ void QFileDialogPrivate::_q_useNameFilter(int index)
*/
void QFileDialogPrivate::_q_selectionChanged()
{
+ const QFileDialog::FileMode fileMode = q_func()->fileMode();
QModelIndexList indexes = qFileDialogUi->listView->selectionModel()->selectedRows();
bool stripDirs = (fileMode != QFileDialog::DirectoryOnly && fileMode != QFileDialog::Directory);
@@ -3121,18 +3176,13 @@ void QFileDialogPrivate::_q_rowsInserted(const QModelIndex &parent)
void QFileDialogPrivate::_q_fileRenamed(const QString &path, const QString oldName, const QString newName)
{
+ const QFileDialog::FileMode fileMode = q_func()->fileMode();
if (fileMode == QFileDialog::Directory || fileMode == QFileDialog::DirectoryOnly) {
if (path == rootPath() && lineEdit()->text() == oldName)
lineEdit()->setText(newName);
}
}
-void QFileDialogPrivate::_q_platformRunNativeAppModalPanel()
-{
- if (nativeDialogInUse)
- platformHelper()->_q_platformRunNativeAppModalPanel();
-}
-
/*!
\internal
@@ -3181,7 +3231,7 @@ QString QFileDialogPrivate::getEnvironmentVariable(const QString &string)
return string;
}
-void QFileDialogComboBox::init(QFileDialogPrivate *d_pointer) {
+void QFileDialogComboBox::setFileDialogPrivate(QFileDialogPrivate *d_pointer) {
d_ptr = d_pointer;
urlModel = new QUrlModel(this);
urlModel->showFullPath = true;
@@ -3257,7 +3307,7 @@ QFileDialogListView::QFileDialogListView(QWidget *parent) : QListView(parent)
{
}
-void QFileDialogListView::init(QFileDialogPrivate *d_pointer)
+void QFileDialogListView::setFileDialogPrivate(QFileDialogPrivate *d_pointer)
{
d_ptr = d_pointer;
setSelectionBehavior(QAbstractItemView::SelectRows);
@@ -3294,7 +3344,7 @@ QFileDialogTreeView::QFileDialogTreeView(QWidget *parent) : QTreeView(parent)
{
}
-void QFileDialogTreeView::init(QFileDialogPrivate *d_pointer)
+void QFileDialogTreeView::setFileDialogPrivate(QFileDialogPrivate *d_pointer)
{
d_ptr = d_pointer;
setSelectionBehavior(QAbstractItemView::SelectRows);
diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h
index df33fdb265..ac011e634a 100644
--- a/src/widgets/dialogs/qfiledialog.h
+++ b/src/widgets/dialogs/qfiledialog.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qfiledialog.ui b/src/widgets/dialogs/qfiledialog.ui
index 9d61de351f..ff86e9cc13 100644
--- a/src/widgets/dialogs/qfiledialog.ui
+++ b/src/widgets/dialogs/qfiledialog.ui
@@ -1,7 +1,7 @@
<ui version="4.0" >
<comment>*********************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qfiledialog_embedded.ui b/src/widgets/dialogs/qfiledialog_embedded.ui
index f067d31f62..5eb9f52a12 100644
--- a/src/widgets/dialogs/qfiledialog_embedded.ui
+++ b/src/widgets/dialogs/qfiledialog_embedded.ui
@@ -1,7 +1,7 @@
<ui version="4.0" >
<comment>*********************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qfiledialog_mac.mm b/src/widgets/dialogs/qfiledialog_mac.mm
index 1a9f36892d..fe3c41a4b7 100644
--- a/src/widgets/dialogs/qfiledialog_mac.mm
+++ b/src/widgets/dialogs/qfiledialog_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
index 383734950c..30c73ade7b 100644
--- a/src/widgets/dialogs/qfiledialog_p.h
+++ b/src/widgets/dialogs/qfiledialog_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -130,6 +130,9 @@ public:
QStringList typedFiles() const;
QStringList addDefaultSuffixToFiles(const QStringList filesToFix) const;
bool removeDirectory(const QString &path);
+ void setLabelTextControl(QFileDialog::DialogLabel label, const QString &text);
+ inline void updateFileNameLabel();
+ void updateOkButtonText(bool saveAsOnFolder = false);
inline QModelIndex mapToSource(const QModelIndex &index) const;
inline QModelIndex mapFromSource(const QModelIndex &index) const;
@@ -170,6 +173,7 @@ public:
QDir::Filters filterForMode(QDir::Filters filters) const
{
+ const QFileDialog::FileMode fileMode = q_func()->fileMode();
if (fileMode == QFileDialog::DirectoryOnly) {
filters |= QDir::Drives | QDir::AllDirs | QDir::Dirs;
filters &= ~QDir::Files;
@@ -224,7 +228,6 @@ public:
void _q_autoCompleteFileName(const QString &);
void _q_rowsInserted(const QModelIndex & parent);
void _q_fileRenamed(const QString &path, const QString oldName, const QString newName);
- void _q_platformRunNativeAppModalPanel();
static QStringList qt_clean_filter_list(const QString &filter);
static const char *qt_file_dialog_filter_reg_exp;
@@ -242,10 +245,6 @@ public:
QFSCompleter *completer;
#endif //QT_NO_FSCOMPLETER
- QFileDialog::FileMode fileMode;
- QFileDialog::AcceptMode acceptMode;
- bool confirmOverwrite;
- QString defaultSuffix;
QString setWindowTitle;
QStringList currentHistory;
@@ -258,8 +257,6 @@ public:
bool useDefaultCaption;
bool defaultFileTypes;
- bool fileNameLabelExplicitlySat;
- QStringList nameFilters;
// setVisible_sys returns true if it ends up showing a native
// dialog. Returning false means that a non-native dialog must be
@@ -273,7 +270,6 @@ public:
void selectFile_sys(const QString &filename);
QStringList selectedFiles_sys() const;
void setFilter_sys();
- void setNameFilters_sys(const QStringList &filters);
void selectNameFilter_sys(const QString &filter);
QString selectedNameFilter_sys() const;
//////////////////////////////////////////////
@@ -286,12 +282,14 @@ public:
QByteArray memberToDisconnectOnClose;
QByteArray signalToDisconnectOnClose;
- QFileDialog::Options opts;
+ QSharedPointer<QFileDialogOptions> options;
~QFileDialogPrivate();
private:
virtual void initHelper(QPlatformDialogHelper *);
+ virtual void helperPrepareShow(QPlatformDialogHelper *);
+ virtual void helperDone(QDialog::DialogCode, QPlatformDialogHelper *);
Q_DISABLE_COPY(QFileDialogPrivate)
};
@@ -300,7 +298,7 @@ class QFileDialogLineEdit : public QLineEdit
{
public:
QFileDialogLineEdit(QWidget *parent = 0) : QLineEdit(parent), hideOnEsc(false), d_ptr(0){}
- void init(QFileDialogPrivate *d_pointer) {d_ptr = d_pointer; }
+ void setFileDialogPrivate(QFileDialogPrivate *d_pointer) {d_ptr = d_pointer; }
void keyPressEvent(QKeyEvent *e);
bool hideOnEsc;
private:
@@ -311,7 +309,7 @@ class QFileDialogComboBox : public QComboBox
{
public:
QFileDialogComboBox(QWidget *parent = 0) : QComboBox(parent), urlModel(0) {}
- void init(QFileDialogPrivate *d_pointer);
+ void setFileDialogPrivate(QFileDialogPrivate *d_pointer);
void showPopup();
void setHistory(const QStringList &paths);
QStringList history() const { return m_history; }
@@ -327,7 +325,7 @@ class QFileDialogListView : public QListView
{
public:
QFileDialogListView(QWidget *parent = 0);
- void init(QFileDialogPrivate *d_pointer);
+ void setFileDialogPrivate(QFileDialogPrivate *d_pointer);
QSize sizeHint() const;
protected:
void keyPressEvent(QKeyEvent *e);
@@ -339,7 +337,7 @@ class QFileDialogTreeView : public QTreeView
{
public:
QFileDialogTreeView(QWidget *parent);
- void init(QFileDialogPrivate *d_pointer);
+ void setFileDialogPrivate(QFileDialogPrivate *d_pointer);
QSize sizeHint() const;
protected:
@@ -348,16 +346,6 @@ private:
QFileDialogPrivate *d_ptr;
};
-void QFileDialogPrivate::initHelper(QPlatformDialogHelper *h)
-{
- QFileDialog *d = q_func();
- QObject::connect(h, SIGNAL(fileSelected(QString)), d, SIGNAL(fileSelected(QString)));
- QObject::connect(h, SIGNAL(filesSelected(QStringList)), d, SIGNAL(filesSelected(QStringList)));
- QObject::connect(h, SIGNAL(currentChanged(QString)), d, SIGNAL(currentChanged(QString)));
- QObject::connect(h, SIGNAL(directoryEntered(QString)), d, SIGNAL(directoryEntered(QString)));
- QObject::connect(h, SIGNAL(filterSelected(QString)), d, SIGNAL(filterSelected(QString)));
-}
-
inline QModelIndex QFileDialogPrivate::mapToSource(const QModelIndex &index) const {
#ifdef QT_NO_PROXYMODEL
return index;
@@ -427,12 +415,6 @@ inline void QFileDialogPrivate::setFilter_sys()
helper->setFilter_sys();
}
-inline void QFileDialogPrivate::setNameFilters_sys(const QStringList &filters)
-{
- if (QPlatformFileDialogHelper *helper = platformFileDialogHelper())
- helper->setNameFilters_sys(filters);
-}
-
inline void QFileDialogPrivate::selectNameFilter_sys(const QString &filter)
{
if (QPlatformFileDialogHelper *helper = platformFileDialogHelper())
diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp
index 315b93131f..bce8b3ecc1 100644
--- a/src/widgets/dialogs/qfileinfogatherer.cpp
+++ b/src/widgets/dialogs/qfileinfogatherer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -280,10 +280,11 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil
{
#ifndef QT_NO_FILESYSTEMWATCHER
if (files.isEmpty()
- && !watcher->directories().contains(path)
&& !path.isEmpty()
&& !path.startsWith(QLatin1String("//")) /*don't watch UNC path*/) {
- watcher->addPath(path);
+ QMutexLocker locker(&mutex);
+ if (!watcher->directories().contains(path))
+ watcher->addPath(path);
}
#endif
diff --git a/src/widgets/dialogs/qfileinfogatherer_p.h b/src/widgets/dialogs/qfileinfogatherer_p.h
index 98217c1dc8..3621c6b6ad 100644
--- a/src/widgets/dialogs/qfileinfogatherer_p.h
+++ b/src/widgets/dialogs/qfileinfogatherer_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 9de79e0e81..e44a9ea882 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qfilesystemmodel.h b/src/widgets/dialogs/qfilesystemmodel.h
index ce907cd10e..09e8d9d529 100644
--- a/src/widgets/dialogs/qfilesystemmodel.h
+++ b/src/widgets/dialogs/qfilesystemmodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h
index 3d5f5b7f00..2ab7838dad 100644
--- a/src/widgets/dialogs/qfilesystemmodel_p.h
+++ b/src/widgets/dialogs/qfilesystemmodel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index 1935a5aa73..c8fb36d9d6 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -495,6 +495,12 @@ void QFontDialogPrivate::initHelper(QPlatformDialogHelper *h)
QFontDialog *d = q_func();
QObject::connect(h, SIGNAL(currentFontChanged(QFont)), d, SIGNAL(currentFontChanged(QFont)));
QObject::connect(h, SIGNAL(fontSelected(QFont)), d, SIGNAL(fontSelected(QFont)));
+ static_cast<QPlatformFontDialogHelper *>(h)->setOptions(options);
+}
+
+void QFontDialogPrivate::helperPrepareShow(QPlatformDialogHelper *)
+{
+ options->setWindowTitle(q_func()->windowTitle());
}
/*
@@ -888,8 +894,7 @@ QFont QFontDialog::selectedFont() const
void QFontDialog::setOption(FontDialogOption option, bool on)
{
Q_D(QFontDialog);
- if (!(d->opts & option) != !on)
- setOptions(d->opts ^ option);
+ d->options->setOption(static_cast<QFontDialogOptions::FontDialogOption>(option), on);
}
/*!
@@ -901,7 +906,7 @@ void QFontDialog::setOption(FontDialogOption option, bool on)
bool QFontDialog::testOption(FontDialogOption option) const
{
Q_D(const QFontDialog);
- return (d->opts & option) != 0;
+ return d->options->testOption(static_cast<QFontDialogOptions::FontDialogOption>(option));
}
/*!
@@ -921,18 +926,17 @@ void QFontDialog::setOptions(FontDialogOptions options)
{
Q_D(QFontDialog);
- FontDialogOptions changed = (options ^ d->opts);
- if (!changed)
+ if (QFontDialog::options() == options)
return;
- d->opts = options;
+ d->options->setOptions(QFontDialogOptions::FontDialogOptions(int(options)));
d->buttonBox->setVisible(!(options & NoButtons));
}
QFontDialog::FontDialogOptions QFontDialog::options() const
{
Q_D(const QFontDialog);
- return d->opts;
+ return QFontDialog::FontDialogOptions(int(d->options->options()));
}
#ifdef Q_WS_MAC
@@ -1043,7 +1047,7 @@ bool QFontDialogPrivate::canBeNativeDialog()
return true;
if (q->testAttribute(Qt::WA_DontShowOnScreen))
return false;
- if (opts & QFontDialog::DontUseNativeDialog)
+ if (options->options() & QFontDialog::DontUseNativeDialog)
return false;
QLatin1String staticName(QFontDialog::staticMetaObject.className());
diff --git a/src/widgets/dialogs/qfontdialog.h b/src/widgets/dialogs/qfontdialog.h
index 469a5680e1..f5353d512f 100644
--- a/src/widgets/dialogs/qfontdialog.h
+++ b/src/widgets/dialogs/qfontdialog.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qfontdialog_mac.mm b/src/widgets/dialogs/qfontdialog_mac.mm
index d4d3c6a6f0..71b142cd48 100644
--- a/src/widgets/dialogs/qfontdialog_mac.mm
+++ b/src/widgets/dialogs/qfontdialog_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qfontdialog_p.h b/src/widgets/dialogs/qfontdialog_p.h
index ef4e933624..506d52b0b6 100644
--- a/src/widgets/dialogs/qfontdialog_p.h
+++ b/src/widgets/dialogs/qfontdialog_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -58,6 +58,7 @@
#include "qfontdatabase.h"
#include "qfontdialog.h"
#include "qplatformdialoghelper_qpa.h"
+#include "qsharedpointer.h"
#ifndef QT_NO_FONTDIALOG
@@ -78,7 +79,7 @@ class QFontDialogPrivate : public QDialogPrivate
public:
inline QFontDialogPrivate()
- : writingSystem(QFontDatabase::Any)
+ : writingSystem(QFontDatabase::Any), options(new QFontDialogOptions)
{ }
QPlatformFontDialogHelper *platformFontDialogHelper() const
@@ -138,7 +139,7 @@ public:
int size;
bool smoothScalable;
QFont selectedFont;
- QFontDialog::FontDialogOptions opts;
+ QSharedPointer<QFontDialogOptions> options;
QPointer<QObject> receiverToDisconnectOnClose;
QByteArray memberToDisconnectOnClose;
@@ -163,6 +164,7 @@ public:
private:
virtual void initHelper(QPlatformDialogHelper *);
+ virtual void helperPrepareShow(QPlatformDialogHelper *);
};
#endif // QT_NO_FONTDIALOG
diff --git a/src/widgets/dialogs/qfscompleter_p.h b/src/widgets/dialogs/qfscompleter_p.h
index e078542cdc..c25bcf20cb 100644
--- a/src/widgets/dialogs/qfscompleter_p.h
+++ b/src/widgets/dialogs/qfscompleter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp
index 808858a711..dc7e30368b 100644
--- a/src/widgets/dialogs/qinputdialog.cpp
+++ b/src/widgets/dialogs/qinputdialog.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h
index 93abdaec22..164e0d1014 100644
--- a/src/widgets/dialogs/qinputdialog.h
+++ b/src/widgets/dialogs/qinputdialog.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 1dbdeff1a7..fdba17d0ce 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -538,8 +538,8 @@ void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button)
\snippet doc/src/snippets/code/src_gui_dialogs_qmessagebox.cpp 6
This is the approach recommended in the
- \l{http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGWindows/chapter_18_section_7.html}
- {Mac OS X Guidlines}. Similar guidlines apply for the other
+ \l{http://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/Windows/Windows.html#//apple_ref/doc/uid/20000961-BABCAJID}
+ {Mac OS X Guidelines}. Similar guidelines apply for the other
platforms, but note the different ways the
\l{QMessageBox::informativeText} {informative text} is handled for
different platforms.
@@ -1778,7 +1778,7 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title)
"to comply with the terms of the GNU GPL version 3.0.</p>"
"<p>Please see <a href=\"http://qt.nokia.com/products/licensing\">qt.nokia.com/products/licensing</a> "
"for an overview of Qt licensing.</p>"
- "<p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</p>"
+ "<p>Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).</p>"
"<p>Qt is a Nokia product. See <a href=\"http://qt.nokia.com/\">qt.nokia.com</a> "
"for more information.</p>"
);
diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h
index ebfd28a1aa..4774389a69 100644
--- a/src/widgets/dialogs/qmessagebox.h
+++ b/src/widgets/dialogs/qmessagebox.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qnspanelproxy_mac.mm b/src/widgets/dialogs/qnspanelproxy_mac.mm
index 1de548413a..4f171eab74 100644
--- a/src/widgets/dialogs/qnspanelproxy_mac.mm
+++ b/src/widgets/dialogs/qnspanelproxy_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index c38d79e58c..3cf576462d 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qprogressdialog.h b/src/widgets/dialogs/qprogressdialog.h
index b981e5ef63..6089de3f80 100644
--- a/src/widgets/dialogs/qprogressdialog.h
+++ b/src/widgets/dialogs/qprogressdialog.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp
index 8efbb8dfcd..b62afec9bf 100644
--- a/src/widgets/dialogs/qsidebar.cpp
+++ b/src/widgets/dialogs/qsidebar.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -371,7 +371,7 @@ QSidebar::QSidebar(QWidget *parent) : QListView(parent)
{
}
-void QSidebar::init(QFileSystemModel *model, const QList<QUrl> &newUrls)
+void QSidebar::setModelAndUrls(QFileSystemModel *model, const QList<QUrl> &newUrls)
{
// ### TODO make icon size dynamic
setIconSize(QSize(24,24));
diff --git a/src/widgets/dialogs/qsidebar_p.h b/src/widgets/dialogs/qsidebar_p.h
index 6ad2716780..265408b4ef 100644
--- a/src/widgets/dialogs/qsidebar_p.h
+++ b/src/widgets/dialogs/qsidebar_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -121,7 +121,7 @@ Q_SIGNALS:
public:
QSidebar(QWidget *parent = 0);
- void init(QFileSystemModel *model, const QList<QUrl> &newUrls);
+ void setModelAndUrls(QFileSystemModel *model, const QList<QUrl> &newUrls);
~QSidebar();
QSize sizeHint() const;
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 81e23fbb18..dbdff5e34d 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h
index 77eef53037..f9af57c0b1 100644
--- a/src/widgets/dialogs/qwizard.h
+++ b/src/widgets/dialogs/qwizard.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp
index 075c8b81bb..06640a5864 100644
--- a/src/widgets/dialogs/qwizard_win.cpp
+++ b/src/widgets/dialogs/qwizard_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/dialogs/qwizard_win_p.h b/src/widgets/dialogs/qwizard_win_p.h
index f53a9ba75c..ab16d293af 100644
--- a/src/widgets/dialogs/qwizard_win_p.h
+++ b/src/widgets/dialogs/qwizard_win_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/effects/qgraphicseffect.cpp b/src/widgets/effects/qgraphicseffect.cpp
index 45f31d8062..ac33bffd6c 100644
--- a/src/widgets/effects/qgraphicseffect.cpp
+++ b/src/widgets/effects/qgraphicseffect.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/effects/qgraphicseffect.h b/src/widgets/effects/qgraphicseffect.h
index 0ee6b26463..e8e97aa7e7 100644
--- a/src/widgets/effects/qgraphicseffect.h
+++ b/src/widgets/effects/qgraphicseffect.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/effects/qgraphicseffect_p.h b/src/widgets/effects/qgraphicseffect_p.h
index ac15f04d05..b2859f9a41 100644
--- a/src/widgets/effects/qgraphicseffect_p.h
+++ b/src/widgets/effects/qgraphicseffect_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp
index 9cdedc19a3..826bf2e93d 100644
--- a/src/widgets/effects/qpixmapfilter.cpp
+++ b/src/widgets/effects/qpixmapfilter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/effects/qpixmapfilter_p.h b/src/widgets/effects/qpixmapfilter_p.h
index b0edd8d4b0..3f6ed069a1 100644
--- a/src/widgets/effects/qpixmapfilter_p.h
+++ b/src/widgets/effects/qpixmapfilter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraph_p.h b/src/widgets/graphicsview/qgraph_p.h
index 3b9d839a17..676000ac3e 100644
--- a/src/widgets/graphicsview/qgraph_p.h
+++ b/src/widgets/graphicsview/qgraph_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -121,8 +121,8 @@ public:
private:
const Graph *g;
- Q_TYPENAME QHash<Vertex *, QHash<Vertex *, EdgeData *> * >::const_iterator row;
- Q_TYPENAME QHash<Vertex *, EdgeData *>::const_iterator column;
+ typename QHash<Vertex *, QHash<Vertex *, EdgeData *> * >::const_iterator row;
+ typename QHash<Vertex *, EdgeData *>::const_iterator column;
};
const_iterator constBegin() const {
@@ -228,7 +228,7 @@ public:
QString edges;
QSet<Vertex *> setOfVertices = vertices();
- for (Q_TYPENAME QSet<Vertex*>::const_iterator it = setOfVertices.begin(); it != setOfVertices.end(); ++it) {
+ for (typename QSet<Vertex*>::const_iterator it = setOfVertices.begin(); it != setOfVertices.end(); ++it) {
Vertex *v = *it;
QList<Vertex*> adjacents = adjacentVertices(v);
for (int i = 0; i < adjacents.count(); ++i) {
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
index 3bd83ae6c4..3fb768d30a 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout.h b/src/widgets/graphicsview/qgraphicsanchorlayout.h
index 4e57dbccf9..8db6391987 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout.h
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
index c9bda58123..2ac3953676 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.h b/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
index d78e5c89c3..21524e9157 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.cpp b/src/widgets/graphicsview/qgraphicsgridlayout.cpp
index dd4102fdb9..fb4cf954e4 100644
--- a/src/widgets/graphicsview/qgraphicsgridlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicsgridlayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.h b/src/widgets/graphicsview/qgraphicsgridlayout.h
index c6bc2229b6..749af57b0a 100644
--- a/src/widgets/graphicsview/qgraphicsgridlayout.h
+++ b/src/widgets/graphicsview/qgraphicsgridlayout.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index b30d29e704..eb77aee9ae 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h
index 811305ac9d..3873857b8a 100644
--- a/src/widgets/graphicsview/qgraphicsitem.h
+++ b/src/widgets/graphicsview/qgraphicsitem.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsitem_p.h b/src/widgets/graphicsview/qgraphicsitem_p.h
index 3cd77f3cdb..beedbfaa27 100644
--- a/src/widgets/graphicsview/qgraphicsitem_p.h
+++ b/src/widgets/graphicsview/qgraphicsitem_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsitemanimation.cpp b/src/widgets/graphicsview/qgraphicsitemanimation.cpp
index a0b7ea4002..10c292bed1 100644
--- a/src/widgets/graphicsview/qgraphicsitemanimation.cpp
+++ b/src/widgets/graphicsview/qgraphicsitemanimation.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsitemanimation.h b/src/widgets/graphicsview/qgraphicsitemanimation.h
index a6425a50e4..1f17d7e2e5 100644
--- a/src/widgets/graphicsview/qgraphicsitemanimation.h
+++ b/src/widgets/graphicsview/qgraphicsitemanimation.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicslayout.cpp b/src/widgets/graphicsview/qgraphicslayout.cpp
index 0f463334cc..6c8a2662be 100644
--- a/src/widgets/graphicsview/qgraphicslayout.cpp
+++ b/src/widgets/graphicsview/qgraphicslayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicslayout.h b/src/widgets/graphicsview/qgraphicslayout.h
index 6b19f0e622..4e5b2a982a 100644
--- a/src/widgets/graphicsview/qgraphicslayout.h
+++ b/src/widgets/graphicsview/qgraphicslayout.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicslayout_p.cpp b/src/widgets/graphicsview/qgraphicslayout_p.cpp
index c0df2c0d64..ce3525b68d 100644
--- a/src/widgets/graphicsview/qgraphicslayout_p.cpp
+++ b/src/widgets/graphicsview/qgraphicslayout_p.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicslayout_p.h b/src/widgets/graphicsview/qgraphicslayout_p.h
index f11bfbf38c..ea98a4a679 100644
--- a/src/widgets/graphicsview/qgraphicslayout_p.h
+++ b/src/widgets/graphicsview/qgraphicslayout_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicslayoutitem.cpp b/src/widgets/graphicsview/qgraphicslayoutitem.cpp
index 5eaf0a516e..ff53f1fd95 100644
--- a/src/widgets/graphicsview/qgraphicslayoutitem.cpp
+++ b/src/widgets/graphicsview/qgraphicslayoutitem.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicslayoutitem.h b/src/widgets/graphicsview/qgraphicslayoutitem.h
index c617959a06..926a2b15dc 100644
--- a/src/widgets/graphicsview/qgraphicslayoutitem.h
+++ b/src/widgets/graphicsview/qgraphicslayoutitem.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicslayoutitem_p.h b/src/widgets/graphicsview/qgraphicslayoutitem_p.h
index 244c699faa..c13402dc49 100644
--- a/src/widgets/graphicsview/qgraphicslayoutitem_p.h
+++ b/src/widgets/graphicsview/qgraphicslayoutitem_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicslinearlayout.cpp b/src/widgets/graphicsview/qgraphicslinearlayout.cpp
index ee0db09df0..eeb4c0b01c 100644
--- a/src/widgets/graphicsview/qgraphicslinearlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicslinearlayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicslinearlayout.h b/src/widgets/graphicsview/qgraphicslinearlayout.h
index 5d2d5c309f..6d869197cf 100644
--- a/src/widgets/graphicsview/qgraphicslinearlayout.h
+++ b/src/widgets/graphicsview/qgraphicslinearlayout.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
index 1b03879804..2eadec0ef1 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.h b/src/widgets/graphicsview/qgraphicsproxywidget.h
index 9f0a711c46..141b61bf09 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.h
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget_p.h b/src/widgets/graphicsview/qgraphicsproxywidget_p.h
index 86aec5f86b..e3e2cd174b 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget_p.h
+++ b/src/widgets/graphicsview/qgraphicsproxywidget_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index 791f25aa27..a8c3f8dee6 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -5777,8 +5777,8 @@ void QGraphicsScenePrivate::updateTouchPointsForItem(QGraphicsItem *item, QTouch
for (int i = 0; i < touchPoints.count(); ++i) {
QTouchEvent::TouchPoint &touchPoint = touchPoints[i];
touchPoint.setRect(item->mapFromScene(touchPoint.sceneRect()).boundingRect());
- touchPoint.setStartPos(item->d_ptr->genericMapFromScene(touchPoint.startScenePos(), touchEvent->widget()));
- touchPoint.setLastPos(item->d_ptr->genericMapFromScene(touchPoint.lastScenePos(), touchEvent->widget()));
+ touchPoint.setStartPos(item->d_ptr->genericMapFromScene(touchPoint.startScenePos(), static_cast<QWidget *>(touchEvent->target())));
+ touchPoint.setLastPos(item->d_ptr->genericMapFromScene(touchPoint.lastScenePos(), static_cast<QWidget *>(touchEvent->target())));
}
touchEvent->setTouchPoints(touchPoints);
}
@@ -5819,7 +5819,7 @@ void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent)
// determine which item this touch point will go to
cachedItemsUnderMouse = itemsAtPosition(touchPoint.screenPos().toPoint(),
touchPoint.scenePos(),
- sceneTouchEvent->widget());
+ static_cast<QWidget *>(sceneTouchEvent->target()));
item = cachedItemsUnderMouse.isEmpty() ? 0 : cachedItemsUnderMouse.first();
}
@@ -5888,13 +5888,13 @@ void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent)
}
QTouchEvent touchEvent(eventType);
- touchEvent.setWidget(sceneTouchEvent->widget());
+ touchEvent.setWindow(sceneTouchEvent->window());
+ touchEvent.setTarget(sceneTouchEvent->target());
touchEvent.setDevice(sceneTouchEvent->device());
touchEvent.setModifiers(sceneTouchEvent->modifiers());
touchEvent.setTouchPointStates(it.value().first);
touchEvent.setTouchPoints(it.value().second);
touchEvent.setTimestamp(sceneTouchEvent->timestamp());
- touchEvent.setWindow(sceneTouchEvent->window());
switch (touchEvent.type()) {
case QEvent::TouchBegin:
@@ -5935,7 +5935,7 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve
const QTouchEvent::TouchPoint &firstTouchPoint = touchEvent->touchPoints().first();
cachedItemsUnderMouse = itemsAtPosition(firstTouchPoint.screenPos().toPoint(),
firstTouchPoint.scenePos(),
- touchEvent->widget());
+ static_cast<QWidget *>(touchEvent->target()));
}
Q_ASSERT(cachedItemsUnderMouse.first() == origin);
diff --git a/src/widgets/graphicsview/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h
index 1b475e4d02..4e06a7483e 100644
--- a/src/widgets/graphicsview/qgraphicsscene.h
+++ b/src/widgets/graphicsview/qgraphicsscene.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsscene_bsp.cpp b/src/widgets/graphicsview/qgraphicsscene_bsp.cpp
index cc8a558ad3..8b35fb0022 100644
--- a/src/widgets/graphicsview/qgraphicsscene_bsp.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene_bsp.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsscene_bsp_p.h b/src/widgets/graphicsview/qgraphicsscene_bsp_p.h
index 2e8149867b..d371ba5f66 100644
--- a/src/widgets/graphicsview/qgraphicsscene_bsp_p.h
+++ b/src/widgets/graphicsview/qgraphicsscene_bsp_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsscene_p.h b/src/widgets/graphicsview/qgraphicsscene_p.h
index 8cb24457d6..a693c0c309 100644
--- a/src/widgets/graphicsview/qgraphicsscene_p.h
+++ b/src/widgets/graphicsview/qgraphicsscene_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp
index 979ce6823b..1c4653d522 100644
--- a/src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp
+++ b/src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -601,7 +601,7 @@ QList<QGraphicsItem *> QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order) co
10 items.
*/
-int QGraphicsSceneBspTreeIndex::bspTreeDepth()
+int QGraphicsSceneBspTreeIndex::bspTreeDepth() const
{
Q_D(const QGraphicsSceneBspTreeIndex);
return d->bspTreeDepth;
diff --git a/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h
index 0b353c74a4..b3b31fca6a 100644
--- a/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h
+++ b/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -83,7 +83,7 @@ public:
QList<QGraphicsItem *> estimateTopLevelItems(const QRectF &rect, Qt::SortOrder order) const;
QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::DescendingOrder) const;
- int bspTreeDepth();
+ int bspTreeDepth() const;
void setBspTreeDepth(int depth);
protected Q_SLOTS:
diff --git a/src/widgets/graphicsview/qgraphicssceneevent.cpp b/src/widgets/graphicsview/qgraphicssceneevent.cpp
index 4927b6933f..ca6ff59bec 100644
--- a/src/widgets/graphicsview/qgraphicssceneevent.cpp
+++ b/src/widgets/graphicsview/qgraphicssceneevent.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicssceneevent.h b/src/widgets/graphicsview/qgraphicssceneevent.h
index f3677fbef8..cf88a66e3c 100644
--- a/src/widgets/graphicsview/qgraphicssceneevent.h
+++ b/src/widgets/graphicsview/qgraphicssceneevent.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicssceneindex.cpp b/src/widgets/graphicsview/qgraphicssceneindex.cpp
index d5ca504cae..8fb6c666a0 100644
--- a/src/widgets/graphicsview/qgraphicssceneindex.cpp
+++ b/src/widgets/graphicsview/qgraphicssceneindex.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicssceneindex_p.h b/src/widgets/graphicsview/qgraphicssceneindex_p.h
index d7e01f64b3..eff75e89b1 100644
--- a/src/widgets/graphicsview/qgraphicssceneindex_p.h
+++ b/src/widgets/graphicsview/qgraphicssceneindex_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp b/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp
index 9a4b3389bc..08fcdaf08d 100644
--- a/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp
+++ b/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h b/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
index 37ba363c1e..fdd6a82bda 100644
--- a/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
+++ b/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicstransform.cpp b/src/widgets/graphicsview/qgraphicstransform.cpp
index c0cc571bd4..33e3a3cc4d 100644
--- a/src/widgets/graphicsview/qgraphicstransform.cpp
+++ b/src/widgets/graphicsview/qgraphicstransform.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicstransform.h b/src/widgets/graphicsview/qgraphicstransform.h
index 4bceecc47c..8e93a5ee76 100644
--- a/src/widgets/graphicsview/qgraphicstransform.h
+++ b/src/widgets/graphicsview/qgraphicstransform.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicstransform_p.h b/src/widgets/graphicsview/qgraphicstransform_p.h
index d2b851fe97..976ffed2c3 100644
--- a/src/widgets/graphicsview/qgraphicstransform_p.h
+++ b/src/widgets/graphicsview/qgraphicstransform_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index 2ebd4ecc63..4c5c586ec9 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -2836,7 +2836,7 @@ bool QGraphicsView::viewportEvent(QEvent *event)
if (d->scene && d->sceneInteractionAllowed) {
// Convert and deliver the touch event to the scene.
QTouchEvent *touchEvent = static_cast<QTouchEvent *>(event);
- touchEvent->setWidget(viewport());
+ touchEvent->setTarget(viewport());
QGraphicsViewPrivate::translateTouchEvent(d, touchEvent);
(void) QApplication::sendEvent(d->scene, touchEvent);
}
diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h
index 19b5753938..2e33548a29 100644
--- a/src/widgets/graphicsview/qgraphicsview.h
+++ b/src/widgets/graphicsview/qgraphicsview.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicsview_p.h b/src/widgets/graphicsview/qgraphicsview_p.h
index 535679f1d8..c8b36bc89f 100644
--- a/src/widgets/graphicsview/qgraphicsview_p.h
+++ b/src/widgets/graphicsview/qgraphicsview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index e1fbdd4aa8..c415c704bc 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicswidget.h b/src/widgets/graphicsview/qgraphicswidget.h
index 8222886411..b469b64acd 100644
--- a/src/widgets/graphicsview/qgraphicswidget.h
+++ b/src/widgets/graphicsview/qgraphicswidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp
index fd5afaabf4..40333fd1b5 100644
--- a/src/widgets/graphicsview/qgraphicswidget_p.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgraphicswidget_p.h b/src/widgets/graphicsview/qgraphicswidget_p.h
index 16c5303235..99f5661b98 100644
--- a/src/widgets/graphicsview/qgraphicswidget_p.h
+++ b/src/widgets/graphicsview/qgraphicswidget_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgridlayoutengine.cpp b/src/widgets/graphicsview/qgridlayoutengine.cpp
index 66b4a5b6b4..d5eeea68f2 100644
--- a/src/widgets/graphicsview/qgridlayoutengine.cpp
+++ b/src/widgets/graphicsview/qgridlayoutengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qgridlayoutengine_p.h b/src/widgets/graphicsview/qgridlayoutengine_p.h
index f947d67d5a..f8ef75ab12 100644
--- a/src/widgets/graphicsview/qgridlayoutengine_p.h
+++ b/src/widgets/graphicsview/qgridlayoutengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qsimplex_p.cpp b/src/widgets/graphicsview/qsimplex_p.cpp
index eb8bcb8c1f..0a1472a384 100644
--- a/src/widgets/graphicsview/qsimplex_p.cpp
+++ b/src/widgets/graphicsview/qsimplex_p.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/graphicsview/qsimplex_p.h b/src/widgets/graphicsview/qsimplex_p.h
index 3df82c6ccf..82f65bac01 100644
--- a/src/widgets/graphicsview/qsimplex_p.h
+++ b/src/widgets/graphicsview/qsimplex_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/itemviews.pri b/src/widgets/itemviews/itemviews.pri
index 7ef704546e..d5a5012f83 100644
--- a/src/widgets/itemviews/itemviews.pri
+++ b/src/widgets/itemviews/itemviews.pri
@@ -4,7 +4,6 @@ HEADERS += \
itemviews/qabstractitemview.h \
itemviews/qabstractitemview_p.h \
itemviews/qheaderview.h \
- itemviews/qidentityproxymodel.h \
itemviews/qlistview.h \
itemviews/qlistview_p.h \
itemviews/qbsptree_p.h \
@@ -14,8 +13,6 @@ HEADERS += \
itemviews/qtreeview_p.h \
itemviews/qabstractitemdelegate.h \
itemviews/qitemdelegate.h \
- itemviews/qitemselectionmodel.h \
- itemviews/qitemselectionmodel_p.h \
itemviews/qdirmodel.h \
itemviews/qlistwidget.h \
itemviews/qlistwidget_p.h \
@@ -26,14 +23,10 @@ HEADERS += \
itemviews/qwidgetitemdata_p.h \
itemviews/qproxymodel.h \
itemviews/qproxymodel_p.h \
- itemviews/qabstractproxymodel.h \
- itemviews/qabstractproxymodel_p.h \
- itemviews/qsortfilterproxymodel.h \
itemviews/qitemeditorfactory.h \
itemviews/qitemeditorfactory_p.h \
itemviews/qstandarditemmodel.h \
itemviews/qstandarditemmodel_p.h \
- itemviews/qstringlistmodel.h \
itemviews/qtreewidgetitemiterator.h \
itemviews/qdatawidgetmapper.h \
itemviews/qfileiconprovider.h \
@@ -45,24 +38,19 @@ HEADERS += \
SOURCES += \
itemviews/qabstractitemview.cpp \
itemviews/qheaderview.cpp \
- itemviews/qidentityproxymodel.cpp \
itemviews/qlistview.cpp \
itemviews/qbsptree.cpp \
itemviews/qtableview.cpp \
itemviews/qtreeview.cpp \
itemviews/qabstractitemdelegate.cpp \
itemviews/qitemdelegate.cpp \
- itemviews/qitemselectionmodel.cpp \
itemviews/qdirmodel.cpp \
itemviews/qlistwidget.cpp \
itemviews/qtablewidget.cpp \
itemviews/qtreewidget.cpp \
itemviews/qproxymodel.cpp \
- itemviews/qabstractproxymodel.cpp \
- itemviews/qsortfilterproxymodel.cpp \
itemviews/qitemeditorfactory.cpp \
itemviews/qstandarditemmodel.cpp \
- itemviews/qstringlistmodel.cpp \
itemviews/qtreewidgetitemiterator.cpp \
itemviews/qdatawidgetmapper.cpp \
itemviews/qfileiconprovider.cpp \
diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp
index bdc5d69f56..5e000b4d70 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.cpp
+++ b/src/widgets/itemviews/qabstractitemdelegate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -347,7 +347,6 @@ QString QAbstractItemDelegate::elidedText(const QFontMetrics &fontMetrics, int w
\sa QHelpEvent
*/
-// ### Qt 5: Make this a virtual non-slot function
bool QAbstractItemDelegate::helpEvent(QHelpEvent *event,
QAbstractItemView *view,
const QStyleOptionViewItem &option,
diff --git a/src/widgets/itemviews/qabstractitemdelegate.h b/src/widgets/itemviews/qabstractitemdelegate.h
index f494f0b8c8..315feda69e 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.h
+++ b/src/widgets/itemviews/qabstractitemdelegate.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -108,11 +108,10 @@ public:
static QString elidedText(const QFontMetrics &fontMetrics, int width,
Qt::TextElideMode mode, const QString &text);
-public Q_SLOTS:
- bool helpEvent(QHelpEvent *event,
- QAbstractItemView *view,
- const QStyleOptionViewItem &option,
- const QModelIndex &index);
+ virtual bool helpEvent(QHelpEvent *event,
+ QAbstractItemView *view,
+ const QStyleOptionViewItem &option,
+ const QModelIndex &index);
Q_SIGNALS:
void commitData(QWidget *editor);
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 06544e3146..f4a45fb22e 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -673,8 +673,8 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) {
disconnect(d->model, SIGNAL(destroyed()),
this, SLOT(_q_modelDestroyed()));
- disconnect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- this, SLOT(dataChanged(QModelIndex,QModelIndex)));
+ disconnect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QSet<int>)),
+ this, SLOT(dataChanged(QModelIndex,QModelIndex,QSet<int>)));
disconnect(d->model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
this, SLOT(_q_headerDataChanged()));
disconnect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
@@ -683,6 +683,8 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
disconnect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(_q_rowsRemoved(QModelIndex,int,int)));
+ disconnect(d->model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, SLOT(_q_rowsMoved(QModelIndex,int,int,QModelIndex,int)));
disconnect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(_q_rowsInserted(QModelIndex,int,int)));
disconnect(d->model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
@@ -691,6 +693,8 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
this, SLOT(_q_columnsRemoved(QModelIndex,int,int)));
disconnect(d->model, SIGNAL(columnsInserted(QModelIndex,int,int)),
this, SLOT(_q_columnsInserted(QModelIndex,int,int)));
+ disconnect(d->model, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, SLOT(_q_columnsMoved(QModelIndex,int,int,QModelIndex,int)));
disconnect(d->model, SIGNAL(modelReset()), this, SLOT(reset()));
disconnect(d->model, SIGNAL(layoutChanged()), this, SLOT(_q_layoutChanged()));
@@ -709,8 +713,8 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
if (d->model != QAbstractItemModelPrivate::staticEmptyModel()) {
connect(d->model, SIGNAL(destroyed()),
this, SLOT(_q_modelDestroyed()));
- connect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- this, SLOT(dataChanged(QModelIndex,QModelIndex)));
+ connect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QSet<int>)),
+ this, SLOT(dataChanged(QModelIndex,QModelIndex,QSet<int>)));
connect(d->model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
this, SLOT(_q_headerDataChanged()));
connect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
@@ -721,12 +725,16 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
connect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(_q_rowsRemoved(QModelIndex,int,int)));
+ connect(d->model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, SLOT(_q_rowsMoved(QModelIndex,int,int,QModelIndex,int)));
connect(d->model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int)));
connect(d->model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
this, SLOT(_q_columnsRemoved(QModelIndex,int,int)));
connect(d->model, SIGNAL(columnsInserted(QModelIndex,int,int)),
this, SLOT(_q_columnsInserted(QModelIndex,int,int)));
+ connect(d->model, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, SLOT(_q_columnsMoved(QModelIndex,int,int,QModelIndex,int)));
connect(d->model, SIGNAL(modelReset()), this, SLOT(reset()));
connect(d->model, SIGNAL(layoutChanged()), this, SLOT(_q_layoutChanged()));
@@ -1658,15 +1666,11 @@ bool QAbstractItemView::viewportEvent(QEvent *event)
QStyleOptionViewItemV4 option = d->viewOptionsV4();
option.rect = visualRect(index);
option.state |= (index == currentIndex() ? QStyle::State_HasFocus : QStyle::State_None);
- bool retval = false;
- // ### Qt 5: make this a normal function call to a virtual function
- QMetaObject::invokeMethod(d->delegateForIndex(index), "helpEvent",
- Q_RETURN_ARG(bool, retval),
- Q_ARG(QHelpEvent *, he),
- Q_ARG(QAbstractItemView *, this),
- Q_ARG(QStyleOptionViewItem, option),
- Q_ARG(QModelIndex, index));
- return retval;
+
+ QAbstractItemDelegate *delegate = d->delegateForIndex(index);
+ if (!delegate)
+ return false;
+ return delegate->helpEvent(he, this, option, index);
}
case QEvent::FontChange:
d->doDelayedItemsLayout(); // the size of the items will change
@@ -3218,7 +3222,7 @@ void QAbstractItemView::update(const QModelIndex &index)
inclusive. If just one item is changed \a topLeft == \a
bottomRight.
*/
-void QAbstractItemView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
+void QAbstractItemView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &)
{
// Single item changed
Q_D(QAbstractItemView);
@@ -4292,6 +4296,7 @@ QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes,
for (int j = 0; j < paintPairs.count(); ++j) {
option.rect = paintPairs.at(j).first.translated(-r->topLeft());
const QModelIndex &current = paintPairs.at(j).second;
+ adjustViewOptionsForIndex(&option, current);
delegateForIndex(current)->paint(&painter, option, current);
}
return pixmap;
diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h
index 25501e67c5..5ab41bae23 100644
--- a/src/widgets/itemviews/qabstractitemview.h
+++ b/src/widgets/itemviews/qabstractitemview.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -44,7 +44,7 @@
#include <QtWidgets/qabstractscrollarea.h>
#include <QtCore/qabstractitemmodel.h>
-#include <QtWidgets/qitemselectionmodel.h>
+#include <QtCore/qitemselectionmodel.h>
#include <QtWidgets/qabstractitemdelegate.h>
QT_BEGIN_HEADER
@@ -241,7 +241,7 @@ public Q_SLOTS:
void update(const QModelIndex &index);
protected Q_SLOTS:
- virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+ virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &roles = QSet<int>());
virtual void rowsInserted(const QModelIndex &parent, int start, int end);
virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
diff --git a/src/widgets/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h
index 031e325cff..801bb82d85 100644
--- a/src/widgets/itemviews/qabstractitemview_p.h
+++ b/src/widgets/itemviews/qabstractitemview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -197,6 +197,8 @@ public:
#endif
virtual QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const;
+ // reimplemented in subclasses
+ virtual void adjustViewOptionsForIndex(QStyleOptionViewItemV4*, const QModelIndex&) const {}
inline void releaseEditor(QWidget *editor) const {
if (editor) {
diff --git a/src/widgets/itemviews/qbsptree.cpp b/src/widgets/itemviews/qbsptree.cpp
index 89f98f50f3..a049b9d095 100644
--- a/src/widgets/itemviews/qbsptree.cpp
+++ b/src/widgets/itemviews/qbsptree.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qbsptree_p.h b/src/widgets/itemviews/qbsptree_p.h
index c98efba6fa..d7404010d1 100644
--- a/src/widgets/itemviews/qbsptree_p.h
+++ b/src/widgets/itemviews/qbsptree_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp
index 3b4bcae847..8b4db02961 100644
--- a/src/widgets/itemviews/qcolumnview.cpp
+++ b/src/widgets/itemviews/qcolumnview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qcolumnview.h b/src/widgets/itemviews/qcolumnview.h
index b6d8687808..ac734c131d 100644
--- a/src/widgets/itemviews/qcolumnview.h
+++ b/src/widgets/itemviews/qcolumnview.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qcolumnview_p.h b/src/widgets/itemviews/qcolumnview_p.h
index 0da719e756..ce1275e220 100644
--- a/src/widgets/itemviews/qcolumnview_p.h
+++ b/src/widgets/itemviews/qcolumnview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qcolumnviewgrip.cpp b/src/widgets/itemviews/qcolumnviewgrip.cpp
index 19b8c1aa78..ce25fdac03 100644
--- a/src/widgets/itemviews/qcolumnviewgrip.cpp
+++ b/src/widgets/itemviews/qcolumnviewgrip.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qcolumnviewgrip_p.h b/src/widgets/itemviews/qcolumnviewgrip_p.h
index 13bdb3694b..2991f070eb 100644
--- a/src/widgets/itemviews/qcolumnviewgrip_p.h
+++ b/src/widgets/itemviews/qcolumnviewgrip_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp
index 8f5203936d..34699039c4 100644
--- a/src/widgets/itemviews/qdatawidgetmapper.cpp
+++ b/src/widgets/itemviews/qdatawidgetmapper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -104,7 +104,7 @@ public:
void populate();
// private slots
- void _q_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+ void _q_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &);
void _q_commitData(QWidget *);
void _q_closeEditor(QWidget *, QAbstractItemDelegate::EndEditHint);
void _q_modelDestroyed();
@@ -182,7 +182,7 @@ static bool qContainsIndex(const QModelIndex &idx, const QModelIndex &topLeft,
&& idx.column() >= topLeft.column() && idx.column() <= bottomRight.column();
}
-void QDataWidgetMapperPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
+void QDataWidgetMapperPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &)
{
if (topLeft.parent() != rootIndex)
return; // not in our hierarchy
@@ -369,8 +369,8 @@ void QDataWidgetMapper::setModel(QAbstractItemModel *model)
return;
if (d->model) {
- disconnect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this,
- SLOT(_q_dataChanged(QModelIndex,QModelIndex)));
+ disconnect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QSet<int>)), this,
+ SLOT(_q_dataChanged(QModelIndex,QModelIndex,QSet<int>)));
disconnect(d->model, SIGNAL(destroyed()), this,
SLOT(_q_modelDestroyed()));
}
@@ -380,8 +380,8 @@ void QDataWidgetMapper::setModel(QAbstractItemModel *model)
d->model = model;
- connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- SLOT(_q_dataChanged(QModelIndex,QModelIndex)));
+ connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QSet<int>)),
+ SLOT(_q_dataChanged(QModelIndex,QModelIndex,QSet<int>)));
connect(model, SIGNAL(destroyed()), SLOT(_q_modelDestroyed()));
}
diff --git a/src/widgets/itemviews/qdatawidgetmapper.h b/src/widgets/itemviews/qdatawidgetmapper.h
index ebb180fa20..5ffb666fbd 100644
--- a/src/widgets/itemviews/qdatawidgetmapper.h
+++ b/src/widgets/itemviews/qdatawidgetmapper.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -113,7 +113,7 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QDataWidgetMapper)
Q_DISABLE_COPY(QDataWidgetMapper)
- Q_PRIVATE_SLOT(d_func(), void _q_dataChanged(const QModelIndex &, const QModelIndex &))
+ Q_PRIVATE_SLOT(d_func(), void _q_dataChanged(const QModelIndex &, const QModelIndex &, const QSet<int> &))
Q_PRIVATE_SLOT(d_func(), void _q_commitData(QWidget *))
Q_PRIVATE_SLOT(d_func(), void _q_closeEditor(QWidget *, QAbstractItemDelegate::EndEditHint))
Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed())
diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp
index c80662414a..aa74f604e5 100644
--- a/src/widgets/itemviews/qdirmodel.cpp
+++ b/src/widgets/itemviews/qdirmodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qdirmodel.h b/src/widgets/itemviews/qdirmodel.h
index 4ad89065f9..ee6ec3f4aa 100644
--- a/src/widgets/itemviews/qdirmodel.h
+++ b/src/widgets/itemviews/qdirmodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qfileiconprovider.cpp b/src/widgets/itemviews/qfileiconprovider.cpp
index 1821171de8..a085f37d6c 100644
--- a/src/widgets/itemviews/qfileiconprovider.cpp
+++ b/src/widgets/itemviews/qfileiconprovider.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qfileiconprovider.h b/src/widgets/itemviews/qfileiconprovider.h
index fcaaa9f78e..2b90e800a9 100644
--- a/src/widgets/itemviews/qfileiconprovider.h
+++ b/src/widgets/itemviews/qfileiconprovider.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 36784f6424..c9bc3423b0 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -370,6 +370,8 @@ void QHeaderView::setModel(QAbstractItemModel *model)
this, SLOT(sectionsAboutToBeRemoved(QModelIndex,int,int)));
QObject::disconnect(d->model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
this, SLOT(_q_sectionsRemoved(QModelIndex,int,int)));
+ QObject::disconnect(d->model, SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, SLOT(_q_layoutAboutToBeChanged()));
} else {
QObject::disconnect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(sectionsInserted(QModelIndex,int,int)));
@@ -377,11 +379,13 @@ void QHeaderView::setModel(QAbstractItemModel *model)
this, SLOT(sectionsAboutToBeRemoved(QModelIndex,int,int)));
QObject::disconnect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(_q_sectionsRemoved(QModelIndex,int,int)));
+ QObject::disconnect(d->model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, SLOT(_q_layoutAboutToBeChanged()));
}
QObject::disconnect(d->model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
this, SLOT(headerDataChanged(Qt::Orientation,int,int)));
- QObject::disconnect(d->model, SIGNAL(layoutAboutToBeChanged()),
- this, SLOT(_q_layoutAboutToBeChanged()));
+ QObject::disconnect(d->model, SIGNAL(layoutAboutToBeChanged()),
+ this, SLOT(_q_layoutAboutToBeChanged()));
}
if (model && model != QAbstractItemModelPrivate::staticEmptyModel()) {
@@ -389,9 +393,11 @@ void QHeaderView::setModel(QAbstractItemModel *model)
QObject::connect(model, SIGNAL(columnsInserted(QModelIndex,int,int)),
this, SLOT(sectionsInserted(QModelIndex,int,int)));
QObject::connect(model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
- this, SLOT(sectionsAboutToBeRemoved(QModelIndex,int,int)));
+ this, SLOT(sectionsAboutToBeRemoved(QModelIndex,int,int)));
QObject::connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
- this, SLOT(_q_sectionsRemoved(QModelIndex,int,int)));
+ this, SLOT(_q_sectionsRemoved(QModelIndex,int,int)));
+ QObject::connect(model, SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, SLOT(_q_layoutAboutToBeChanged()));
} else {
QObject::connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(sectionsInserted(QModelIndex,int,int)));
@@ -399,6 +405,8 @@ void QHeaderView::setModel(QAbstractItemModel *model)
this, SLOT(sectionsAboutToBeRemoved(QModelIndex,int,int)));
QObject::connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(_q_sectionsRemoved(QModelIndex,int,int)));
+ QObject::connect(model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, SLOT(_q_layoutAboutToBeChanged()));
}
QObject::connect(model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
this, SLOT(headerDataChanged(Qt::Orientation,int,int)));
@@ -884,8 +892,12 @@ void QHeaderView::resizeSection(int logical, int size)
if (stretchLastSection() && visual == d->lastVisibleVisualIndex())
d->lastSectionSize = size;
- if (size != oldSize)
- d->createSectionSpan(visual, visual, size, d->headerSectionResizeMode(visual));
+ d->createSectionSpan(visual, visual, size, d->headerSectionResizeMode(visual));
+
+ if (!updatesEnabled()) {
+ emit sectionResized(logical, oldSize, size);
+ return;
+ }
int w = d->viewport->width();
int h = d->viewport->height();
@@ -2405,7 +2417,13 @@ bool QHeaderView::viewportEvent(QEvent *e)
}
return true; }
#endif // QT_NO_STATUSTIP
- case QEvent::Hide:
+ case QEvent::Hide: {
+ d->invalidateCachedSizeHint();
+ QAbstractScrollArea *parent = qobject_cast<QAbstractScrollArea *>(parentWidget());
+ if (parent && parent->isVisible()) // Only resize if we have a visible parent
+ resizeSections();
+ emit geometriesChanged();
+ break;}
case QEvent::Show:
case QEvent::FontChange:
case QEvent::StyleChange:
@@ -2637,7 +2655,7 @@ void QHeaderView::scrollContentsBy(int dx, int dy)
\reimp
\internal
*/
-void QHeaderView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
+void QHeaderView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &)
{
Q_D(QHeaderView);
d->invalidateCachedSizeHint();
diff --git a/src/widgets/itemviews/qheaderview.h b/src/widgets/itemviews/qheaderview.h
index c9793759a1..1ad79a96e1 100644
--- a/src/widgets/itemviews/qheaderview.h
+++ b/src/widgets/itemviews/qheaderview.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -211,7 +211,7 @@ protected:
void updateGeometries();
void scrollContentsBy(int dx, int dy);
- void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &roles = QSet<int>());
void rowsInserted(const QModelIndex &parent, int start, int end);
QRect visualRect(const QModelIndex &index) const;
diff --git a/src/widgets/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h
index b2b8d686b5..923ab36f72 100644
--- a/src/widgets/itemviews/qheaderview_p.h
+++ b/src/widgets/itemviews/qheaderview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp
index 72f358ce68..e130953c38 100644
--- a/src/widgets/itemviews/qitemdelegate.cpp
+++ b/src/widgets/itemviews/qitemdelegate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -468,7 +468,7 @@ void QItemDelegate::paint(QPainter *painter,
value = index.data(Qt::CheckStateRole);
if (value.isValid()) {
checkState = static_cast<Qt::CheckState>(value.toInt());
- checkRect = check(opt, opt.rect, value);
+ checkRect = doCheck(opt, opt.rect, value);
}
// do the layout
@@ -625,7 +625,7 @@ void QItemDelegate::updateEditorGeometry(QWidget *editor,
QString text = QItemDelegatePrivate::replaceNewLine(index.data(Qt::DisplayRole).toString());
QRect pixmapRect = QRect(QPoint(0, 0), option.decorationSize).intersected(pixmap.rect());
QRect textRect = textRectangle(0, option.rect, option.font, text);
- QRect checkRect = check(option, textRect, index.data(Qt::CheckStateRole));
+ QRect checkRect = doCheck(option, textRect, index.data(Qt::CheckStateRole));
QStyleOptionViewItem opt = option;
opt.showDecorationSelected = true; // let the editor take up all available space
doLayout(opt, &checkRect, &pixmapRect, &textRect, false);
@@ -1079,7 +1079,7 @@ QRect QItemDelegate::rect(const QStyleOptionViewItem &option,
Q_D(const QItemDelegate);
QVariant value = index.data(role);
if (role == Qt::CheckStateRole)
- return check(option, option.rect, value);
+ return doCheck(option, option.rect, value);
if (value.isValid() && !value.isNull()) {
switch (value.type()) {
case QVariant::Invalid:
@@ -1109,20 +1109,8 @@ QRect QItemDelegate::rect(const QStyleOptionViewItem &option,
/*!
\internal
-
- Note that on Mac, if /usr/include/AssertMacros.h is included prior
- to QItemDelegate, and the application is building in debug mode, the
- check(assertion) will conflict with QItemDelegate::check.
-
- To avoid this problem, add
-
- #ifdef check
- #undef check
- #endif
-
- after including AssertMacros.h
*/
-QRect QItemDelegate::check(const QStyleOptionViewItem &option,
+QRect QItemDelegate::doCheck(const QStyleOptionViewItem &option,
const QRect &bounding, const QVariant &value) const
{
if (value.isValid()) {
@@ -1280,7 +1268,7 @@ bool QItemDelegate::editorEvent(QEvent *event,
if ((event->type() == QEvent::MouseButtonRelease)
|| (event->type() == QEvent::MouseButtonDblClick)
|| (event->type() == QEvent::MouseButtonPress)) {
- QRect checkRect = check(option, option.rect, Qt::Checked);
+ QRect checkRect = doCheck(option, option.rect, Qt::Checked);
QRect emptyRect;
doLayout(option, &checkRect, &emptyRect, &emptyRect, false);
QMouseEvent *me = static_cast<QMouseEvent*>(event);
diff --git a/src/widgets/itemviews/qitemdelegate.h b/src/widgets/itemviews/qitemdelegate.h
index 97f3cc820e..5ea6b33f2d 100644
--- a/src/widgets/itemviews/qitemdelegate.h
+++ b/src/widgets/itemviews/qitemdelegate.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -120,7 +120,7 @@ protected:
QPixmap decoration(const QStyleOptionViewItem &option, const QVariant &variant) const;
QPixmap *selected(const QPixmap &pixmap, const QPalette &palette, bool enabled) const;
- QRect check(const QStyleOptionViewItem &option, const QRect &bounding,
+ QRect doCheck(const QStyleOptionViewItem &option, const QRect &bounding,
const QVariant &variant) const;
QRect textRectangle(QPainter *painter, const QRect &rect,
const QFont &font, const QString &text) const;
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index 7ff3622ec4..506ca79702 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qitemeditorfactory.h b/src/widgets/itemviews/qitemeditorfactory.h
index b48cac224f..3d3359dc1a 100644
--- a/src/widgets/itemviews/qitemeditorfactory.h
+++ b/src/widgets/itemviews/qitemeditorfactory.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qitemeditorfactory_p.h b/src/widgets/itemviews/qitemeditorfactory_p.h
index effa6f26a2..613d4e0e81 100644
--- a/src/widgets/itemviews/qitemeditorfactory_p.h
+++ b/src/widgets/itemviews/qitemeditorfactory_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 44ae7246c4..d0b5821c93 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -730,10 +730,10 @@ QSize QListView::contentsSize() const
/*!
\reimp
*/
-void QListView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
+void QListView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &roles)
{
d_func()->commonListView->dataChanged(topLeft, bottomRight);
- QAbstractItemView::dataChanged(topLeft, bottomRight);
+ QAbstractItemView::dataChanged(topLeft, bottomRight, roles);
}
/*!
diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h
index 8e1a04492f..f78806fef1 100644
--- a/src/widgets/itemviews/qlistview.h
+++ b/src/widgets/itemviews/qlistview.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -147,7 +147,7 @@ protected:
void resizeContents(int width, int height);
QSize contentsSize() const;
- void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &roles = QSet<int>());
void rowsInserted(const QModelIndex &parent, int start, int end);
void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h
index 6a7acf669d..b959e66686 100644
--- a/src/widgets/itemviews/qlistview_p.h
+++ b/src/widgets/itemviews/qlistview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp
index a4aaa6b4b6..d99d63c15f 100644
--- a/src/widgets/itemviews/qlistwidget.cpp
+++ b/src/widgets/itemviews/qlistwidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h
index 750b85b4c1..b119b62046 100644
--- a/src/widgets/itemviews/qlistwidget.h
+++ b/src/widgets/itemviews/qlistwidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -45,7 +45,7 @@
#include <QtWidgets/qlistview.h>
#include <QtCore/qvariant.h>
#include <QtCore/qvector.h>
-#include <QtWidgets/qitemselectionmodel.h>
+#include <QtCore/qitemselectionmodel.h>
QT_BEGIN_HEADER
diff --git a/src/widgets/itemviews/qlistwidget_p.h b/src/widgets/itemviews/qlistwidget_p.h
index 2e879cc5d7..9d6b28d813 100644
--- a/src/widgets/itemviews/qlistwidget_p.h
+++ b/src/widgets/itemviews/qlistwidget_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qproxymodel.cpp b/src/widgets/itemviews/qproxymodel.cpp
index bc76bf1623..861cb95ca4 100644
--- a/src/widgets/itemviews/qproxymodel.cpp
+++ b/src/widgets/itemviews/qproxymodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qproxymodel.h b/src/widgets/itemviews/qproxymodel.h
index 948f9a07c9..870ea7b003 100644
--- a/src/widgets/itemviews/qproxymodel.h
+++ b/src/widgets/itemviews/qproxymodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qproxymodel_p.h b/src/widgets/itemviews/qproxymodel_p.h
index 0a8668d2f8..3b73e844dc 100644
--- a/src/widgets/itemviews/qproxymodel_p.h
+++ b/src/widgets/itemviews/qproxymodel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qstandarditemmodel.cpp b/src/widgets/itemviews/qstandarditemmodel.cpp
index 293420beb7..7bfece75ac 100644
--- a/src/widgets/itemviews/qstandarditemmodel.cpp
+++ b/src/widgets/itemviews/qstandarditemmodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qstandarditemmodel.h b/src/widgets/itemviews/qstandarditemmodel.h
index b1e70fffad..41047f7ed5 100644
--- a/src/widgets/itemviews/qstandarditemmodel.h
+++ b/src/widgets/itemviews/qstandarditemmodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qstandarditemmodel_p.h b/src/widgets/itemviews/qstandarditemmodel_p.h
index dc2b5b9a3f..9fcddbe7d1 100644
--- a/src/widgets/itemviews/qstandarditemmodel_p.h
+++ b/src/widgets/itemviews/qstandarditemmodel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index 35d8d3d85b..bf6cbdb7a4 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qstyleditemdelegate.h b/src/widgets/itemviews/qstyleditemdelegate.h
index 6dda0041c9..67f7182446 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.h
+++ b/src/widgets/itemviews/qstyleditemdelegate.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index ec629cad8e..625a7e353b 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qtableview.h b/src/widgets/itemviews/qtableview.h
index 29f3793836..d2773c650e 100644
--- a/src/widgets/itemviews/qtableview.h
+++ b/src/widgets/itemviews/qtableview.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qtableview_p.h b/src/widgets/itemviews/qtableview_p.h
index dce0ed06ac..49ec36f680 100644
--- a/src/widgets/itemviews/qtableview_p.h
+++ b/src/widgets/itemviews/qtableview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp
index 6485fa503d..abfba19117 100644
--- a/src/widgets/itemviews/qtablewidget.cpp
+++ b/src/widgets/itemviews/qtablewidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qtablewidget.h b/src/widgets/itemviews/qtablewidget.h
index d7332542d2..37b6d0f530 100644
--- a/src/widgets/itemviews/qtablewidget.h
+++ b/src/widgets/itemviews/qtablewidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qtablewidget_p.h b/src/widgets/itemviews/qtablewidget_p.h
index 7b7fc21ce8..881c4bd8a3 100644
--- a/src/widgets/itemviews/qtablewidget_p.h
+++ b/src/widgets/itemviews/qtablewidget_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 5674162b05..368be3a6c8 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -664,7 +664,7 @@ void QTreeView::setFirstColumnSpanned(int row, const QModelIndex &parent, bool s
/*!
\reimp
*/
-void QTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
+void QTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &roles)
{
Q_D(QTreeView);
@@ -706,7 +706,7 @@ void QTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto
d->updateScrollBars();
d->viewport->update();
}
- QAbstractItemView::dataChanged(topLeft, bottomRight);
+ QAbstractItemView::dataChanged(topLeft, bottomRight, roles);
}
/*!
@@ -1378,6 +1378,31 @@ QItemViewPaintPairs QTreeViewPrivate::draggablePaintPairs(const QModelIndexList
return ret;
}
+void QTreeViewPrivate::adjustViewOptionsForIndex(QStyleOptionViewItemV4 *option, const QModelIndex &current) const
+{
+ const int row = current.row();
+ option->state = option->state | (viewItems.at(row).expanded ? QStyle::State_Open : QStyle::State_None)
+ | (viewItems.at(row).hasChildren ? QStyle::State_Children : QStyle::State_None)
+ | (viewItems.at(row).hasMoreSiblings ? QStyle::State_Sibling : QStyle::State_None);
+
+ option->showDecorationSelected = (selectionBehavior & QTreeView::SelectRows)
+ || option->showDecorationSelected;
+
+ QVector<int> logicalIndices; // index = visual index of visible columns only. data = logical index.
+ QVector<QStyleOptionViewItemV4::ViewItemPosition> viewItemPosList; // vector of left/middle/end for each logicalIndex, visible columns only.
+ calcLogicalIndices(&logicalIndices, &viewItemPosList);
+
+ int columnIndex = 0;
+ for (int visualIndex = 0; visualIndex < current.column(); ++visualIndex) {
+ int logicalIndex = header->logicalIndex(visualIndex);
+ if (!header->isSectionHidden(logicalIndex)) {
+ ++columnIndex;
+ }
+ }
+
+ option->viewItemPosition = viewItemPosList.at(columnIndex);
+}
+
/*!
\since 4.2
@@ -1463,6 +1488,59 @@ static inline bool ancestorOf(QObject *widget, QObject *other)
return false;
}
+void QTreeViewPrivate::calcLogicalIndices(QVector<int> *logicalIndices, QVector<QStyleOptionViewItemV4::ViewItemPosition> *itemPositions) const
+{
+ const int left = (spanning ? header->visualIndex(0) : leftAndRight.first);
+ const int right = (spanning ? header->visualIndex(0) : leftAndRight.second);
+ const int columnCount = header->count();
+ /* 'left' and 'right' are the left-most and right-most visible visual indices.
+ Compute the first visible logical indices before and after the left and right.
+ We will use these values to determine the QStyleOptionViewItemV4::viewItemPosition. */
+ int logicalIndexBeforeLeft = -1, logicalIndexAfterRight = -1;
+ for (int visualIndex = left - 1; visualIndex >= 0; --visualIndex) {
+ int logicalIndex = header->logicalIndex(visualIndex);
+ if (!header->isSectionHidden(logicalIndex)) {
+ logicalIndexBeforeLeft = logicalIndex;
+ break;
+ }
+ }
+
+ for (int visualIndex = left; visualIndex < columnCount; ++visualIndex) {
+ int logicalIndex = header->logicalIndex(visualIndex);
+ if (!header->isSectionHidden(logicalIndex)) {
+ if (visualIndex > right) {
+ logicalIndexAfterRight = logicalIndex;
+ break;
+ }
+ logicalIndices->append(logicalIndex);
+ }
+ }
+
+ itemPositions->resize(logicalIndices->count());
+ for (int currentLogicalSection = 0; currentLogicalSection < logicalIndices->count(); ++currentLogicalSection) {
+ const int headerSection = logicalIndices->at(currentLogicalSection);
+ // determine the viewItemPosition depending on the position of column 0
+ int nextLogicalSection = currentLogicalSection + 1 >= logicalIndices->count()
+ ? logicalIndexAfterRight
+ : logicalIndices->at(currentLogicalSection + 1);
+ int prevLogicalSection = currentLogicalSection - 1 < 0
+ ? logicalIndexBeforeLeft
+ : logicalIndices->at(currentLogicalSection - 1);
+ QStyleOptionViewItemV4::ViewItemPosition pos;
+ if (columnCount == 1 || (nextLogicalSection == 0 && prevLogicalSection == -1)
+ || (headerSection == 0 && nextLogicalSection == -1) || spanning)
+ pos = QStyleOptionViewItemV4::OnlyOne;
+ else if (headerSection == 0 || (nextLogicalSection != 0 && prevLogicalSection == -1))
+ pos = QStyleOptionViewItemV4::Beginning;
+ else if (nextLogicalSection == 0 || nextLogicalSection == -1)
+ pos = QStyleOptionViewItemV4::End;
+ else
+ pos = QStyleOptionViewItemV4::Middle;
+ (*itemPositions)[currentLogicalSection] = pos;
+ }
+}
+
+
/*!
Draws the row in the tree view that contains the model item \a index,
using the \a painter given. The \a option control how the item is
@@ -1531,33 +1609,13 @@ void QTreeView::drawRow(QPainter *painter, const QStyleOptionViewItem &option,
int width, height = option.rect.height();
int position;
QModelIndex modelIndex;
- int columnCount = header->count();
const bool hoverRow = selectionBehavior() == QAbstractItemView::SelectRows
&& index.parent() == hover.parent()
&& index.row() == hover.row();
- /* 'left' and 'right' are the left-most and right-most visible visual indices.
- Compute the first visible logical indices before and after the left and right.
- We will use these values to determine the QStyleOptionViewItemV4::viewItemPosition. */
- int logicalIndexBeforeLeft = -1, logicalIndexAfterRight = -1;
- for (int visualIndex = left - 1; visualIndex >= 0; --visualIndex) {
- int logicalIndex = header->logicalIndex(visualIndex);
- if (!header->isSectionHidden(logicalIndex)) {
- logicalIndexBeforeLeft = logicalIndex;
- break;
- }
- }
- QVector<int> logicalIndices; // vector of currently visibly logical indices
- for (int visualIndex = left; visualIndex < columnCount; ++visualIndex) {
- int logicalIndex = header->logicalIndex(visualIndex);
- if (!header->isSectionHidden(logicalIndex)) {
- if (visualIndex > right) {
- logicalIndexAfterRight = logicalIndex;
- break;
- }
- logicalIndices.append(logicalIndex);
- }
- }
+ QVector<int> logicalIndices;
+ QVector<QStyleOptionViewItemV4::ViewItemPosition> viewItemPosList; // vector of left/middle/end for each logicalIndex
+ d->calcLogicalIndices(&logicalIndices, &viewItemPosList);
for (int currentLogicalSection = 0; currentLogicalSection < logicalIndices.count(); ++currentLogicalSection) {
int headerSection = logicalIndices.at(currentLogicalSection);
@@ -1579,22 +1637,7 @@ void QTreeView::drawRow(QPainter *painter, const QStyleOptionViewItem &option,
continue;
opt.state = state;
- // determine the viewItemPosition depending on the position of column 0
- int nextLogicalSection = currentLogicalSection + 1 >= logicalIndices.count()
- ? logicalIndexAfterRight
- : logicalIndices.at(currentLogicalSection + 1);
- int prevLogicalSection = currentLogicalSection - 1 < 0
- ? logicalIndexBeforeLeft
- : logicalIndices.at(currentLogicalSection - 1);
- if (columnCount == 1 || (nextLogicalSection == 0 && prevLogicalSection == -1)
- || (headerSection == 0 && nextLogicalSection == -1) || spanning)
- opt.viewItemPosition = QStyleOptionViewItemV4::OnlyOne;
- else if (headerSection == 0 || (nextLogicalSection != 0 && prevLogicalSection == -1))
- opt.viewItemPosition = QStyleOptionViewItemV4::Beginning;
- else if (nextLogicalSection == 0 || nextLogicalSection == -1)
- opt.viewItemPosition = QStyleOptionViewItemV4::End;
- else
- opt.viewItemPosition = QStyleOptionViewItemV4::Middle;
+ opt.viewItemPosition = viewItemPosList.at(currentLogicalSection);
// fake activeness when row editor has focus
if (indexWidgetHasFocus)
diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h
index 8c49375d1d..bc68fd413a 100644
--- a/src/widgets/itemviews/qtreeview.h
+++ b/src/widgets/itemviews/qtreeview.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -144,7 +144,7 @@ public:
void sortByColumn(int column, Qt::SortOrder order);
- void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &roles = QSet<int>());
void selectAll();
Q_SIGNALS:
diff --git a/src/widgets/itemviews/qtreeview_p.h b/src/widgets/itemviews/qtreeview_p.h
index 5a90b15389..7f6413d76c 100644
--- a/src/widgets/itemviews/qtreeview_p.h
+++ b/src/widgets/itemviews/qtreeview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -97,6 +97,7 @@ public:
void initialize();
QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const;
+ void adjustViewOptionsForIndex(QStyleOptionViewItemV4 *option, const QModelIndex &current) const;
#ifndef QT_NO_ANIMATION
struct AnimatedOperation : public QVariantAnimation
@@ -167,6 +168,10 @@ public:
void paintAlternatingRowColors(QPainter *painter, QStyleOptionViewItemV4 *option, int y, int bottom) const;
+ // logicalIndices: vector of currently visibly logical indices
+ // itemPositions: vector of view item positions (beginning/middle/end/onlyone)
+ void calcLogicalIndices(QVector<int> *logicalIndices, QVector<QStyleOptionViewItemV4::ViewItemPosition> *itemPositions) const;
+
QHeaderView *header;
int indent;
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index 8c32e0ce87..71797b182c 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qtreewidget.h b/src/widgets/itemviews/qtreewidget.h
index ec4b0d8585..9f30e94580 100644
--- a/src/widgets/itemviews/qtreewidget.h
+++ b/src/widgets/itemviews/qtreewidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qtreewidget_p.h b/src/widgets/itemviews/qtreewidget_p.h
index 1ead6837c1..a26666dd40 100644
--- a/src/widgets/itemviews/qtreewidget_p.h
+++ b/src/widgets/itemviews/qtreewidget_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.cpp b/src/widgets/itemviews/qtreewidgetitemiterator.cpp
index f538917a09..5fdab5d024 100644
--- a/src/widgets/itemviews/qtreewidgetitemiterator.cpp
+++ b/src/widgets/itemviews/qtreewidgetitemiterator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.h b/src/widgets/itemviews/qtreewidgetitemiterator.h
index 8d27afe2c3..d994b88b12 100644
--- a/src/widgets/itemviews/qtreewidgetitemiterator.h
+++ b/src/widgets/itemviews/qtreewidgetitemiterator.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qtreewidgetitemiterator_p.h b/src/widgets/itemviews/qtreewidgetitemiterator_p.h
index 5ece7fd7b6..c338b944a1 100644
--- a/src/widgets/itemviews/qtreewidgetitemiterator_p.h
+++ b/src/widgets/itemviews/qtreewidgetitemiterator_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/itemviews/qwidgetitemdata_p.h b/src/widgets/itemviews/qwidgetitemdata_p.h
index e7a08de378..cae3e8d1ff 100644
--- a/src/widgets/itemviews/qwidgetitemdata_p.h
+++ b/src/widgets/itemviews/qwidgetitemdata_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index 22162895f7..408e088f0f 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1185,22 +1185,19 @@ void QAction::activate(ActionEvent event)
{
Q_D(QAction);
if(event == Trigger) {
- QObject *guard = this;
- QMetaObject::addGuard(&guard);
+ QWeakPointer<QObject> guard = this;
if(d->checkable) {
// the checked action of an exclusive group cannot be unchecked
if (d->checked && (d->group && d->group->isExclusive()
&& d->group->checkedAction() == this)) {
- if (guard)
+ if (!guard.isNull())
emit triggered(true);
- QMetaObject::removeGuard(&guard);
return;
}
setChecked(!d->checked);
}
- if (guard)
+ if (!guard.isNull())
emit triggered(d->checked);
- QMetaObject::removeGuard(&guard);
} else if(event == Hover) {
emit hovered();
}
@@ -1266,97 +1263,6 @@ void QAction::activate(ActionEvent event)
*/
/*!
- \fn void QAction::setMenuText(const QString &text)
-
- Use setText() instead.
-*/
-
-/*!
- \fn QString QAction::menuText() const
-
- Use text() instead.
-*/
-
-/*!
- \fn bool QAction::isOn() const
-
- Use isChecked() instead.
-*/
-
-/*!
- \fn void QAction::setOn(bool b)
-
- Use setChecked() instead.
-*/
-
-/*!
- \fn bool QAction::isToggleAction() const
-
- Use isCheckable() instead.
-*/
-
-/*!
- \fn void QAction::setToggleAction(bool b)
-
- Use setCheckable() instead.
-*/
-
-/*!
- \fn void QAction::setIconSet(const QIcon &i)
-
- Use setIcon() instead.
-*/
-
-/*!
- \fn bool QAction::addTo(QWidget *w)
-
- Use QWidget::addAction() instead.
-
- \oldcode
- action->addTo(widget);
- \newcode
- widget->addAction(action);
- \endcode
-*/
-
-/*!
- \fn bool QAction::removeFrom(QWidget *w)
-
- Use QWidget::removeAction() instead.
-
- \oldcode
- action->removeFrom(widget);
- \newcode
- widget->removeAction(action);
- \endcode
-*/
-
-/*!
- \fn void QAction::setAccel(const QKeySequence &shortcut)
-
- Use setShortcut() instead.
-*/
-
-/*!
- \fn QIcon QAction::iconSet() const
-
- Use icon() instead.
-*/
-
-/*!
- \fn QKeySequence QAction::accel() const
-
- Use shortcut() instead.
-*/
-
-/*!
- \fn void QAction::activated(int i);
-
- Use triggered() instead.
-*/
-
-
-/*!
\property QAction::menuRole
\brief the action's menu role
\since 4.2
diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h
index 5c163c2314..a2cafa2027 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qaction_p.h b/src/widgets/kernel/qaction_p.h
index 8f9e1f0f8e..d57cd05cff 100644
--- a/src/widgets/kernel/qaction_p.h
+++ b/src/widgets/kernel/qaction_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qactiongroup.cpp b/src/widgets/kernel/qactiongroup.cpp
index 0397883009..67e0ee7adf 100644
--- a/src/widgets/kernel/qactiongroup.cpp
+++ b/src/widgets/kernel/qactiongroup.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qactiongroup.h b/src/widgets/kernel/qactiongroup.h
index 5379ef4197..bdef33294c 100644
--- a/src/widgets/kernel/qactiongroup.h
+++ b/src/widgets/kernel/qactiongroup.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index afd5fb70e1..fc295eb874 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -139,7 +139,6 @@ QT_BEGIN_NAMESPACE
Q_CORE_EXPORT void qt_call_post_routines();
-QApplication::Type qt_appType=QApplication::Tty;
QApplicationPrivate *QApplicationPrivate::self = 0;
QInputContext *QApplicationPrivate::inputContext = 0;
@@ -157,7 +156,6 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T
: QApplicationPrivateBase(argc, argv, flags)
{
application_type = type;
- qt_appType = type;
#ifndef QT_NO_SESSIONMANAGER
is_session_restored = false;
@@ -366,14 +364,6 @@ QApplicationPrivate::~QApplicationPrivate()
*/
/*!
- \enum QApplication::Type
-
- \value Tty a console application
- \value GuiClient a GUI client application
- \value GuiServer a GUI server application (for Qt for Embedded Linux)
-*/
-
-/*!
\enum QApplication::ColorSpec
\value NormalColor the default color allocation policy
@@ -441,7 +431,6 @@ bool QApplicationPrivate::obey_desktop_settings = true; // use winsys res
#ifndef QT_NO_WHEELEVENT
int QApplicationPrivate::wheel_scroll_lines; // number of lines to scroll
#endif
-bool qt_is_gui_used;
bool Q_WIDGETS_EXPORT qt_tab_all_widgets = true;
bool qt_in_tab_key_event = false;
int qt_antialiasing_threshold = -1;
@@ -743,11 +732,11 @@ void QApplicationPrivate::construct(
{
initResources();
- qt_is_gui_used = (qt_appType != QApplication::Tty);
+ qt_is_gui_used = (application_type != QApplication::Tty);
process_cmdline();
// Must be called before initialize()
- qt_init(this, qt_appType
+ qt_init(this, application_type
#ifdef Q_WS_X11
, dpy, visual, cmap
#endif
@@ -873,7 +862,7 @@ void QApplicationPrivate::initialize()
QWidgetPrivate::mapper = new QWidgetMapper;
QWidgetPrivate::allWidgets = new QWidgetSet;
- if (qt_appType != QApplication::Tty)
+ if (application_type != QApplication::Tty)
(void) QApplication::style(); // trigger creation of application style
#ifndef QT_NO_STATEMACHINE
// trigger registering of QStateMachine's GUI types
@@ -917,7 +906,9 @@ void QApplicationPrivate::initialize()
*/
QApplication::Type QApplication::type()
{
- return qt_appType;
+ if (QApplicationPrivate::instance())
+ return (QCoreApplication::Type)QApplicationPrivate::instance()->application_type;
+ return Tty;
}
/*****************************************************************************
@@ -1275,7 +1266,7 @@ QStyle *QApplication::style()
{
if (QApplicationPrivate::app_style)
return QApplicationPrivate::app_style;
- if (!qt_is_gui_used) {
+ if (qApp->type() == QApplication::Tty) {
Q_ASSERT(!"No style available in non-gui applications!");
return 0;
}
@@ -2311,9 +2302,6 @@ void QApplication::setActiveWindow(QWidget* act)
}
}
-#if !defined(Q_WS_MAC)
- QWidget *previousActiveWindow = QApplicationPrivate::active_window;
-#endif
QApplicationPrivate::active_window = window;
if (QApplicationPrivate::active_window) {
@@ -2335,13 +2323,6 @@ void QApplication::setActiveWindow(QWidget* act)
QEvent windowActivate(QEvent::WindowActivate);
QEvent windowDeactivate(QEvent::WindowDeactivate);
-#if !defined(Q_WS_MAC)
- if (!previousActiveWindow) {
- QEvent appActivate(QEvent::ApplicationActivate);
- sendSpontaneousEvent(qApp, &appActivate);
- }
-#endif
-
for (int i = 0; i < toBeActivated.size(); ++i) {
QWidget *w = toBeActivated.at(i);
sendSpontaneousEvent(w, &windowActivate);
@@ -2361,13 +2342,6 @@ void QApplication::setActiveWindow(QWidget* act)
sendSpontaneousEvent(w, &activationChange);
}
-#if !defined(Q_WS_MAC)
- if (!QApplicationPrivate::active_window) {
- QEvent appDeactivate(QEvent::ApplicationDeactivate);
- sendSpontaneousEvent(qApp, &appDeactivate);
- }
-#endif
-
if (QApplicationPrivate::popupWidgets == 0) { // !inPopupMode()
// then focus events
if (!QApplicationPrivate::active_window && QApplicationPrivate::focus_widget) {
@@ -3449,8 +3423,6 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
case QEvent::Style:
case QEvent::IconDrag:
case QEvent::StyleChange:
- case QEvent::AccessibilityHelp:
- case QEvent::AccessibilityDescription:
case QEvent::GraphicsSceneDragEnter:
case QEvent::GraphicsSceneDragMove:
case QEvent::GraphicsSceneDragLeave:
@@ -3896,7 +3868,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
while (widget) {
// first, try to deliver the touch event
bool acceptTouchEvents = widget->testAttribute(Qt::WA_AcceptTouchEvents);
- touchEvent->setWidget(widget);
+ touchEvent->setTarget(widget);
touchEvent->setAccepted(acceptTouchEvents);
QWeakPointer<QWidget> p = widget;
res = acceptTouchEvents && d->notify_helper(widget, touchEvent);
@@ -3912,7 +3884,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
// the first widget to accept the TouchBegin gets an implicit grab.
for (int i = 0; i < touchEvent->touchPoints().count(); ++i) {
const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().at(i);
- d->widgetForTouchPointId[touchPoint.id()] = widget;
+ d->activeTouchPoints[QGuiApplicationPrivate::ActiveTouchPointsKey(touchEvent->device(), touchPoint.id())].target = widget;
}
break;
} else if (p.isNull() || widget->isWindow() || widget->testAttribute(Qt::WA_NoMousePropagation)) {
@@ -3920,7 +3892,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
}
QPoint offset = widget->pos();
widget = widget->parentWidget();
- touchEvent->setWidget(widget);
+ touchEvent->setTarget(widget);
for (int i = 0; i < touchEvent->_touchPoints.size(); ++i) {
QTouchEvent::TouchPoint &pt = touchEvent->_touchPoints[i];
QRectF rect = pt.rect();
@@ -4965,31 +4937,29 @@ int QApplication::keyboardInputInterval()
// Input Method support
// ************************************************************************
-/*!
+/*
This function replaces the QInputContext instance used by the application
with \a inputContext.
Qt takes ownership of the given \a inputContext.
-
- \sa inputContext()
*/
-void QApplication::setInputContext(QInputContext *inputContext)
+void QApplicationPrivate::setInputContext(QInputContext *newInputContext)
{
- if (inputContext == QApplicationPrivate::inputContext)
+ Q_Q(QApplication);
+
+ if (newInputContext == inputContext)
return;
- if (!inputContext) {
- qWarning("QApplication::setInputContext: called with 0 input context");
+ if (!newInputContext) {
+ qWarning("QApplicationPrivate::setInputContext: called with 0 input context");
return;
}
- delete QApplicationPrivate::inputContext;
- QApplicationPrivate::inputContext = inputContext;
- QApplicationPrivate::inputContext->setParent(this);
+ delete inputContext;
+ inputContext = newInputContext;
+ inputContext->setParent(q);
}
/*!
Returns the QInputContext instance used by the application.
-
- \sa setInputContext()
*/
QInputContext *QApplication::inputContext() const
{
@@ -5176,41 +5146,43 @@ void QApplicationPrivate::updateTouchPointsForWidget(QWidget *widget, QTouchEven
rect.moveCenter(widget->mapFromGlobal(screenPos.toPoint()) + delta);
touchPoint.d->rect = rect;
- if (touchPoint.state() == Qt::TouchPointPressed) {
- touchPoint.d->startPos = widget->mapFromGlobal(touchPoint.startScreenPos().toPoint()) + delta;
- touchPoint.d->lastPos = widget->mapFromGlobal(touchPoint.lastScreenPos().toPoint()) + delta;
- }
+ touchPoint.d->startPos = widget->mapFromGlobal(touchPoint.startScreenPos().toPoint()) + delta;
+ touchPoint.d->lastPos = widget->mapFromGlobal(touchPoint.lastScreenPos().toPoint()) + delta;
}
}
void QApplicationPrivate::initializeMultitouch()
{
- widgetForTouchPointId.clear();
- appCurrentTouchPoints.clear();
-
initializeMultitouch_sys();
}
void QApplicationPrivate::cleanupMultitouch()
{
cleanupMultitouch_sys();
-
- widgetForTouchPointId.clear();
- appCurrentTouchPoints.clear();
}
-int QApplicationPrivate::findClosestTouchPointId(const QPointF &screenPos)
+QWidget *QApplicationPrivate::findClosestTouchPointTarget(QTouchDevice *device, const QPointF &screenPos)
{
int closestTouchPointId = -1;
+ QObject *closestTarget = 0;
qreal closestDistance = qreal(0.);
- foreach (const QTouchEvent::TouchPoint &touchPoint, appCurrentTouchPoints) {
- qreal distance = QLineF(screenPos, touchPoint.screenPos()).length();
- if (closestTouchPointId == -1 || distance < closestDistance) {
- closestTouchPointId = touchPoint.id();
- closestDistance = distance;
+ QHash<ActiveTouchPointsKey, ActiveTouchPointsValue>::const_iterator it = activeTouchPoints.constBegin(),
+ ite = activeTouchPoints.constEnd();
+ while (it != ite) {
+ if (it.key().device == device) {
+ const QTouchEvent::TouchPoint &touchPoint = it->touchPoint;
+ qreal dx = screenPos.x() - touchPoint.screenPos().x();
+ qreal dy = screenPos.y() - touchPoint.screenPos().y();
+ qreal distance = dx * dx + dy * dy;
+ if (closestTouchPointId == -1 || distance < closestDistance) {
+ closestTouchPointId = touchPoint.id();
+ closestDistance = distance;
+ closestTarget = it.value().target.data();
+ }
}
+ ++it;
}
- return closestTouchPointId;
+ return static_cast<QWidget *>(closestTarget);
}
void QApplicationPrivate::translateRawTouchEvent(QWidget *window,
@@ -5230,94 +5202,47 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window,
touchPoint.d = touchPoint.d->detach();
// update state
- QWeakPointer<QWidget> widget;
- switch (touchPoint.state()) {
- case Qt::TouchPointPressed:
- {
+ QWeakPointer<QObject> target;
+ ActiveTouchPointsKey touchInfoKey(device, touchPoint.id());
+ ActiveTouchPointsValue &touchInfo = d->activeTouchPoints[touchInfoKey];
+ if (touchPoint.state() == Qt::TouchPointPressed) {
if (device->type() == QTouchDevice::TouchPad) {
// on touch-pads, send all touch points to the same widget
- widget = d->widgetForTouchPointId.isEmpty()
- ? QWeakPointer<QWidget>()
- : d->widgetForTouchPointId.constBegin().value();
+ target = d->activeTouchPoints.isEmpty()
+ ? QWeakPointer<QObject>()
+ : d->activeTouchPoints.constBegin().value().target;
}
- if (!widget) {
+ if (!target) {
// determine which widget this event will go to
if (!window)
window = QApplication::topLevelAt(touchPoint.screenPos().toPoint());
if (!window)
continue;
- widget = window->childAt(window->mapFromGlobal(touchPoint.screenPos().toPoint()));
- if (!widget)
- widget = window;
+ target = window->childAt(window->mapFromGlobal(touchPoint.screenPos().toPoint()));
+ if (!target)
+ target = window;
}
if (device->type() == QTouchDevice::TouchScreen) {
- int closestTouchPointId = d->findClosestTouchPointId(touchPoint.screenPos());
- QWidget *closestWidget = d->widgetForTouchPointId.value(closestTouchPointId).data();
+ QWidget *closestWidget = d->findClosestTouchPointTarget(device, touchPoint.screenPos());
+ QWidget *widget = static_cast<QWidget *>(target.data());
if (closestWidget
- && (widget.data()->isAncestorOf(closestWidget) || closestWidget->isAncestorOf(widget.data()))) {
- widget = closestWidget;
+ && (widget->isAncestorOf(closestWidget) || closestWidget->isAncestorOf(widget))) {
+ target = closestWidget;
}
}
- d->widgetForTouchPointId[touchPoint.id()] = widget;
- touchPoint.d->startScreenPos = touchPoint.screenPos();
- touchPoint.d->lastScreenPos = touchPoint.screenPos();
- touchPoint.d->startNormalizedPos = touchPoint.normalizedPos();
- touchPoint.d->lastNormalizedPos = touchPoint.normalizedPos();
- if (touchPoint.pressure() < qreal(0.))
- touchPoint.d->pressure = qreal(1.);
-
- d->appCurrentTouchPoints.insert(touchPoint.id(), touchPoint);
- break;
- }
- case Qt::TouchPointReleased:
- {
- widget = d->widgetForTouchPointId.take(touchPoint.id());
- if (!widget)
- continue;
-
- QTouchEvent::TouchPoint previousTouchPoint = d->appCurrentTouchPoints.take(touchPoint.id());
- touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos();
- touchPoint.d->lastScreenPos = previousTouchPoint.screenPos();
- touchPoint.d->startPos = previousTouchPoint.startPos();
- touchPoint.d->lastPos = previousTouchPoint.pos();
- touchPoint.d->startNormalizedPos = previousTouchPoint.startNormalizedPos();
- touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos();
- if (touchPoint.pressure() < qreal(0.))
- touchPoint.d->pressure = qreal(0.);
- break;
- }
- default:
- widget = d->widgetForTouchPointId.value(touchPoint.id());
- if (!widget)
+ touchInfo.target = target;
+ } else {
+ target = touchInfo.target;
+ if (!target)
continue;
-
- Q_ASSERT(d->appCurrentTouchPoints.contains(touchPoint.id()));
- QTouchEvent::TouchPoint previousTouchPoint = d->appCurrentTouchPoints.value(touchPoint.id());
- touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos();
- touchPoint.d->lastScreenPos = previousTouchPoint.screenPos();
- touchPoint.d->startPos = previousTouchPoint.startPos();
- touchPoint.d->lastPos = previousTouchPoint.pos();
- touchPoint.d->startNormalizedPos = previousTouchPoint.startNormalizedPos();
- touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos();
- if (touchPoint.pressure() < qreal(0.))
- touchPoint.d->pressure = qreal(1.);
- d->appCurrentTouchPoints[touchPoint.id()] = touchPoint;
- break;
}
- Q_ASSERT(widget.data() != 0);
-
- // make the *scene* functions return the same as the *screen* functions
- touchPoint.d->sceneRect = touchPoint.screenRect();
- touchPoint.d->startScenePos = touchPoint.startScreenPos();
- touchPoint.d->lastScenePos = touchPoint.lastScreenPos();
+ Q_ASSERT(target.data() != 0);
- StatesAndTouchPoints &maskAndPoints = widgetsNeedingEvents[widget.data()];
+ StatesAndTouchPoints &maskAndPoints = widgetsNeedingEvents[static_cast<QWidget *>(target.data())];
maskAndPoints.first |= touchPoint.state();
- if (touchPoint.isPrimary())
- maskAndPoints.first |= Qt::TouchPointPrimary;
maskAndPoints.second.append(touchPoint);
}
@@ -5332,7 +5257,7 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window,
continue;
QEvent::Type eventType;
- switch (it.value().first & Qt::TouchPointStateMask) {
+ switch (it.value().first) {
case Qt::TouchPointPressed:
eventType = QEvent::TouchBegin;
break;
@@ -5355,6 +5280,7 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window,
updateTouchPointsForWidget(widget, &touchEvent);
touchEvent.setTimestamp(timestamp);
touchEvent.setWindow(window->windowHandle());
+ touchEvent.setTarget(widget);
switch (touchEvent.type()) {
case QEvent::TouchBegin:
@@ -5376,14 +5302,6 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window,
}
}
-Q_WIDGETS_EXPORT void qt_translateRawTouchEvent(QWidget *window,
- QTouchDevice *device,
- const QList<QTouchEvent::TouchPoint> &touchPoints,
- ulong timestamp)
-{
- QApplicationPrivate::translateRawTouchEvent(window, device, touchPoints, timestamp);
-}
-
#ifndef QT_NO_GESTURES
QGestureManager* QGestureManager::instance()
{
diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h
index 1792d2f05d..4347aa3521 100644
--- a/src/widgets/kernel/qapplication.h
+++ b/src/widgets/kernel/qapplication.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -98,7 +98,6 @@ class Q_WIDGETS_EXPORT QApplication : public QGuiApplication
Q_PROPERTY(bool autoSipEnabled READ autoSipEnabled WRITE setAutoSipEnabled)
public:
- enum Type { Tty, GuiClient, GuiServer };
#ifndef qdoc
QApplication(int &argc, char **argv, int = ApplicationFlags);
@@ -224,7 +223,6 @@ public:
#endif
#ifndef QT_NO_IM
- void setInputContext(QInputContext *);
QInputContext *inputContext() const;
#endif
@@ -243,7 +241,6 @@ public:
#endif
Q_SIGNALS:
- void lastWindowClosed();
void focusChanged(QWidget *old, QWidget *now);
#ifndef QT_NO_SESSIONMANAGER
void commitDataRequest(QSessionManager &sessionManager);
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 3841cef62f..f8d02ed437 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -88,7 +88,7 @@ class QTouchDevice;
class QGestureManager;
#endif
-extern bool qt_is_gui_used;
+extern Q_GUI_EXPORT bool qt_is_gui_used;
#ifndef QT_NO_CLIPBOARD
extern QClipboard *qt_clipboard;
#endif
@@ -120,37 +120,6 @@ struct QTabletDeviceData
inline QPointF scaleCoord(int coordX, int coordY, int outOriginX, int outExtentX,
int outOriginY, int outExtentY) const;
#endif
-
-#ifdef Q_WS_X11
- QPointer<QWidget> widgetToGetPress;
-#endif
-
-#ifdef Q_WS_X11
- int deviceType;
- enum {
- TOTAL_XINPUT_EVENTS = 64
- };
- void *device;
- int eventCount;
- long unsigned int eventList[TOTAL_XINPUT_EVENTS]; // XEventClass is in fact a long unsigned int
-
- int xinput_motion;
- int xinput_key_press;
- int xinput_key_release;
- int xinput_button_press;
- int xinput_button_release;
- int xinput_proximity_in;
- int xinput_proximity_out;
-#elif defined(Q_WS_WIN)
- qint64 llId;
- int currentDevice;
- int currentPointerType;
-#elif defined(Q_WS_MAC)
- quint64 tabletUniqueID;
- int tabletDeviceType;
- int tabletPointerType;
- int capabilityMask;
-#endif
};
static inline int sign(int x)
@@ -189,80 +158,6 @@ QMacTabletHash *qt_mac_tablet_hash();
# endif
#endif
-
-#if defined(Q_WS_WIN)
-typedef BOOL (WINAPI *PtrRegisterTouchWindow)(HWND, ULONG);
-typedef BOOL (WINAPI *PtrGetTouchInputInfo)(HANDLE, UINT, PVOID, int);
-typedef BOOL (WINAPI *PtrCloseTouchInputHandle)(HANDLE);
-
-#ifndef QT_NO_GESTURES
-typedef BOOL (WINAPI *PtrGetGestureInfo)(HANDLE, PVOID);
-typedef BOOL (WINAPI *PtrGetGestureExtraArgs)(HANDLE, UINT, PBYTE);
-typedef BOOL (WINAPI *PtrCloseGestureInfoHandle)(HANDLE);
-typedef BOOL (WINAPI *PtrSetGestureConfig)(HWND, DWORD, UINT, PVOID, UINT);
-typedef BOOL (WINAPI *PtrGetGestureConfig)(HWND, DWORD, DWORD, PUINT, PVOID, UINT);
-
-typedef BOOL (WINAPI *PtrBeginPanningFeedback)(HWND);
-typedef BOOL (WINAPI *PtrUpdatePanningFeedback)(HWND, LONG, LONG, BOOL);
-typedef BOOL (WINAPI *PtrEndPanningFeedback)(HWND, BOOL);
-
-#ifndef WM_GESTURE
-# define WM_GESTURE 0x0119
-
-# define GID_BEGIN 1
-# define GID_END 2
-# define GID_ZOOM 3
-# define GID_PAN 4
-# define GID_ROTATE 5
-# define GID_TWOFINGERTAP 6
-# define GID_ROLLOVER 7
-
-typedef struct tagGESTUREINFO
-{
- UINT cbSize;
- DWORD dwFlags;
- DWORD dwID;
- HWND hwndTarget;
- POINTS ptsLocation;
- DWORD dwInstanceID;
- DWORD dwSequenceID;
- ULONGLONG ullArguments;
- UINT cbExtraArgs;
-} GESTUREINFO;
-
-# define GC_PAN 0x00000001
-# 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;
- DWORD dwWant;
- 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
-
-#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
-
-#endif // QT_NO_GESTURES
-
-#endif // Q_WS_WIN
-
struct FontHash : public QHash<QByteArray, QFont>
{
FontHash();
@@ -356,6 +251,10 @@ public:
QPoint toolTipPos, toolTipGlobalPos, hoverGlobalPos;
QPointer<QWidget> toolTipWidget;
+#ifndef QT_NO_IM
+ void setInputContext(QInputContext *);
+#endif
+
static QInputContext *inputContext;
static Qt::MouseButtons mouse_buttons;
@@ -472,14 +371,12 @@ public:
QPixmap *ignore_cursor;
#endif
- QMap<int, QWeakPointer<QWidget> > widgetForTouchPointId;
- QMap<int, QTouchEvent::TouchPoint> appCurrentTouchPoints;
static void updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent);
void initializeMultitouch();
void initializeMultitouch_sys();
void cleanupMultitouch();
void cleanupMultitouch_sys();
- int findClosestTouchPointId(const QPointF &screenPos);
+ QWidget *findClosestTouchPointTarget(QTouchDevice *device, const QPointF &screenPos);
void appendTouchPoint(const QTouchEvent::TouchPoint &touchPoint);
void removeTouchPoint(int touchPointId);
static void translateRawTouchEvent(QWidget *widget,
@@ -487,62 +384,11 @@ public:
const QList<QTouchEvent::TouchPoint> &touchPoints,
ulong timestamp);
-#if defined(Q_WS_WIN)
- static bool HasTouchSupport;
- static PtrRegisterTouchWindow RegisterTouchWindow;
- static PtrGetTouchInputInfo GetTouchInputInfo;
- static PtrCloseTouchInputHandle CloseTouchInputHandle;
-
- QHash<DWORD, int> touchInputIDToTouchPointID;
- bool translateTouchEvent(const MSG &msg);
-
-#ifndef QT_NO_GESTURES
- PtrGetGestureInfo GetGestureInfo;
- PtrGetGestureExtraArgs GetGestureExtraArgs;
- PtrCloseGestureInfoHandle CloseGestureInfoHandle;
- PtrSetGestureConfig SetGestureConfig;
- PtrGetGestureConfig GetGestureConfig;
- PtrBeginPanningFeedback BeginPanningFeedback;
- PtrUpdatePanningFeedback UpdatePanningFeedback;
- PtrEndPanningFeedback EndPanningFeedback;
-#endif // QT_NO_GESTURES
-#endif
-
-#ifdef QT_RX71_MULTITOUCH
- bool hasRX71MultiTouch;
-
- struct RX71TouchPointState {
- QSocketNotifier *socketNotifier;
- QTouchEvent::TouchPoint touchPoint;
-
- int minX, maxX, scaleX;
- int minY, maxY, scaleY;
- int minZ, maxZ;
- };
- QList<RX71TouchPointState> allRX71TouchPoints;
-
- bool readRX71MultiTouchEvents(int deviceNumber);
- void fakeMouseEventFromRX71TouchEvent();
- void _q_readRX71MultiTouchEvents();
-#endif
-
-#if defined(Q_OS_SYMBIAN)
- int pressureSupported;
- int maxTouchPressure;
- QList<QTouchEvent::TouchPoint> appAllTouchPoints;
-
- bool useTranslucentEGLSurfaces;
-#endif
-
private:
#ifdef Q_WS_QWS
QMap<const QScreen*, QRect> maxWindowRects;
#endif
-#ifdef Q_OS_SYMBIAN
- QHash<TInt, TUint> scanCodeCache;
-#endif
-
static QApplicationPrivate *self;
static void giveFocusAccordingToFocusPolicy(QWidget *w,
@@ -554,11 +400,6 @@ private:
static bool isAlien(QWidget *);
};
-Q_WIDGETS_EXPORT void qt_translateRawTouchEvent(QWidget *window,
- QTouchDevice *device,
- const QList<QTouchEvent::TouchPoint> &touchPoints,
- ulong timestamp);
-
#if defined(Q_WS_WIN)
extern void qt_win_set_cursor(QWidget *, bool);
#elif defined(Q_WS_X11)
diff --git a/src/widgets/kernel/qapplication_qpa.cpp b/src/widgets/kernel/qapplication_qpa.cpp
index 8732a194e8..d61b8560a8 100644
--- a/src/widgets/kernel/qapplication_qpa.cpp
+++ b/src/widgets/kernel/qapplication_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -383,7 +383,7 @@ QPlatformNativeInterface *QApplication::platformNativeInterface()
return pi->nativeInterface();
}
-void qt_init(QApplicationPrivate *, int type)
+void qt_init(QApplicationPrivate *priv, int type)
{
Q_UNUSED(type);
@@ -393,7 +393,7 @@ void qt_init(QApplicationPrivate *, int type)
qApp->setObjectName(appName);
#ifndef QT_NO_QWS_INPUTMETHODS
- qApp->setInputContext(new QInputContext(qApp));
+ priv->setInputContext(new QInputContext(qApp));
#endif
}
diff --git a/src/widgets/kernel/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp
index 059c59fa1c..e8d653e25d 100644
--- a/src/widgets/kernel/qboxlayout.cpp
+++ b/src/widgets/kernel/qboxlayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qboxlayout.h b/src/widgets/kernel/qboxlayout.h
index 5031972226..8df0fbca94 100644
--- a/src/widgets/kernel/qboxlayout.h
+++ b/src/widgets/kernel/qboxlayout.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp
index 8c25d72f84..871715fed4 100644
--- a/src/widgets/kernel/qdesktopwidget.cpp
+++ b/src/widgets/kernel/qdesktopwidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qdesktopwidget.h b/src/widgets/kernel/qdesktopwidget.h
index e1ed8cfa07..ec38b32239 100644
--- a/src/widgets/kernel/qdesktopwidget.h
+++ b/src/widgets/kernel/qdesktopwidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qdesktopwidget.qdoc b/src/widgets/kernel/qdesktopwidget.qdoc
index 06a52af893..10690dfe35 100644
--- a/src/widgets/kernel/qdesktopwidget.qdoc
+++ b/src/widgets/kernel/qdesktopwidget.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qdesktopwidget_qpa.cpp b/src/widgets/kernel/qdesktopwidget_qpa.cpp
index 380daee8c0..8ac2b357c6 100644
--- a/src/widgets/kernel/qdesktopwidget_qpa.cpp
+++ b/src/widgets/kernel/qdesktopwidget_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qdesktopwidget_qpa_p.h b/src/widgets/kernel/qdesktopwidget_qpa_p.h
index 01ba44875d..50b5f4826e 100644
--- a/src/widgets/kernel/qdesktopwidget_qpa_p.h
+++ b/src/widgets/kernel/qdesktopwidget_qpa_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index 6430472462..955ef4e3c7 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -93,7 +93,7 @@ void FixedColumnMatrix<T, NumColumns>::addRow(const T &value)
template <class T, int NumColumns>
void FixedColumnMatrix<T, NumColumns>::insertRow(int r, const T &value)
{
- Q_TYPENAME Storage::iterator it = m_storage.begin();
+ typename Storage::iterator it = m_storage.begin();
it += r * NumColumns;
m_storage.insert(it, NumColumns, value);
}
diff --git a/src/widgets/kernel/qformlayout.h b/src/widgets/kernel/qformlayout.h
index 05bb57d981..b37d2b6e3a 100644
--- a/src/widgets/kernel/qformlayout.h
+++ b/src/widgets/kernel/qformlayout.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qgesture.cpp b/src/widgets/kernel/qgesture.cpp
index 12a0eaf45a..f79b577765 100644
--- a/src/widgets/kernel/qgesture.cpp
+++ b/src/widgets/kernel/qgesture.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qgesture.h b/src/widgets/kernel/qgesture.h
index 610ae2b9f6..25dba1c886 100644
--- a/src/widgets/kernel/qgesture.h
+++ b/src/widgets/kernel/qgesture.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qgesture_p.h b/src/widgets/kernel/qgesture_p.h
index 85d1c85884..be8e38cd7f 100644
--- a/src/widgets/kernel/qgesture_p.h
+++ b/src/widgets/kernel/qgesture_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index 5b5d8dcb2a..5abbbde4cb 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qgesturemanager_p.h b/src/widgets/kernel/qgesturemanager_p.h
index 6c8cbb9cd0..800d7c5ad9 100644
--- a/src/widgets/kernel/qgesturemanager_p.h
+++ b/src/widgets/kernel/qgesturemanager_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qgesturerecognizer.cpp b/src/widgets/kernel/qgesturerecognizer.cpp
index 98f8b0a758..fc0e918987 100644
--- a/src/widgets/kernel/qgesturerecognizer.cpp
+++ b/src/widgets/kernel/qgesturerecognizer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qgesturerecognizer.h b/src/widgets/kernel/qgesturerecognizer.h
index 019f856f09..92f9f622c0 100644
--- a/src/widgets/kernel/qgesturerecognizer.h
+++ b/src/widgets/kernel/qgesturerecognizer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp
index 9168346e30..80834a0105 100644
--- a/src/widgets/kernel/qgridlayout.cpp
+++ b/src/widgets/kernel/qgridlayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qgridlayout.h b/src/widgets/kernel/qgridlayout.h
index ef95d29cd1..f72ed32dcb 100644
--- a/src/widgets/kernel/qgridlayout.h
+++ b/src/widgets/kernel/qgridlayout.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qguiplatformplugin.cpp b/src/widgets/kernel/qguiplatformplugin.cpp
index 8acc7ec90d..7faf17b9ab 100644
--- a/src/widgets/kernel/qguiplatformplugin.cpp
+++ b/src/widgets/kernel/qguiplatformplugin.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -148,7 +148,7 @@ QString QGuiPlatformPlugin::styleName()
return QLatin1String("CDE"); // default style for X11 on Solaris
#elif defined(Q_WS_X11) && defined(Q_OS_IRIX)
return QLatin1String("SGI"); // default style for X11 on IRIX
-#elif defined(Q_WS_MAC)
+#elif defined(Q_OS_MAC)
return QLatin1String("Macintosh"); // default style for all Mac's
#elif defined(Q_WS_X11)
QString stylename;
diff --git a/src/widgets/kernel/qguiplatformplugin_p.h b/src/widgets/kernel/qguiplatformplugin_p.h
index 84319b71a0..74a01b9d58 100644
--- a/src/widgets/kernel/qguiplatformplugin_p.h
+++ b/src/widgets/kernel/qguiplatformplugin_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qicon.cpp b/src/widgets/kernel/qicon.cpp
index de7544f09a..185542420e 100644
--- a/src/widgets/kernel/qicon.cpp
+++ b/src/widgets/kernel/qicon.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1161,6 +1161,14 @@ QDataStream &operator>>(QDataStream &s, QIcon &icon)
#endif //QT_NO_DATASTREAM
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QIcon &i)
+{
+ dbg.nospace() << "QIcon(" << i.name() << ')';
+ return dbg.space();
+}
+#endif
+
/*!
\fn DataPtr &QIcon::data_ptr()
\internal
diff --git a/src/widgets/kernel/qicon.h b/src/widgets/kernel/qicon.h
index 3c527eb974..a72ae236f1 100644
--- a/src/widgets/kernel/qicon.h
+++ b/src/widgets/kernel/qicon.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -136,6 +136,10 @@ Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QIcon &);
Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &, QIcon &);
#endif
+#ifndef QT_NO_DEBUG_STREAM
+Q_WIDGETS_EXPORT QDebug operator<<(QDebug dbg, const QIcon &);
+#endif
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/widgets/kernel/qicon_p.h b/src/widgets/kernel/qicon_p.h
index 7ba471b002..02ac3afed4 100644
--- a/src/widgets/kernel/qicon_p.h
+++ b/src/widgets/kernel/qicon_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qiconengine.cpp b/src/widgets/kernel/qiconengine.cpp
index 52e8cfd384..930d7e1699 100644
--- a/src/widgets/kernel/qiconengine.cpp
+++ b/src/widgets/kernel/qiconengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qiconengine.h b/src/widgets/kernel/qiconengine.h
index 63cfcbff5e..083ceee33d 100644
--- a/src/widgets/kernel/qiconengine.h
+++ b/src/widgets/kernel/qiconengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qiconengineplugin.cpp b/src/widgets/kernel/qiconengineplugin.cpp
index 2775fb201d..895572120e 100644
--- a/src/widgets/kernel/qiconengineplugin.cpp
+++ b/src/widgets/kernel/qiconengineplugin.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qiconengineplugin.h b/src/widgets/kernel/qiconengineplugin.h
index c228e8666b..1bd9075866 100644
--- a/src/widgets/kernel/qiconengineplugin.h
+++ b/src/widgets/kernel/qiconengineplugin.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qiconloader.cpp b/src/widgets/kernel/qiconloader.cpp
index 45959c03ef..d8bef74dd8 100644
--- a/src/widgets/kernel/qiconloader.cpp
+++ b/src/widgets/kernel/qiconloader.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qiconloader_p.h b/src/widgets/kernel/qiconloader_p.h
index 1c6c0cb1a5..840a2858b6 100644
--- a/src/widgets/kernel/qiconloader_p.h
+++ b/src/widgets/kernel/qiconloader_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qinputcontext.cpp b/src/widgets/kernel/qinputcontext.cpp
index 66595e8ee4..27576193e9 100644
--- a/src/widgets/kernel/qinputcontext.cpp
+++ b/src/widgets/kernel/qinputcontext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qinputcontext.h b/src/widgets/kernel/qinputcontext.h
index 8a80d72ac2..147061f221 100644
--- a/src/widgets/kernel/qinputcontext.h
+++ b/src/widgets/kernel/qinputcontext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index ebf9cf6cae..a682354df1 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qlayout.h b/src/widgets/kernel/qlayout.h
index 65fccb13fa..4d9213c1ec 100644
--- a/src/widgets/kernel/qlayout.h
+++ b/src/widgets/kernel/qlayout.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qlayout_p.h b/src/widgets/kernel/qlayout_p.h
index e282360418..cc80987500 100644
--- a/src/widgets/kernel/qlayout_p.h
+++ b/src/widgets/kernel/qlayout_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qlayoutengine.cpp b/src/widgets/kernel/qlayoutengine.cpp
index a7470aabaa..38e6555658 100644
--- a/src/widgets/kernel/qlayoutengine.cpp
+++ b/src/widgets/kernel/qlayoutengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qlayoutengine_p.h b/src/widgets/kernel/qlayoutengine_p.h
index 9be9ecd321..5f5d0aa49e 100644
--- a/src/widgets/kernel/qlayoutengine_p.h
+++ b/src/widgets/kernel/qlayoutengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp
index 5fcda5dfea..732c941c74 100644
--- a/src/widgets/kernel/qlayoutitem.cpp
+++ b/src/widgets/kernel/qlayoutitem.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,6 +42,7 @@
#include "qlayout.h"
#include "qapplication.h"
+#include "qdebug.h"
#include "qlayoutengine_p.h"
#include "qmenubar.h"
#include "qtoolbar.h"
@@ -836,4 +837,13 @@ int QWidgetItemV2::heightForWidth(int width) const
return height;
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QSizePolicy &p)
+{
+ dbg.nospace() << "QSizePolicy(horizontalPolicy = " << p.horizontalPolicy()
+ << ", verticalPolicy = " << p.verticalPolicy() << ')';
+ return dbg.space();
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qlayoutitem.h b/src/widgets/kernel/qlayoutitem.h
index d03f77654b..a09dcf33de 100644
--- a/src/widgets/kernel/qlayoutitem.h
+++ b/src/widgets/kernel/qlayoutitem.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qplatformdialoghelper_qpa.cpp b/src/widgets/kernel/qplatformdialoghelper_qpa.cpp
index daf864ff30..cfe2b15572 100644
--- a/src/widgets/kernel/qplatformdialoghelper_qpa.cpp
+++ b/src/widgets/kernel/qplatformdialoghelper_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
- ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,6 +42,11 @@
#include "qplatformdialoghelper_qpa.h"
#include <QtCore/QVariant>
+#include <QtCore/QSharedData>
+#include <QtCore/QSettings>
+#include <QtCore/QHash>
+#include <QtCore/QUrl>
+#include <QtGui/QColor>
QT_BEGIN_NAMESPACE
@@ -87,4 +92,465 @@ QVariant QPlatformDialogHelper::defaultStyleHint(QPlatformDialogHelper::StyleHi
return QVariant();
}
+void QPlatformDialogHelper::emitLaunchNativeAppModalPanel()
+{
+ emit launchNativeAppModalPanel();
+}
+
+// Font dialog
+
+class QFontDialogOptionsPrivate : public QSharedData
+{
+public:
+ QFontDialogOptionsPrivate() : options(0) {}
+
+ QFontDialogOptions::FontDialogOptions options;
+ QString windowTitle;
+};
+
+QFontDialogOptions::QFontDialogOptions() : d(new QFontDialogOptionsPrivate)
+{
+}
+
+QFontDialogOptions::QFontDialogOptions(const QFontDialogOptions &rhs) : d(rhs.d)
+{
+}
+
+QFontDialogOptions &QFontDialogOptions::operator=(const QFontDialogOptions &rhs)
+{
+ if (this != &rhs)
+ d = rhs.d;
+ return *this;
+}
+
+QFontDialogOptions::~QFontDialogOptions()
+{
+}
+
+QString QFontDialogOptions::windowTitle() const
+{
+ return d->windowTitle;
+}
+
+void QFontDialogOptions::setWindowTitle(const QString &title)
+{
+ d->windowTitle = title;
+}
+
+void QFontDialogOptions::setOption(QFontDialogOptions::FontDialogOption option, bool on)
+{
+ if (!(d->options & option) != !on)
+ setOptions(d->options ^ option);
+}
+
+bool QFontDialogOptions::testOption(QFontDialogOptions::FontDialogOption option) const
+{
+ return d->options & option;
+}
+
+void QFontDialogOptions::setOptions(FontDialogOptions options)
+{
+ if (options != d->options)
+ d->options = options;
+}
+
+QFontDialogOptions::FontDialogOptions QFontDialogOptions::options() const
+{
+ return d->options;
+}
+
+const QSharedPointer<QFontDialogOptions> &QPlatformFontDialogHelper::options() const
+{
+ return m_options;
+}
+
+void QPlatformFontDialogHelper::setOptions(const QSharedPointer<QFontDialogOptions> &options)
+{
+ m_options = options;
+}
+
+// Color dialog
+
+class QColorDialogStaticData
+{
+public:
+ enum { CustomColorCount = 16, StandardColorCount = 6 * 8 };
+
+ QColorDialogStaticData();
+ inline void readSettings();
+ inline void writeSettings() const;
+
+ QRgb customRgb[CustomColorCount];
+ QRgb standardRgb[StandardColorCount];
+ bool customSet;
+};
+
+QColorDialogStaticData::QColorDialogStaticData() : customSet(false)
+{
+ int i = 0;
+ for (int g = 0; g < 4; ++g)
+ for (int r = 0; r < 4; ++r)
+ for (int b = 0; b < 3; ++b)
+ standardRgb[i++] = qRgb(r * 255 / 3, g * 255 / 3, b * 255 / 2);
+ qFill(customRgb, customRgb + CustomColorCount, 0xffffffff);
+ readSettings();
+}
+
+void QColorDialogStaticData::readSettings()
+{
+#ifndef QT_NO_SETTINGS
+ const QSettings settings(QSettings::UserScope, QStringLiteral("Trolltech"));
+ for (int i = 0; i < int(CustomColorCount); ++i) {
+ const QVariant v = settings.value(QStringLiteral("Qt/customColors/") + QString::number(i));
+ if (v.isValid())
+ customRgb[i] = v.toUInt();
+ }
+#endif
+}
+
+void QColorDialogStaticData::writeSettings() const
+{
+#ifndef QT_NO_SETTINGS
+ if (!customSet) {
+ QSettings settings(QSettings::UserScope, QStringLiteral("Trolltech"));
+ for (int i = 0; i < int(CustomColorCount); ++i)
+ settings.setValue(QStringLiteral("Qt/customColors/") + QString::number(i), customRgb[i]);
+ }
+#endif
+}
+
+Q_GLOBAL_STATIC(QColorDialogStaticData, qColorDialogStaticData)
+
+class QColorDialogOptionsPrivate : public QSharedData
+{
+public:
+ QColorDialogOptionsPrivate() : options(0) {}
+ // Write out settings around destruction of dialogs
+ ~QColorDialogOptionsPrivate() { qColorDialogStaticData()->writeSettings(); }
+
+ QColorDialogOptions::ColorDialogOptions options;
+ QString windowTitle;
+};
+
+QColorDialogOptions::QColorDialogOptions() : d(new QColorDialogOptionsPrivate)
+{
+}
+
+QColorDialogOptions::QColorDialogOptions(const QColorDialogOptions &rhs) : d(rhs.d)
+{
+}
+
+QColorDialogOptions &QColorDialogOptions::operator=(const QColorDialogOptions &rhs)
+{
+ if (this != &rhs)
+ d = rhs.d;
+ return *this;
+}
+
+QColorDialogOptions::~QColorDialogOptions()
+{
+}
+
+QString QColorDialogOptions::windowTitle() const
+{
+ return d->windowTitle;
+}
+
+void QColorDialogOptions::setWindowTitle(const QString &title)
+{
+ d->windowTitle = title;
+}
+
+void QColorDialogOptions::setOption(QColorDialogOptions::ColorDialogOption option, bool on)
+{
+ if (!(d->options & option) != !on)
+ setOptions(d->options ^ option);
+}
+
+bool QColorDialogOptions::testOption(QColorDialogOptions::ColorDialogOption option) const
+{
+ return d->options & option;
+}
+
+void QColorDialogOptions::setOptions(ColorDialogOptions options)
+{
+ if (options != d->options)
+ d->options = options;
+}
+
+QColorDialogOptions::ColorDialogOptions QColorDialogOptions::options() const
+{
+ return d->options;
+}
+
+int QColorDialogOptions::customColorCount()
+{
+ return QColorDialogStaticData::CustomColorCount;
+}
+
+QRgb QColorDialogOptions::customColor(int index)
+{
+ if (uint(index) >= uint(QColorDialogStaticData::CustomColorCount))
+ return qRgb(255, 255, 255);
+ return qColorDialogStaticData()->customRgb[index];
+}
+
+QRgb *QColorDialogOptions::customColors()
+{
+ return qColorDialogStaticData()->customRgb;
+}
+
+void QColorDialogOptions::setCustomColor(int index, QRgb color)
+{
+ if (uint(index) >= uint(QColorDialogStaticData::CustomColorCount))
+ return;
+ qColorDialogStaticData()->customSet;
+ qColorDialogStaticData()->customRgb[index] = color;
+}
+
+QRgb *QColorDialogOptions::standardColors()
+{
+ return qColorDialogStaticData()->standardRgb;
+}
+
+QRgb QColorDialogOptions::standardColor(int index)
+{
+ if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount))
+ return qRgb(255, 255, 255);
+ return qColorDialogStaticData()->standardRgb[index];
+}
+
+void QColorDialogOptions::setStandardColor(int index, QRgb color)
+{
+ if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount))
+ return;
+ qColorDialogStaticData()->standardRgb[index] = color;
+}
+
+const QSharedPointer<QColorDialogOptions> &QPlatformColorDialogHelper::options() const
+{
+ return m_options;
+}
+
+void QPlatformColorDialogHelper::setOptions(const QSharedPointer<QColorDialogOptions> &options)
+{
+ m_options = options;
+}
+
+// File dialog
+
+class QFileDialogOptionsPrivate : public QSharedData
+{
+public:
+ QFileDialogOptionsPrivate() : options(0),
+ viewMode(QFileDialogOptions::Detail),
+ fileMode(QFileDialogOptions::AnyFile),
+ acceptMode(QFileDialogOptions::AcceptOpen),
+ filters(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs)
+ {}
+
+ QFileDialogOptions::FileDialogOptions options;
+ QString windowTitle;
+
+ QFileDialogOptions::ViewMode viewMode;
+ QFileDialogOptions::FileMode fileMode;
+ QFileDialogOptions::AcceptMode acceptMode;
+ QString labels[QFileDialogOptions::DialogLabelCount];
+ QDir::Filters filters;
+ QList<QUrl> sidebarUrls;
+ QStringList nameFilters;
+ QString defaultSuffix;
+ QStringList history;
+ QString initialDirectory;
+ QString initiallySelectedNameFilter;
+ QStringList initiallySelectedFiles;
+};
+
+QFileDialogOptions::QFileDialogOptions() : d(new QFileDialogOptionsPrivate)
+{
+}
+
+QFileDialogOptions::QFileDialogOptions(const QFileDialogOptions &rhs) : d(rhs.d)
+{
+}
+
+QFileDialogOptions &QFileDialogOptions::operator=(const QFileDialogOptions &rhs)
+{
+ if (this != &rhs)
+ d = rhs.d;
+ return *this;
+}
+
+QFileDialogOptions::~QFileDialogOptions()
+{
+}
+
+QString QFileDialogOptions::windowTitle() const
+{
+ return d->windowTitle;
+}
+
+void QFileDialogOptions::setWindowTitle(const QString &title)
+{
+ d->windowTitle = title;
+}
+
+void QFileDialogOptions::setOption(QFileDialogOptions::FileDialogOption option, bool on)
+{
+ if (!(d->options & option) != !on)
+ setOptions(d->options ^ option);
+}
+
+bool QFileDialogOptions::testOption(QFileDialogOptions::FileDialogOption option) const
+{
+ return d->options & option;
+}
+
+void QFileDialogOptions::setOptions(FileDialogOptions options)
+{
+ if (options != d->options)
+ d->options = options;
+}
+
+QFileDialogOptions::FileDialogOptions QFileDialogOptions::options() const
+{
+ return d->options;
+}
+
+QDir::Filters QFileDialogOptions::filter() const
+{
+ return d->filters;
+}
+
+void QFileDialogOptions::setFilter(QDir::Filters filters)
+{
+ d->filters = filters;
+}
+
+void QFileDialogOptions::setViewMode(QFileDialogOptions::ViewMode mode)
+{
+ d->viewMode = mode;
+}
+
+QFileDialogOptions::ViewMode QFileDialogOptions::viewMode() const
+{
+ return d->viewMode;
+}
+
+void QFileDialogOptions::setFileMode(QFileDialogOptions::FileMode mode)
+{
+ d->fileMode = mode;
+}
+
+QFileDialogOptions::FileMode QFileDialogOptions::fileMode() const
+{
+ return d->fileMode;
+}
+
+void QFileDialogOptions::setAcceptMode(QFileDialogOptions::AcceptMode mode)
+{
+ d->acceptMode = mode;
+}
+
+QFileDialogOptions::AcceptMode QFileDialogOptions::acceptMode() const
+{
+ return d->acceptMode;
+}
+
+void QFileDialogOptions::setSidebarUrls(const QList<QUrl> &urls)
+{
+ d->sidebarUrls = urls;
+}
+
+QList<QUrl> QFileDialogOptions::sidebarUrls() const
+{
+ return d->sidebarUrls;
+}
+
+void QFileDialogOptions::setNameFilters(const QStringList &filters)
+{
+ d->nameFilters = filters;
+}
+
+QStringList QFileDialogOptions::nameFilters() const
+{
+ return d->nameFilters;
+}
+
+void QFileDialogOptions::setDefaultSuffix(const QString &suffix)
+{
+ d->defaultSuffix = suffix;
+}
+
+QString QFileDialogOptions::defaultSuffix() const
+{
+ return d->defaultSuffix;
+}
+
+void QFileDialogOptions::setHistory(const QStringList &paths)
+{
+ d->history = paths;
+}
+
+QStringList QFileDialogOptions::history() const
+{
+ return d->history;
+}
+
+void QFileDialogOptions::setLabelText(QFileDialogOptions::DialogLabel label, const QString &text)
+{
+ if (label >= 0 && label < DialogLabelCount)
+ d->labels[label] = text;
+}
+
+QString QFileDialogOptions::labelText(QFileDialogOptions::DialogLabel label) const
+{
+ return (label >= 0 && label < DialogLabelCount) ? d->labels[label] : QString();
+}
+
+bool QFileDialogOptions::isLabelExplicitlySet(DialogLabel label)
+{
+ return label >= 0 && label < DialogLabelCount && !d->labels[label].isEmpty();
+}
+
+QString QFileDialogOptions::initialDirectory() const
+{
+ return d->initialDirectory;
+}
+
+void QFileDialogOptions::setInitialDirectory(const QString &directory)
+{
+ d->initialDirectory = directory;
+}
+
+QString QFileDialogOptions::initiallySelectedNameFilter() const
+{
+ return d->initiallySelectedNameFilter;
+}
+
+void QFileDialogOptions::setInitiallySelectedNameFilter(const QString &filter)
+{
+ d->initiallySelectedNameFilter = filter;
+}
+
+QStringList QFileDialogOptions::initiallySelectedFiles() const
+{
+ return d->initiallySelectedFiles;
+}
+
+void QFileDialogOptions::setInitiallySelectedFiles(const QStringList &files)
+{
+ d->initiallySelectedFiles = files;
+}
+
+const QSharedPointer<QFileDialogOptions> &QPlatformFileDialogHelper::options() const
+{
+ return m_options;
+}
+
+void QPlatformFileDialogHelper::setOptions(const QSharedPointer<QFileDialogOptions> &options)
+{
+ m_options = options;
+}
+
QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qplatformdialoghelper_qpa.h b/src/widgets/kernel/qplatformdialoghelper_qpa.h
index 970de611bc..b0b8b3a5b3 100644
--- a/src/widgets/kernel/qplatformdialoghelper_qpa.h
+++ b/src/widgets/kernel/qplatformdialoghelper_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
- ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,8 +42,13 @@
#ifndef QPLATFORMDIALOGHELPER_H
#define QPLATFORMDIALOGHELPER_H
-#include <qglobal.h>
-#include <qobject.h>
+#include <QtCore/QtGlobal>
+#include <QtCore/QObject>
+#include <QtCore/QList>
+#include <QtCore/QSharedDataPointer>
+#include <QtCore/QSharedPointer>
+#include <QtCore/QDir>
+#include <QtGui/QRgb>
QT_BEGIN_HEADER
@@ -56,6 +61,10 @@ class QColor;
class QFont;
class QWindow;
class QVariant;
+class QUrl;
+class QColorDialogOptionsPrivate;
+class QFontDialogOptionsPrivate;
+class QFileDialogOptionsPrivate;
class Q_WIDGETS_EXPORT QPlatformDialogHelper : public QObject
{
@@ -65,6 +74,11 @@ public:
SnapToDefaultButton
};
enum DialogCode { Rejected, Accepted };
+ enum ShowFlag {
+ ShowModal = 0x00000001
+ };
+
+ Q_DECLARE_FLAGS(ShowFlags, ShowFlag)
QPlatformDialogHelper();
virtual ~QPlatformDialogHelper();
@@ -75,24 +89,104 @@ public:
virtual void _q_platformRunNativeAppModalPanel() = 0;
virtual void deleteNativeDialog_sys() = 0;
- virtual bool show_sys(QWindow *parent) = 0;
+ virtual bool show_sys(ShowFlags showFlags,
+ Qt::WindowFlags windowFlags,
+ QWindow *parent) = 0;
virtual void hide_sys() = 0;
virtual DialogCode dialogResultCode_sys() = 0;
static QVariant defaultStyleHint(QPlatformDialogHelper::StyleHint hint);
+
+Q_SIGNALS:
+ void launchNativeAppModalPanel();
+ void accept();
+ void reject();
+
+protected Q_SLOTS:
+ void emitLaunchNativeAppModalPanel();
+};
+
+class Q_WIDGETS_EXPORT QColorDialogOptions
+{
+public:
+ enum ColorDialogOption {
+ ShowAlphaChannel = 0x00000001,
+ NoButtons = 0x00000002,
+ DontUseNativeDialog = 0x00000004
+ };
+
+ Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption)
+
+ QColorDialogOptions();
+ QColorDialogOptions(const QColorDialogOptions &rhs);
+ QColorDialogOptions &operator=(const QColorDialogOptions &rhs);
+ ~QColorDialogOptions();
+
+ QString windowTitle() const;
+ void setWindowTitle(const QString &);
+
+ void setOption(ColorDialogOption option, bool on = true);
+ bool testOption(ColorDialogOption option) const;
+ void setOptions(ColorDialogOptions options);
+ ColorDialogOptions options() const;
+
+ static int customColorCount();
+ static QRgb customColor(int index);
+ static QRgb *customColors();
+ static void setCustomColor(int index, QRgb color);
+
+ static QRgb *standardColors();
+ static QRgb standardColor(int index);
+ static void setStandardColor(int index, QRgb color);
+
+private:
+ QSharedDataPointer<QColorDialogOptionsPrivate> d;
};
class Q_WIDGETS_EXPORT QPlatformColorDialogHelper : public QPlatformDialogHelper
{
Q_OBJECT
public:
+ const QSharedPointer<QColorDialogOptions> &options() const;
+ void setOptions(const QSharedPointer<QColorDialogOptions> &options);
+
virtual void setCurrentColor_sys(const QColor &) = 0;
virtual QColor currentColor_sys() const = 0;
Q_SIGNALS:
void currentColorChanged(const QColor &color);
void colorSelected(const QColor &color);
+
+private:
+ QSharedPointer<QColorDialogOptions> m_options;
+};
+
+class Q_WIDGETS_EXPORT QFontDialogOptions
+{
+public:
+ enum FontDialogOption {
+ NoButtons = 0x00000001,
+ DontUseNativeDialog = 0x00000002
+ };
+
+ Q_DECLARE_FLAGS(FontDialogOptions, FontDialogOption)
+
+ QFontDialogOptions();
+ QFontDialogOptions(const QFontDialogOptions &rhs);
+ QFontDialogOptions &operator=(const QFontDialogOptions &rhs);
+ ~QFontDialogOptions();
+
+ QString windowTitle() const;
+ void setWindowTitle(const QString &);
+
+ void setOption(FontDialogOption option, bool on = true);
+ bool testOption(FontDialogOption option) const;
+ void setOptions(FontDialogOptions options);
+ FontDialogOptions options() const;
+
+private:
+ QSharedDataPointer<QFontDialogOptionsPrivate> d;
};
class Q_WIDGETS_EXPORT QPlatformFontDialogHelper : public QPlatformDialogHelper
@@ -102,9 +196,89 @@ public:
virtual void setCurrentFont_sys(const QFont &) = 0;
virtual QFont currentFont_sys() const = 0;
+ const QSharedPointer<QFontDialogOptions> &options() const;
+ void setOptions(const QSharedPointer<QFontDialogOptions> &options);
+
Q_SIGNALS:
void currentFontChanged(const QFont &font);
void fontSelected(const QFont &font);
+
+private:
+ QSharedPointer<QFontDialogOptions> m_options;
+};
+
+class Q_WIDGETS_EXPORT QFileDialogOptions
+{
+public:
+ enum ViewMode { Detail, List };
+ enum FileMode { AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly };
+ enum AcceptMode { AcceptOpen, AcceptSave };
+ enum DialogLabel { LookIn, FileName, FileType, Accept, Reject, DialogLabelCount };
+
+ enum FileDialogOption
+ {
+ ShowDirsOnly = 0x00000001,
+ DontResolveSymlinks = 0x00000002,
+ DontConfirmOverwrite = 0x00000004,
+ DontUseSheet = 0x00000008,
+ DontUseNativeDialog = 0x00000010,
+ ReadOnly = 0x00000020,
+ HideNameFilterDetails = 0x00000040
+ };
+ Q_DECLARE_FLAGS(FileDialogOptions, FileDialogOption)
+
+ QFileDialogOptions();
+ QFileDialogOptions(const QFileDialogOptions &rhs);
+ QFileDialogOptions &operator=(const QFileDialogOptions &rhs);
+ ~QFileDialogOptions();
+
+ QString windowTitle() const;
+ void setWindowTitle(const QString &);
+
+ void setOption(FileDialogOption option, bool on = true);
+ bool testOption(FileDialogOption option) const;
+ void setOptions(FileDialogOptions options);
+ FileDialogOptions options() const;
+
+ QDir::Filters filter() const;
+ void setFilter(QDir::Filters filters);
+
+ void setViewMode(ViewMode mode);
+ ViewMode viewMode() const;
+
+ void setFileMode(FileMode mode);
+ FileMode fileMode() const;
+
+ void setAcceptMode(AcceptMode mode);
+ AcceptMode acceptMode() const;
+
+ void setSidebarUrls(const QList<QUrl> &urls);
+ QList<QUrl> sidebarUrls() const;
+
+ void setNameFilters(const QStringList &filters);
+ QStringList nameFilters() const;
+
+ void setDefaultSuffix(const QString &suffix);
+ QString defaultSuffix() const;
+
+ void setHistory(const QStringList &paths);
+ QStringList history() const;
+
+ void setLabelText(DialogLabel label, const QString &text);
+ QString labelText(DialogLabel label) const;
+ bool isLabelExplicitlySet(DialogLabel label);
+
+ QString initialDirectory() const;
+ void setInitialDirectory(const QString &);
+
+ QString initiallySelectedNameFilter() const;
+ void setInitiallySelectedNameFilter(const QString &);
+
+ QStringList initiallySelectedFiles() const;
+ void setInitiallySelectedFiles(const QStringList &);
+
+private:
+ QSharedDataPointer<QFileDialogOptionsPrivate> d;
};
class Q_WIDGETS_EXPORT QPlatformFileDialogHelper : public QPlatformDialogHelper
@@ -117,16 +291,21 @@ public:
virtual void selectFile_sys(const QString &filename) = 0;
virtual QStringList selectedFiles_sys() const = 0;
virtual void setFilter_sys() = 0;
- virtual void setNameFilters_sys(const QStringList &filters) = 0;
virtual void selectNameFilter_sys(const QString &filter) = 0;
virtual QString selectedNameFilter_sys() const = 0;
+ const QSharedPointer<QFileDialogOptions> &options() const;
+ void setOptions(const QSharedPointer<QFileDialogOptions> &options);
+
Q_SIGNALS:
void fileSelected(const QString &file);
void filesSelected(const QStringList &files);
void currentChanged(const QString &path);
void directoryEntered(const QString &directory);
void filterSelected(const QString &filter);
+
+private:
+ QSharedPointer<QFileDialogOptions> m_options;
};
QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qplatformmenu_qpa.cpp b/src/widgets/kernel/qplatformmenu_qpa.cpp
index fd5cc78bf0..2a11884a67 100644
--- a/src/widgets/kernel/qplatformmenu_qpa.cpp
+++ b/src/widgets/kernel/qplatformmenu_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qplatformmenu_qpa.h b/src/widgets/kernel/qplatformmenu_qpa.h
index d2736ed354..b6473c0b15 100644
--- a/src/widgets/kernel/qplatformmenu_qpa.h
+++ b/src/widgets/kernel/qplatformmenu_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
- ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index 94f809d199..cb2d08956b 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -521,9 +521,9 @@ void QShortcut::setContext(Qt::ShortcutContext context)
d->redoGrab(qApp->d_func()->shortcutMap);
}
-Qt::ShortcutContext QShortcut::context()
+Qt::ShortcutContext QShortcut::context() const
{
- Q_D(QShortcut);
+ Q_D(const QShortcut);
return d->sc_context;
}
diff --git a/src/widgets/kernel/qshortcut.h b/src/widgets/kernel/qshortcut.h
index 6e3c647852..077028ccd3 100644
--- a/src/widgets/kernel/qshortcut.h
+++ b/src/widgets/kernel/qshortcut.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -77,7 +77,7 @@ public:
bool isEnabled() const;
void setContext(Qt::ShortcutContext context);
- Qt::ShortcutContext context();
+ Qt::ShortcutContext context() const;
void setWhatsThis(const QString &text);
QString whatsThis() const;
diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h
index 826991ceb3..8932eb8ed8 100644
--- a/src/widgets/kernel/qsizepolicy.h
+++ b/src/widgets/kernel/qsizepolicy.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -181,6 +181,10 @@ Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &);
Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &);
#endif
+#ifndef QT_NO_DEBUG_STREAM
+Q_WIDGETS_EXPORT QDebug operator<<(QDebug dbg, const QSizePolicy &);
+#endif
+
inline void QSizePolicy::transpose() {
Policy hData = horizontalPolicy();
Policy vData = verticalPolicy();
diff --git a/src/widgets/kernel/qsizepolicy.qdoc b/src/widgets/kernel/qsizepolicy.qdoc
index e4d1cc137c..a0e565caff 100644
--- a/src/widgets/kernel/qsizepolicy.qdoc
+++ b/src/widgets/kernel/qsizepolicy.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qsoftkeymanager.cpp b/src/widgets/kernel/qsoftkeymanager.cpp
index 7d7c56fe84..a7c128337f 100644
--- a/src/widgets/kernel/qsoftkeymanager.cpp
+++ b/src/widgets/kernel/qsoftkeymanager.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qsoftkeymanager_common_p.h b/src/widgets/kernel/qsoftkeymanager_common_p.h
index fc484dc3c6..121d4f8e22 100644
--- a/src/widgets/kernel/qsoftkeymanager_common_p.h
+++ b/src/widgets/kernel/qsoftkeymanager_common_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qsoftkeymanager_p.h b/src/widgets/kernel/qsoftkeymanager_p.h
index d58b546d74..ad49a1b586 100644
--- a/src/widgets/kernel/qsoftkeymanager_p.h
+++ b/src/widgets/kernel/qsoftkeymanager_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp
index 950db2178c..7179ddc62c 100644
--- a/src/widgets/kernel/qstackedlayout.cpp
+++ b/src/widgets/kernel/qstackedlayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qstackedlayout.h b/src/widgets/kernel/qstackedlayout.h
index d895d139ab..e80e909eae 100644
--- a/src/widgets/kernel/qstackedlayout.h
+++ b/src/widgets/kernel/qstackedlayout.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qstandardgestures.cpp b/src/widgets/kernel/qstandardgestures.cpp
index a557342023..3a9bd2bc38 100644
--- a/src/widgets/kernel/qstandardgestures.cpp
+++ b/src/widgets/kernel/qstandardgestures.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qstandardgestures_p.h b/src/widgets/kernel/qstandardgestures_p.h
index be30d70058..28b0b71797 100644
--- a/src/widgets/kernel/qstandardgestures_p.h
+++ b/src/widgets/kernel/qstandardgestures_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qt_widgets_pch.h b/src/widgets/kernel/qt_widgets_pch.h
index 012d92ce8c..8e8985d21f 100644
--- a/src/widgets/kernel/qt_widgets_pch.h
+++ b/src/widgets/kernel/qt_widgets_pch.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index fb1b67922d..fc0efc3dc2 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qtooltip.h b/src/widgets/kernel/qtooltip.h
index 3d537f40af..8218a18338 100644
--- a/src/widgets/kernel/qtooltip.h
+++ b/src/widgets/kernel/qtooltip.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp
index 7a53dc3415..e1a1cd05ef 100644
--- a/src/widgets/kernel/qwhatsthis.cpp
+++ b/src/widgets/kernel/qwhatsthis.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -43,6 +43,7 @@
#ifndef QT_NO_WHATSTHIS
#include "qpointer.h"
#include "qapplication.h"
+#include <private/qguiapplication_p.h>
#include "qdesktopwidget.h"
#include "qevent.h"
#include "qpixmap.h"
@@ -59,12 +60,6 @@
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif
-#if defined(Q_WS_WIN)
-#include "qt_windows.h"
-#ifndef SPI_GETDROPSHADOW
-#define SPI_GETDROPSHADOW 0x1024
-#endif
-#endif
QT_BEGIN_NAMESPACE
@@ -221,15 +216,9 @@ QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor
+ Qt::TextWordWrap + Qt::TextExpandTabs,
text);
}
-#if defined(Q_WS_WIN)
- if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
- {
- BOOL shadow;
- SystemParametersInfo(SPI_GETDROPSHADOW, 0, &shadow, 0);
- shadowWidth = shadow ? 0 : 6;
- }
-#endif
+ shadowWidth =
+ QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::DropShadow).toBool() ?
+ 0 : 6;
resize(r.width() + 2*hMargin + shadowWidth, r.height() + 2*vMargin + shadowWidth);
}
diff --git a/src/widgets/kernel/qwhatsthis.h b/src/widgets/kernel/qwhatsthis.h
index 9ef96e7197..93e97ddff8 100644
--- a/src/widgets/kernel/qwhatsthis.h
+++ b/src/widgets/kernel/qwhatsthis.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 7ec37bb929..531a217b1d 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1469,10 +1469,6 @@ QWidget::~QWidget()
delete d->needsFlush;
d->needsFlush = 0;
- // set all QPointers for this object to zero
- if (d->hasGuards)
- QObjectPrivate::clearGuards(this);
-
if (d->declarativeData) {
QAbstractDeclarativeData::destroyed(d->declarativeData, this);
d->declarativeData = 0; // don't activate again in ~QObject
@@ -6559,6 +6555,9 @@ QByteArray QWidget::saveGeometry() const
#ifdef Q_WS_MAC
<< newFramePosition
<< newNormalPosition
+#else
+ << frameGeometry()
+ << normalGeometry()
#endif // Q_WS_MAC
<< qint32(QApplication::desktop()->screenNumber(this))
<< quint8(windowState() & Qt::WindowMaximized)
@@ -8188,26 +8187,6 @@ bool QWidget::event(QEvent *event)
event->ignore();
break;
#endif
-#ifndef QT_NO_ACCESSIBILITY
- case QEvent::AccessibilityDescription:
- case QEvent::AccessibilityHelp: {
- QAccessibleEvent *ev = static_cast<QAccessibleEvent *>(event);
- switch (ev->type()) {
-#ifndef QT_NO_TOOLTIP
- case QEvent::AccessibilityDescription:
- ev->setValue(d->toolTip);
- break;
-#endif
-#ifndef QT_NO_WHATSTHIS
- case QEvent::AccessibilityHelp:
- ev->setValue(d->whatsThis);
- break;
-#endif
- default:
- return false;
- }
- break; }
-#endif
case QEvent::EmbeddingControl:
d->topData()->frameStrut.setCoords(0 ,0, 0, 0);
data->fstrut_dirty = false;
@@ -8248,40 +8227,7 @@ bool QWidget::event(QEvent *event)
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
{
-#ifndef Q_WS_MAC
- QTouchEvent *touchEvent = static_cast<QTouchEvent *>(event);
- const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().first();
- if (touchPoint.isPrimary() || touchEvent->device()->type() == QTouchDevice::TouchPad)
- break;
-
- // fake a mouse event!
- QEvent::Type eventType = QEvent::None;
- switch (touchEvent->type()) {
- case QEvent::TouchBegin:
- eventType = QEvent::MouseButtonPress;
- break;
- case QEvent::TouchUpdate:
- eventType = QEvent::MouseMove;
- break;
- case QEvent::TouchEnd:
- eventType = QEvent::MouseButtonRelease;
- break;
- default:
- Q_ASSERT(!true);
- break;
- }
- if (eventType == QEvent::None)
- break;
-
- QMouseEvent mouseEvent(eventType,
- touchPoint.pos(),
- touchPoint.scenePos(),
- touchPoint.screenPos(),
- Qt::LeftButton,
- Qt::LeftButton,
- touchEvent->modifiers());
- (void) QApplication::sendEvent(this, &mouseEvent);
-#endif // Q_WS_MAC
+ event->ignore();
break;
}
#ifndef QT_NO_GESTURES
@@ -10317,45 +10263,6 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
d->registerTouchWindow();
#endif
break;
- case Qt::WA_LockPortraitOrientation:
- case Qt::WA_LockLandscapeOrientation:
- case Qt::WA_AutoOrientation: {
- const Qt::WidgetAttribute orientations[3] = {
- Qt::WA_LockPortraitOrientation,
- Qt::WA_LockLandscapeOrientation,
- Qt::WA_AutoOrientation
- };
-
- if (on) {
- // We can only have one of these set at a time
- for (int i = 0; i < 3; ++i) {
- if (orientations[i] != attribute)
- setAttribute_internal(orientations[i], false, data, d);
- }
- }
-
-#ifdef Q_WS_S60
- CAknAppUiBase* appUi = static_cast<CAknAppUiBase*>(CEikonEnv::Static()->EikAppUi());
- const CAknAppUiBase::TAppUiOrientation s60orientations[] = {
- CAknAppUiBase::EAppUiOrientationPortrait,
- CAknAppUiBase::EAppUiOrientationLandscape,
- CAknAppUiBase::EAppUiOrientationAutomatic
- };
- CAknAppUiBase::TAppUiOrientation s60orientation = CAknAppUiBase::EAppUiOrientationUnspecified;
- for (int i = 0; i < 3; ++i) {
- if (testAttribute(orientations[i])) {
- s60orientation = s60orientations[i];
- break;
- }
- }
- QT_TRAP_THROWING(appUi->SetOrientationL(s60orientation));
- S60->orientationSet = true;
- QSymbianControl *window = static_cast<QSymbianControl *>(internalWinId());
- if (window)
- window->ensureFixNativeOrientation();
-#endif
- break;
- }
default:
break;
}
@@ -10834,337 +10741,6 @@ void QWidget::stackUnder(QWidget* w)
QApplication::sendEvent(this, &e);
}
-/*!
- \enum QWidget::BackgroundOrigin
-
- \compat
-
- \value WidgetOrigin
- \value ParentOrigin
- \value WindowOrigin
- \value AncestorOrigin
-
-*/
-
-/*!
- \fn bool QWidget::isVisibleToTLW() const
-
- Use isVisible() instead.
-*/
-
-/*!
- \fn void QWidget::iconify()
-
- Use showMinimized() instead.
-*/
-
-/*!
- \fn void QWidget::constPolish() const
-
- Use ensurePolished() instead.
-*/
-
-/*!
- \fn void QWidget::reparent(QWidget *parent, Qt::WindowFlags f, const QPoint &p, bool showIt)
-
- Use setParent() to change the parent or the widget's widget flags;
- use move() to move the widget, and use show() to show the widget.
-*/
-
-/*!
- \fn void QWidget::reparent(QWidget *parent, const QPoint &p, bool showIt)
-
- Use setParent() to change the parent; use move() to move the
- widget, and use show() to show the widget.
-*/
-
-/*!
- \fn void QWidget::recreate(QWidget *parent, Qt::WindowFlags f, const QPoint & p, bool showIt)
-
- Use setParent() to change the parent or the widget's widget flags;
- use move() to move the widget, and use show() to show the widget.
-*/
-
-/*!
- \fn bool QWidget::hasMouse() const
-
- Use testAttribute(Qt::WA_UnderMouse) instead.
-*/
-
-/*!
- \fn bool QWidget::ownCursor() const
-
- Use testAttribute(Qt::WA_SetCursor) instead.
-*/
-
-/*!
- \fn bool QWidget::ownFont() const
-
- Use testAttribute(Qt::WA_SetFont) instead.
-*/
-
-/*!
- \fn void QWidget::unsetFont()
-
- Use setFont(QFont()) instead.
-*/
-
-/*!
- \fn bool QWidget::ownPalette() const
-
- Use testAttribute(Qt::WA_SetPalette) instead.
-*/
-
-/*!
- \fn void QWidget::unsetPalette()
-
- Use setPalette(QPalette()) instead.
-*/
-
-/*!
- \fn void QWidget::setEraseColor(const QColor &color)
-
- Use the palette instead.
-
- \oldcode
- widget->setEraseColor(color);
- \newcode
- QPalette palette;
- palette.setColor(widget->backgroundRole(), color);
- widget->setPalette(palette);
- \endcode
-*/
-
-/*!
- \fn void QWidget::setErasePixmap(const QPixmap &pixmap)
-
- Use the palette instead.
-
- \oldcode
- widget->setErasePixmap(pixmap);
- \newcode
- QPalette palette;
- palette.setBrush(widget->backgroundRole(), QBrush(pixmap));
- widget->setPalette(palette);
- \endcode
-*/
-
-/*!
- \fn void QWidget::setPaletteForegroundColor(const QColor &color)
-
- Use the palette directly.
-
- \oldcode
- widget->setPaletteForegroundColor(color);
- \newcode
- QPalette palette;
- palette.setColor(widget->foregroundRole(), color);
- widget->setPalette(palette);
- \endcode
-*/
-
-/*!
- \fn void QWidget::setPaletteBackgroundColor(const QColor &color)
-
- Use the palette directly.
-
- \oldcode
- widget->setPaletteBackgroundColor(color);
- \newcode
- QPalette palette;
- palette.setColor(widget->backgroundRole(), color);
- widget->setPalette(palette);
- \endcode
-*/
-
-/*!
- \fn void QWidget::setPaletteBackgroundPixmap(const QPixmap &pixmap)
-
- Use the palette directly.
-
- \oldcode
- widget->setPaletteBackgroundPixmap(pixmap);
- \newcode
- QPalette palette;
- palette.setBrush(widget->backgroundRole(), QBrush(pixmap));
- widget->setPalette(palette);
- \endcode
-*/
-
-/*!
- \fn void QWidget::setBackgroundPixmap(const QPixmap &pixmap)
-
- Use the palette instead.
-
- \oldcode
- widget->setBackgroundPixmap(pixmap);
- \newcode
- QPalette palette;
- palette.setBrush(widget->backgroundRole(), QBrush(pixmap));
- widget->setPalette(palette);
- \endcode
-*/
-
-/*!
- \fn void QWidget::setBackgroundColor(const QColor &color)
-
- Use the palette instead.
-
- \oldcode
- widget->setBackgroundColor(color);
- \newcode
- QPalette palette;
- palette.setColor(widget->backgroundRole(), color);
- widget->setPalette(palette);
- \endcode
-*/
-
-
-/*!
- \fn QWidget *QWidget::parentWidget(bool sameWindow) const
-
- Use the no-argument overload instead.
-*/
-
-/*!
- \fn void QWidget::setKeyCompression(bool b)
-
- Use setAttribute(Qt::WA_KeyCompression, b) instead.
-*/
-
-/*!
- \fn void QWidget::setFont(const QFont &f, bool b)
-
- Use the single-argument overload instead.
-*/
-
-/*!
- \fn void QWidget::setPalette(const QPalette &p, bool b)
-
- Use the single-argument overload instead.
-*/
-
-/*!
- \fn void QWidget::setBackgroundOrigin(BackgroundOrigin background)
-
- \obsolete
-*/
-
-/*!
- \fn BackgroundOrigin QWidget::backgroundOrigin() const
-
- \obsolete
-
- Always returns \c WindowOrigin.
-*/
-
-/*!
- \fn QPoint QWidget::backgroundOffset() const
-
- \obsolete
-
- Always returns QPoint().
-*/
-
-/*!
- \fn void QWidget::repaint(bool b)
-
- The boolean parameter \a b is ignored. Use the no-argument overload instead.
-*/
-
-/*!
- \fn void QWidget::repaint(int x, int y, int w, int h, bool b)
-
- The boolean parameter \a b is ignored. Use the four-argument overload instead.
-*/
-
-/*!
- \fn void QWidget::repaint(const QRect &r, bool b)
-
- The boolean parameter \a b is ignored. Use the single rect-argument overload instead.
-*/
-
-/*!
- \fn void QWidget::repaint(const QRegion &rgn, bool b)
-
- The boolean parameter \a b is ignored. Use the single region-argument overload instead.
-*/
-
-/*!
- \fn void QWidget::erase()
-
- Drawing may only take place in a QPaintEvent. Overload
- paintEvent() to do your erasing and call update() to schedule a
- replaint whenever necessary. See also QPainter.
-*/
-
-/*!
- \fn void QWidget::erase(int x, int y, int w, int h)
-
- Drawing may only take place in a QPaintEvent. Overload
- paintEvent() to do your erasing and call update() to schedule a
- replaint whenever necessary. See also QPainter.
-*/
-
-/*!
- \fn void QWidget::erase(const QRect &rect)
-
- Drawing may only take place in a QPaintEvent. Overload
- paintEvent() to do your erasing and call update() to schedule a
- replaint whenever necessary. See also QPainter.
-*/
-
-/*!
- \fn void QWidget::drawText(const QPoint &p, const QString &s)
-
- Drawing may only take place in a QPaintEvent. Overload
- paintEvent() to do your drawing and call update() to schedule a
- replaint whenever necessary. See also QPainter.
-*/
-
-/*!
- \fn void QWidget::drawText(int x, int y, const QString &s)
-
- Drawing may only take place in a QPaintEvent. Overload
- paintEvent() to do your drawing and call update() to schedule a
- replaint whenever necessary. See also QPainter.
-*/
-
-/*!
- \fn QWidget *QWidget::childAt(const QPoint &p, bool includeThis) const
-
- Use the single point argument overload instead.
-*/
-
-/*!
- \fn void QWidget::setCaption(const QString &c)
-
- Use setWindowTitle() instead.
-*/
-
-/*!
- \fn void QWidget::setIcon(const QPixmap &i)
-
- Use setWindowIcon() instead.
-*/
-
-/*!
- \fn void QWidget::setIconText(const QString &it)
-
- Use setWindowIconText() instead.
-*/
-
-/*!
- \fn QString QWidget::caption() const
-
- Use windowTitle() instead.
-*/
-
-/*!
- \fn QString QWidget::iconText() const
-
- Use windowIconText() instead.
-*/
/*!
\fn bool QWidget::isTopLevel() const
@@ -11184,84 +10760,6 @@ void QWidget::stackUnder(QWidget* w)
*/
/*!
- \fn void QWidget::setInputMethodEnabled(bool enabled)
-
- Use setAttribute(Qt::WA_InputMethodEnabled, \a enabled) instead.
-*/
-
-/*!
- \fn bool QWidget::isInputMethodEnabled() const
-
- Use testAttribute(Qt::WA_InputMethodEnabled) instead.
-*/
-
-/*!
- \fn void QWidget::setActiveWindow()
-
- Use activateWindow() instead.
-*/
-
-/*!
- \fn bool QWidget::isShown() const
-
- Use !isHidden() instead (notice the exclamation mark), or use isVisible() to check whether the widget is visible.
-*/
-
-/*!
- \fn bool QWidget::isDialog() const
-
- Use windowType() == Qt::Dialog instead.
-*/
-
-/*!
- \fn bool QWidget::isPopup() const
-
- Use windowType() == Qt::Popup instead.
-*/
-
-/*!
- \fn bool QWidget::isDesktop() const
-
- Use windowType() == Qt::Desktop instead.
-*/
-
-/*!
- \fn void QWidget::polish()
-
- Use ensurePolished() instead.
-*/
-
-/*!
- \fn QWidget *QWidget::childAt(int x, int y, bool includeThis) const
-
- Use the childAt() overload that doesn't have an \a includeThis parameter.
-
- \oldcode
- return widget->childAt(x, y, true);
- \newcode
- QWidget *child = widget->childAt(x, y, true);
- if (child)
- return child;
- if (widget->rect().contains(x, y))
- return widget;
- \endcode
-*/
-
-/*!
- \fn void QWidget::setSizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver, bool hfw)
- \compat
-
- Use the \l sizePolicy property and heightForWidth() function instead.
-*/
-
-/*!
- \fn bool QWidget::isUpdatesEnabled() const
- \compat
-
- Use the \l updatesEnabled property instead.
-*/
-
-/*!
\macro QWIDGETSIZE_MAX
\relates QWidget
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index f97b343463..60d4b8b698 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -746,16 +746,8 @@ private:
#endif // QT_NO_GESTURES
friend class QWidgetEffectSourcePrivate;
-#ifdef Q_WS_MAC
- friend class QCoreGraphicsPaintEnginePrivate;
- friend QPoint qt_mac_posInWindow(const QWidget *w);
- friend OSWindowRef qt_mac_window_for(const QWidget *w);
+#ifdef Q_OS_MAC
friend bool qt_mac_is_metal(const QWidget *w);
- friend OSViewRef qt_mac_nativeview_for(const QWidget *w);
- friend void qt_event_request_window_change(QWidget *widget);
- friend bool qt_mac_sendMacEventToWidget(QWidget *widget, EventRef ref);
- friend class QRasterWindowSurface;
- friend class QUnifiedToolbarSurface;
#endif
friend Q_WIDGETS_EXPORT QWidgetData *qt_qwidget_data(QWidget *widget);
friend Q_WIDGETS_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget);
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index c890dfe70c..43c3eaeff0 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp
index f1e0835b8b..fb4543cd14 100644
--- a/src/widgets/kernel/qwidget_qpa.cpp
+++ b/src/widgets/kernel/qwidget_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qwidgetaction.cpp b/src/widgets/kernel/qwidgetaction.cpp
index a2c2477922..caab1c16e6 100644
--- a/src/widgets/kernel/qwidgetaction.cpp
+++ b/src/widgets/kernel/qwidgetaction.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qwidgetaction.h b/src/widgets/kernel/qwidgetaction.h
index 31d58a819a..62ef05596b 100644
--- a/src/widgets/kernel/qwidgetaction.h
+++ b/src/widgets/kernel/qwidgetaction.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qwidgetaction_p.h b/src/widgets/kernel/qwidgetaction_p.h
index 99439d9919..ff8a37425c 100644
--- a/src/widgets/kernel/qwidgetaction_p.h
+++ b/src/widgets/kernel/qwidgetaction_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index d151d5e9e1..0eb9407925 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h
index 4d43a90322..2d28cae88e 100644
--- a/src/widgets/kernel/qwidgetbackingstore_p.h
+++ b/src/widgets/kernel/qwidgetbackingstore_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp
index 18fec508ea..f2ca99d040 100644
--- a/src/widgets/kernel/qwidgetsvariant.cpp
+++ b/src/widgets/kernel/qwidgetsvariant.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -49,7 +49,7 @@
QT_BEGIN_NAMESPACE
-
+namespace {
static void construct(QVariant::Private *x, const void *copy)
{
switch (x->type) {
@@ -97,10 +97,8 @@ static bool isNull(const QVariant::Private *d)
case QVariant::Icon:
return v_cast<QIcon>(d)->isNull();
#endif
- default:
- Q_ASSERT(false);
}
- return true;
+ return false;
}
static bool compare(const QVariant::Private *a, const QVariant::Private *b)
@@ -119,6 +117,34 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b)
return false;
}
+static bool convert(const QVariant::Private *d, QVariant::Type type, void *result, bool *ok)
+{
+ Q_UNUSED(d);
+ Q_UNUSED(type);
+ Q_UNUSED(result);
+ if (ok)
+ *ok = false;
+ return false;
+}
+
+#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
+static void streamDebug(QDebug dbg, const QVariant &v)
+{
+ QVariant::Private *d = const_cast<QVariant::Private *>(&v.data_ptr());
+ switch (d->type) {
+#ifndef QT_NO_ICON
+ case QVariant::Icon:
+ dbg.nospace() << *v_cast<QIcon>(d);
+ break;
+#endif
+ case QVariant::SizePolicy:
+ dbg.nospace() << *v_cast<QSizePolicy>(d);
+ break;
+ default:
+ dbg.nospace() << "QVariant::Type(" << d->type << ")";
+ }
+}
+#endif
static const QVariant::Handler widgets_handler = {
construct,
@@ -129,19 +155,17 @@ static const QVariant::Handler widgets_handler = {
0,
#endif
compare,
- 0,
+ convert,
0,
#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
- 0
+ streamDebug
#else
0
#endif
};
-extern Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeWidgetsHelper;
-
#define QT_IMPL_METATYPEINTERFACE_WIDGETS_TYPES(MetaTypeName, MetaTypeId, RealName) \
- QMetaTypeInterface(static_cast<RealName*>(0)),
+ QT_METATYPE_INTERFACE_INIT(RealName),
static const QMetaTypeInterface qVariantWidgetsHelper[] = {
QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_IMPL_METATYPEINTERFACE_WIDGETS_TYPES)
@@ -149,18 +173,20 @@ static const QMetaTypeInterface qVariantWidgetsHelper[] = {
#undef QT_IMPL_METATYPEINTERFACE_WIDGETS_TYPES
-extern Q_GUI_EXPORT const QVariant::Handler *qt_widgets_variant_handler;
+} // namespace
+
+extern Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeWidgetsHelper;
void qRegisterWidgetsVariant()
{
- qt_widgets_variant_handler = &widgets_handler;
qMetaTypeWidgetsHelper = qVariantWidgetsHelper;
+ QVariantPrivate::registerHandler(QModulesPrivate::Widgets, &widgets_handler);
}
Q_CONSTRUCTOR_FUNCTION(qRegisterWidgetsVariant)
void qUnregisterWidgetsVariant()
{
- qt_widgets_variant_handler = 0;
+ QVariantPrivate::unregisterHandler(QModulesPrivate::Widgets);
qMetaTypeWidgetsHelper = 0;
}
Q_DESTRUCTOR_FUNCTION(qUnregisterWidgetsVariant)
diff --git a/src/widgets/kernel/qwidgetwindow_qpa.cpp b/src/widgets/kernel/qwidgetwindow_qpa.cpp
index e3178db8c9..b89dca7357 100644
--- a/src/widgets/kernel/qwidgetwindow_qpa.cpp
+++ b/src/widgets/kernel/qwidgetwindow_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/kernel/qwidgetwindow_qpa_p.h b/src/widgets/kernel/qwidgetwindow_qpa_p.h
index 906b96c47b..82448ab5fd 100644
--- a/src/widgets/kernel/qwidgetwindow_qpa_p.h
+++ b/src/widgets/kernel/qwidgetwindow_qpa_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qapplication_mac.mm b/src/widgets/platforms/mac/qapplication_mac.mm
index cab207e667..13fb6fd624 100644
--- a/src/widgets/platforms/mac/qapplication_mac.mm
+++ b/src/widgets/platforms/mac/qapplication_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qclipboard_mac.cpp b/src/widgets/platforms/mac/qclipboard_mac.cpp
index b8a4d2915d..3ec4bfb8c1 100644
--- a/src/widgets/platforms/mac/qclipboard_mac.cpp
+++ b/src/widgets/platforms/mac/qclipboard_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qcocoaintrospection_mac.mm b/src/widgets/platforms/mac/qcocoaintrospection_mac.mm
index 7388f5a4e9..e68aacb4a0 100644
--- a/src/widgets/platforms/mac/qcocoaintrospection_mac.mm
+++ b/src/widgets/platforms/mac/qcocoaintrospection_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qcocoaintrospection_p.h b/src/widgets/platforms/mac/qcocoaintrospection_p.h
index e18646d063..9521957382 100644
--- a/src/widgets/platforms/mac/qcocoaintrospection_p.h
+++ b/src/widgets/platforms/mac/qcocoaintrospection_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qcocoapanel_mac.mm b/src/widgets/platforms/mac/qcocoapanel_mac.mm
index 2dca64d5ff..115f78b153 100644
--- a/src/widgets/platforms/mac/qcocoapanel_mac.mm
+++ b/src/widgets/platforms/mac/qcocoapanel_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qcocoapanel_mac_p.h b/src/widgets/platforms/mac/qcocoapanel_mac_p.h
index 43282be7c6..19eab92dbf 100644
--- a/src/widgets/platforms/mac/qcocoapanel_mac_p.h
+++ b/src/widgets/platforms/mac/qcocoapanel_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qcocoasharedwindowmethods_mac_p.h b/src/widgets/platforms/mac/qcocoasharedwindowmethods_mac_p.h
index f5a93d98d2..edafcfccdf 100644
--- a/src/widgets/platforms/mac/qcocoasharedwindowmethods_mac_p.h
+++ b/src/widgets/platforms/mac/qcocoasharedwindowmethods_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qcocoaview_mac.mm b/src/widgets/platforms/mac/qcocoaview_mac.mm
index 61a5ee10ff..f4b2b8d707 100644
--- a/src/widgets/platforms/mac/qcocoaview_mac.mm
+++ b/src/widgets/platforms/mac/qcocoaview_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qcocoaview_mac_p.h b/src/widgets/platforms/mac/qcocoaview_mac_p.h
index 928e489abe..e534e7ab47 100644
--- a/src/widgets/platforms/mac/qcocoaview_mac_p.h
+++ b/src/widgets/platforms/mac/qcocoaview_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qcocoawindow_mac.mm b/src/widgets/platforms/mac/qcocoawindow_mac.mm
index 730504f672..918e5a0a13 100644
--- a/src/widgets/platforms/mac/qcocoawindow_mac.mm
+++ b/src/widgets/platforms/mac/qcocoawindow_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qcocoawindow_mac_p.h b/src/widgets/platforms/mac/qcocoawindow_mac_p.h
index 704e6bd01c..83ecb7c13e 100644
--- a/src/widgets/platforms/mac/qcocoawindow_mac_p.h
+++ b/src/widgets/platforms/mac/qcocoawindow_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac.mm b/src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac.mm
index 9e3b4cfee7..f1b38148be 100644
--- a/src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac.mm
+++ b/src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac_p.h b/src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac_p.h
index 7ac8a28539..cd497849a7 100644
--- a/src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac_p.h
+++ b/src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qcocoawindowdelegate_mac.mm b/src/widgets/platforms/mac/qcocoawindowdelegate_mac.mm
index 44fb9b6eba..fc89821f41 100644
--- a/src/widgets/platforms/mac/qcocoawindowdelegate_mac.mm
+++ b/src/widgets/platforms/mac/qcocoawindowdelegate_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qcocoawindowdelegate_mac_p.h b/src/widgets/platforms/mac/qcocoawindowdelegate_mac_p.h
index 261d1d192a..27906e116c 100644
--- a/src/widgets/platforms/mac/qcocoawindowdelegate_mac_p.h
+++ b/src/widgets/platforms/mac/qcocoawindowdelegate_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qcolormap_mac.cpp b/src/widgets/platforms/mac/qcolormap_mac.cpp
index 0c3fd70468..de920d7144 100644
--- a/src/widgets/platforms/mac/qcolormap_mac.cpp
+++ b/src/widgets/platforms/mac/qcolormap_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qdesktopwidget_mac.mm b/src/widgets/platforms/mac/qdesktopwidget_mac.mm
index 0bf213303e..9869eeeab2 100644
--- a/src/widgets/platforms/mac/qdesktopwidget_mac.mm
+++ b/src/widgets/platforms/mac/qdesktopwidget_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qdesktopwidget_mac_p.h b/src/widgets/platforms/mac/qdesktopwidget_mac_p.h
index e1ca7e7a37..a2d7552120 100644
--- a/src/widgets/platforms/mac/qdesktopwidget_mac_p.h
+++ b/src/widgets/platforms/mac/qdesktopwidget_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qdnd_mac.mm b/src/widgets/platforms/mac/qdnd_mac.mm
index 73acb93f0b..b5543024c0 100644
--- a/src/widgets/platforms/mac/qdnd_mac.mm
+++ b/src/widgets/platforms/mac/qdnd_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qeventdispatcher_mac.mm b/src/widgets/platforms/mac/qeventdispatcher_mac.mm
index 2a5227c19f..0056ebeca8 100644
--- a/src/widgets/platforms/mac/qeventdispatcher_mac.mm
+++ b/src/widgets/platforms/mac/qeventdispatcher_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qeventdispatcher_mac_p.h b/src/widgets/platforms/mac/qeventdispatcher_mac_p.h
index 241adf2fce..57797b070b 100644
--- a/src/widgets/platforms/mac/qeventdispatcher_mac_p.h
+++ b/src/widgets/platforms/mac/qeventdispatcher_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qkeymapper_mac.cpp b/src/widgets/platforms/mac/qkeymapper_mac.cpp
index df18511b4f..3cacb098aa 100644
--- a/src/widgets/platforms/mac/qkeymapper_mac.cpp
+++ b/src/widgets/platforms/mac/qkeymapper_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qmacdefines_mac.h b/src/widgets/platforms/mac/qmacdefines_mac.h
index d0accf872f..9f27dfa584 100644
--- a/src/widgets/platforms/mac/qmacdefines_mac.h
+++ b/src/widgets/platforms/mac/qmacdefines_mac.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qmacgesturerecognizer_mac.mm b/src/widgets/platforms/mac/qmacgesturerecognizer_mac.mm
index 6e77f41d2d..54823aa04f 100644
--- a/src/widgets/platforms/mac/qmacgesturerecognizer_mac.mm
+++ b/src/widgets/platforms/mac/qmacgesturerecognizer_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qmacgesturerecognizer_mac_p.h b/src/widgets/platforms/mac/qmacgesturerecognizer_mac_p.h
index 8d1bd337d7..c77ead3c21 100644
--- a/src/widgets/platforms/mac/qmacgesturerecognizer_mac_p.h
+++ b/src/widgets/platforms/mac/qmacgesturerecognizer_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qmacinputcontext_mac.cpp b/src/widgets/platforms/mac/qmacinputcontext_mac.cpp
index 43da4a911f..ee0bf70427 100644
--- a/src/widgets/platforms/mac/qmacinputcontext_mac.cpp
+++ b/src/widgets/platforms/mac/qmacinputcontext_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qmacinputcontext_p.h b/src/widgets/platforms/mac/qmacinputcontext_p.h
index 4fb3eb57b6..7a7ef9687b 100644
--- a/src/widgets/platforms/mac/qmacinputcontext_p.h
+++ b/src/widgets/platforms/mac/qmacinputcontext_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qmime_mac.cpp b/src/widgets/platforms/mac/qmime_mac.cpp
index a9843b7e87..730f672ecd 100644
--- a/src/widgets/platforms/mac/qmime_mac.cpp
+++ b/src/widgets/platforms/mac/qmime_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qnsframeview_mac_p.h b/src/widgets/platforms/mac/qnsframeview_mac_p.h
index 72245c1782..1534ad1461 100644
--- a/src/widgets/platforms/mac/qnsframeview_mac_p.h
+++ b/src/widgets/platforms/mac/qnsframeview_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qnsthemeframe_mac_p.h b/src/widgets/platforms/mac/qnsthemeframe_mac_p.h
index a1fa4ef1d8..1768ad8687 100644
--- a/src/widgets/platforms/mac/qnsthemeframe_mac_p.h
+++ b/src/widgets/platforms/mac/qnsthemeframe_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qnstitledframe_mac_p.h b/src/widgets/platforms/mac/qnstitledframe_mac_p.h
index 18a6155925..531b943646 100644
--- a/src/widgets/platforms/mac/qnstitledframe_mac_p.h
+++ b/src/widgets/platforms/mac/qnstitledframe_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qpaintdevice_mac.cpp b/src/widgets/platforms/mac/qpaintdevice_mac.cpp
index 50bd4b8490..01f4a18bf6 100644
--- a/src/widgets/platforms/mac/qpaintdevice_mac.cpp
+++ b/src/widgets/platforms/mac/qpaintdevice_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -100,53 +100,4 @@ Q_WIDGETS_EXPORT GrafPtr qt_mac_qd_context(const QPaintDevice *device)
extern CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *pdev);
-/*! \internal
-
- Returns the CoreGraphics CGContextRef of the paint device. 0 is
- returned if it can't be obtained. It is the caller's responsiblity to
- CGContextRelease the context when finished using it.
-
- \warning This function is only available on Mac OS X.
-*/
-
-Q_WIDGETS_EXPORT CGContextRef qt_mac_cg_context(const QPaintDevice *pdev)
-{
- if (pdev->devType() == QInternal::Pixmap) {
- const QPixmap *pm = static_cast<const QPixmap*>(pdev);
- CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pdev);
- uint flags = kCGImageAlphaPremultipliedFirst;
-#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
- flags |= kCGBitmapByteOrder32Host;
-#endif
- CGContextRef ret = 0;
-
- // It would make sense to put this into a mac #ifdef'ed
- // virtual function in the QPlatformPixmap at some point
- if (pm->data->classId() == QPlatformPixmap::MacClass) {
- const QMacPlatformPixmap *pmData = static_cast<const QMacPlatformPixmap*>(pm->data.data());
- ret = CGBitmapContextCreate(pmData->pixels, pmData->w, pmData->h,
- 8, pmData->bytesPerRow, colorspace,
- flags);
- if(!ret)
- qWarning("QPaintDevice: Unable to create context for pixmap (%d/%d/%d)",
- pmData->w, pmData->h, (pmData->bytesPerRow * pmData->h));
- } else if (pm->data->classId() == QPlatformPixmap::RasterClass) {
- QImage *image = pm->data->buffer();
- ret = CGBitmapContextCreate(image->bits(), image->width(), image->height(),
- 8, image->bytesPerLine(), colorspace, flags);
- }
-
- CGContextTranslateCTM(ret, 0, pm->height());
- CGContextScaleCTM(ret, 1, -1);
- return ret;
- } else if (pdev->devType() == QInternal::Widget) {
- CGContextRef ret = static_cast<CGContextRef>(static_cast<const QWidget *>(pdev)->macCGHandle());
- CGContextRetain(ret);
- return ret;
- } else if (pdev->devType() == QInternal::MacQuartz) {
- return static_cast<const QMacQuartzPaintDevice *>(pdev)->cgContext();
- }
- return 0;
-}
-
QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qpaintengine_mac.cpp b/src/widgets/platforms/mac/qpaintengine_mac.cpp
index af8e0e36c3..f1e397e7b0 100644
--- a/src/widgets/platforms/mac/qpaintengine_mac.cpp
+++ b/src/widgets/platforms/mac/qpaintengine_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -87,60 +87,6 @@ extern QPixmap qt_pixmapForBrush(int, bool); //qbrush.cpp
void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform);
-//Implemented for qt_mac_p.h
-QMacCGContext::QMacCGContext(QPainter *p)
-{
- QPaintEngine *pe = p->paintEngine();
- if (pe->type() == QPaintEngine::MacPrinter)
- pe = static_cast<QMacPrintEngine*>(pe)->paintEngine();
- pe->syncState();
- context = 0;
- if(pe->type() == QPaintEngine::CoreGraphics)
- context = static_cast<QCoreGraphicsPaintEngine*>(pe)->handle();
-
- int devType = p->device()->devType();
- if (pe->type() == QPaintEngine::Raster
- && (devType == QInternal::Widget ||
- devType == QInternal::Pixmap ||
- devType == QInternal::Image)) {
-
- extern CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice);
- CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pe->paintDevice());
- uint flags = kCGImageAlphaPremultipliedFirst;
-#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
- flags |= kCGBitmapByteOrder32Host;
-#endif
- const QImage *image = (const QImage *) pe->paintDevice();
-
- context = CGBitmapContextCreate((void *) image->bits(), image->width(), image->height(),
- 8, image->bytesPerLine(), colorspace, flags);
-
- CGContextTranslateCTM(context, 0, image->height());
- CGContextScaleCTM(context, 1, -1);
-
- if (devType == QInternal::Widget) {
- QRegion clip = p->paintEngine()->systemClip();
- QTransform native = p->deviceTransform();
- QTransform logical = p->combinedTransform();
-
- if (p->hasClipping()) {
- QRegion r = p->clipRegion();
- r.translate(native.dx(), native.dy());
- if (clip.isEmpty())
- clip = r;
- else
- clip &= r;
- }
- qt_mac_clip_cg(context, clip, 0);
-
- CGContextTranslateCTM(context, native.dx(), native.dy());
- }
- } else {
- CGContextRetain(context);
- }
-}
-
-
/*****************************************************************************
QCoreGraphicsPaintEngine utility functions
*****************************************************************************/
@@ -152,13 +98,6 @@ CGAffineTransform qt_mac_convert_transform_to_cg(const QTransform &t) {
return CGAffineTransformMake(t.m11(), t.m12(), t.m21(), t.m22(), t.dx(), t.dy());
}
-CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice)
-{
- bool isWidget = (paintDevice->devType() == QInternal::Widget);
- return QCoreGraphicsPaintEngine::macDisplayColorSpace(isWidget ? static_cast<const QWidget *>(paintDevice)
- : 0);
-}
-
inline static QCFType<CGColorRef> cgColorForQColor(const QColor &col, QPaintDevice *pdev)
{
CGFloat components[] = {
@@ -317,46 +256,6 @@ CGColorSpaceRef QCoreGraphicsPaintEngine::macGenericColorSpace()
return macDisplayColorSpace();
#endif
}
-void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform)
-{
- CGAffineTransform old_xform = CGAffineTransformIdentity;
- if(orig_xform) { //setup xforms
- old_xform = CGContextGetCTM(hd);
- CGContextConcatCTM(hd, CGAffineTransformInvert(old_xform));
- CGContextConcatCTM(hd, *orig_xform);
- }
-
- //do the clipping
- CGContextBeginPath(hd);
- if(rgn.isEmpty()) {
- CGContextAddRect(hd, CGRectMake(0, 0, 0, 0));
- } else {
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
- QCFType<HIMutableShapeRef> shape = rgn.toHIMutableShape();
- Q_ASSERT(!HIShapeIsEmpty(shape));
- HIShapeReplacePathInCGContext(shape, hd);
- } else
-#endif
- {
- QVector<QRect> rects = rgn.rects();
- const int count = rects.size();
- for(int i = 0; i < count; i++) {
- const QRect &r = rects[i];
- CGRect mac_r = CGRectMake(r.x(), r.y(), r.width(), r.height());
- CGContextAddRect(hd, mac_r);
- }
- }
-
- }
- CGContextClip(hd);
-
- if(orig_xform) {//reset xforms
- CGContextConcatCTM(hd, CGAffineTransformInvert(CGContextGetCTM(hd)));
- CGContextConcatCTM(hd, old_xform);
- }
-}
-
//pattern handling (tiling)
#if 1
diff --git a/src/widgets/platforms/mac/qpaintengine_mac_p.h b/src/widgets/platforms/mac/qpaintengine_mac_p.h
index 2434011e52..a8e27a808d 100644
--- a/src/widgets/platforms/mac/qpaintengine_mac_p.h
+++ b/src/widgets/platforms/mac/qpaintengine_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qpixmap_mac.cpp b/src/widgets/platforms/mac/qpixmap_mac.cpp
index 48835c7d46..3b2452c37c 100644
--- a/src/widgets/platforms/mac/qpixmap_mac.cpp
+++ b/src/widgets/platforms/mac/qpixmap_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qpixmap_mac_p.h b/src/widgets/platforms/mac/qpixmap_mac_p.h
index 4f53160074..582eef27b6 100644
--- a/src/widgets/platforms/mac/qpixmap_mac_p.h
+++ b/src/widgets/platforms/mac/qpixmap_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qprintengine_mac.mm b/src/widgets/platforms/mac/qprintengine_mac.mm
index b01d7a5762..9902b3216d 100644
--- a/src/widgets/platforms/mac/qprintengine_mac.mm
+++ b/src/widgets/platforms/mac/qprintengine_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qprintengine_mac_p.h b/src/widgets/platforms/mac/qprintengine_mac_p.h
index 6c17818fbd..349dfd10f2 100644
--- a/src/widgets/platforms/mac/qprintengine_mac_p.h
+++ b/src/widgets/platforms/mac/qprintengine_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qprinterinfo_mac.cpp b/src/widgets/platforms/mac/qprinterinfo_mac.cpp
index 455510d5d3..98492a5af6 100644
--- a/src/widgets/platforms/mac/qprinterinfo_mac.cpp
+++ b/src/widgets/platforms/mac/qprinterinfo_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qregion_mac.cpp b/src/widgets/platforms/mac/qregion_mac.cpp
index b929d9c283..71e7a3b44b 100644
--- a/src/widgets/platforms/mac/qregion_mac.cpp
+++ b/src/widgets/platforms/mac/qregion_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -47,75 +47,4 @@ QT_BEGIN_NAMESPACE
QRegion::QRegionData QRegion::shared_empty = { Q_BASIC_ATOMIC_INITIALIZER(1), 0 };
-
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
-OSStatus QRegion::shape2QRegionHelper(int inMessage, HIShapeRef,
- const CGRect *inRect, void *inRefcon)
-{
- QRegion *region = static_cast<QRegion *>(inRefcon);
- if (!region)
- return paramErr;
-
- switch (inMessage) {
- case kHIShapeEnumerateRect:
- *region += QRect(inRect->origin.x, inRect->origin.y,
- inRect->size.width, inRect->size.height);
- break;
- case kHIShapeEnumerateInit:
- // Assume the region is already setup correctly
- case kHIShapeEnumerateTerminate:
- default:
- break;
- }
- return noErr;
-}
-#endif
-
-/*!
- \internal
- Create's a mutable shape, it's the caller's responsibility to release.
- WARNING: this function clamps the coordinates to SHRT_MIN/MAX on 10.4 and below.
-*/
-HIMutableShapeRef QRegion::toHIMutableShape() const
-{
- HIMutableShapeRef shape = HIShapeCreateMutable();
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
- if (d->qt_rgn && d->qt_rgn->numRects) {
- int n = d->qt_rgn->numRects;
- const QRect *qt_r = (n == 1) ? &d->qt_rgn->extents : d->qt_rgn->rects.constData();
- while (n--) {
- CGRect cgRect = CGRectMake(qt_r->x(), qt_r->y(), qt_r->width(), qt_r->height());
- HIShapeUnionWithRect(shape, &cgRect);
- ++qt_r;
- }
- }
- } else
-#endif
- {
- }
- return shape;
-}
-
-
-
-QRegion QRegion::fromHIShapeRef(HIShapeRef shape)
-{
- QRegion returnRegion;
- returnRegion.detach();
- // Begin gratuitous #if-defery
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
-# ifndef Q_WS_MAC64
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
-# endif
- HIShapeEnumerate(shape, kHIShapeParseFromTopLeft, shape2QRegionHelper, &returnRegion);
-# ifndef Q_WS_MAC64
- } else
-# endif
-#endif
- {
- }
- return returnRegion;
-}
-
QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qt_cocoa_helpers_mac.mm b/src/widgets/platforms/mac/qt_cocoa_helpers_mac.mm
index 20bb6bffbb..348b989ec6 100644
--- a/src/widgets/platforms/mac/qt_cocoa_helpers_mac.mm
+++ b/src/widgets/platforms/mac/qt_cocoa_helpers_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -219,12 +219,6 @@ DnDParams *macCurrentDnDParameters()
}
#endif
-bool macWindowIsTextured( void * /*OSWindowRef*/ window )
-{
- OSWindowRef wnd = static_cast<OSWindowRef>(window);
- return ( [wnd styleMask] & NSTexturedBackgroundWindowMask ) ? true : false;
-}
-
void macWindowToolbarShow(const QWidget *widget, bool show )
{
OSWindowRef wnd = qt_mac_window_for(widget);
diff --git a/src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h b/src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h
index c85d39010c..bae479ec6a 100644
--- a/src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h
+++ b/src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -129,7 +129,6 @@ QT_BEGIN_NAMESPACE
Qt::MouseButtons qt_mac_get_buttons(int buttons);
Qt::MouseButton qt_mac_get_button(EventMouseButton button);
void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds = 0.15);
-bool macWindowIsTextured(void * /*OSWindowRef*/ window);
void macWindowToolbarShow(const QWidget *widget, bool show );
void macWindowToolbarSet( void * /*OSWindowRef*/ window, void* toolbarRef );
bool macWindowToolbarIsVisible( void * /*OSWindowRef*/ window );
@@ -140,7 +139,6 @@ void qt_mac_updateContentBorderMetricts(void * /*OSWindowRef */window, const ::H
void qt_mac_replaceDrawRect(void * /*OSWindowRef */window, QWidgetPrivate *widget);
void qt_mac_replaceDrawRectOriginal(void * /*OSWindowRef */window, QWidgetPrivate *widget);
void qt_mac_showBaseLineSeparator(void * /*OSWindowRef */window, bool show);
-void * /*NSImage */qt_mac_create_nsimage(const QPixmap &pm);
void qt_mac_update_mouseTracking(QWidget *widget);
OSStatus qt_mac_drawCGImage(CGContextRef cg, const CGRect *inbounds, CGImageRef);
bool qt_mac_checkForNativeSizeGrip(const QWidget *widget);
diff --git a/src/widgets/platforms/mac/qt_mac.cpp b/src/widgets/platforms/mac/qt_mac.cpp
index b3c9371d24..adf8f70cab 100644
--- a/src/widgets/platforms/mac/qt_mac.cpp
+++ b/src/widgets/platforms/mac/qt_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -67,24 +67,6 @@ QFont qfontForThemeFont(ThemeFontID themeID)
}
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
-static QColor qcolorFromCGColor(CGColorRef cgcolor)
-{
- QColor pc;
- CGColorSpaceModel model = CGColorSpaceGetModel(CGColorGetColorSpace(cgcolor));
- const CGFloat *components = CGColorGetComponents(cgcolor);
- if (model == kCGColorSpaceModelRGB) {
- pc.setRgbF(components[0], components[1], components[2], components[3]);
- } else if (model == kCGColorSpaceModelCMYK) {
- pc.setCmykF(components[0], components[1], components[2], components[3]);
- } else if (model == kCGColorSpaceModelMonochrome) {
- pc.setRgbF(components[0], components[0], components[0], components[1]);
- } else {
- // Colorspace we can't deal with.
- qWarning("Qt: qcolorFromCGColor: cannot convert from colorspace model: %d", model);
- Q_ASSERT(false);
- }
- return pc;
-}
static inline QColor leopardBrush(ThemeBrush brush)
{
diff --git a/src/widgets/platforms/mac/qt_mac_p.h b/src/widgets/platforms/mac/qt_mac_p.h
index 5a1d4ee42e..3b679c32ec 100644
--- a/src/widgets/platforms/mac/qt_mac_p.h
+++ b/src/widgets/platforms/mac/qt_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/platforms/mac/qwidget_mac.mm b/src/widgets/platforms/mac/qwidget_mac.mm
index dd958761a1..6c8413e42e 100644
--- a/src/widgets/platforms/mac/qwidget_mac.mm
+++ b/src/widgets/platforms/mac/qwidget_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/statemachine/qbasickeyeventtransition.cpp b/src/widgets/statemachine/qbasickeyeventtransition.cpp
index 615e642a7e..fca11eb036 100644
--- a/src/widgets/statemachine/qbasickeyeventtransition.cpp
+++ b/src/widgets/statemachine/qbasickeyeventtransition.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/statemachine/qbasickeyeventtransition_p.h b/src/widgets/statemachine/qbasickeyeventtransition_p.h
index 6a51260155..379c151e60 100644
--- a/src/widgets/statemachine/qbasickeyeventtransition_p.h
+++ b/src/widgets/statemachine/qbasickeyeventtransition_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/statemachine/qbasicmouseeventtransition.cpp b/src/widgets/statemachine/qbasicmouseeventtransition.cpp
index 0edf430af6..c05b262b66 100644
--- a/src/widgets/statemachine/qbasicmouseeventtransition.cpp
+++ b/src/widgets/statemachine/qbasicmouseeventtransition.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/statemachine/qbasicmouseeventtransition_p.h b/src/widgets/statemachine/qbasicmouseeventtransition_p.h
index 3a608cb0af..98a8f28ca8 100644
--- a/src/widgets/statemachine/qbasicmouseeventtransition_p.h
+++ b/src/widgets/statemachine/qbasicmouseeventtransition_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp
index f717662ace..928bbd5a53 100644
--- a/src/widgets/statemachine/qguistatemachine.cpp
+++ b/src/widgets/statemachine/qguistatemachine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -285,13 +285,6 @@ static QEvent *cloneEvent(QEvent *e)
case QEvent::HoverMove:
return new QHoverEvent(*static_cast<QHoverEvent*>(e));
- case QEvent::AccessibilityHelp:
- Q_ASSERT_X(false, "cloneEvent()", "not implemented");
- break;
- case QEvent::AccessibilityDescription:
- Q_ASSERT_X(false, "cloneEvent()", "not implemented");
- break;
-
#ifdef QT_KEYPAD_NAVIGATION
case QEvent::EnterEditFocus:
return new QEvent(*e);
diff --git a/src/widgets/statemachine/qkeyeventtransition.cpp b/src/widgets/statemachine/qkeyeventtransition.cpp
index b1ff2e33b2..175d4924a9 100644
--- a/src/widgets/statemachine/qkeyeventtransition.cpp
+++ b/src/widgets/statemachine/qkeyeventtransition.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/statemachine/qkeyeventtransition.h b/src/widgets/statemachine/qkeyeventtransition.h
index 7862bd41d7..b22a4e0934 100644
--- a/src/widgets/statemachine/qkeyeventtransition.h
+++ b/src/widgets/statemachine/qkeyeventtransition.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/statemachine/qmouseeventtransition.cpp b/src/widgets/statemachine/qmouseeventtransition.cpp
index 416529bddd..60c2c85159 100644
--- a/src/widgets/statemachine/qmouseeventtransition.cpp
+++ b/src/widgets/statemachine/qmouseeventtransition.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/statemachine/qmouseeventtransition.h b/src/widgets/statemachine/qmouseeventtransition.h
index 7255a968ac..bdd64c5f3f 100644
--- a/src/widgets/statemachine/qmouseeventtransition.h
+++ b/src/widgets/statemachine/qmouseeventtransition.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qcdestyle.cpp b/src/widgets/styles/qcdestyle.cpp
index 426ab19007..518461c279 100644
--- a/src/widgets/styles/qcdestyle.cpp
+++ b/src/widgets/styles/qcdestyle.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qcdestyle.h b/src/widgets/styles/qcdestyle.h
index 854bfc6c69..b5293d30f3 100644
--- a/src/widgets/styles/qcdestyle.h
+++ b/src/widgets/styles/qcdestyle.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qcleanlooksstyle.cpp b/src/widgets/styles/qcleanlooksstyle.cpp
index 567efa8851..42f9b38bd4 100644
--- a/src/widgets/styles/qcleanlooksstyle.cpp
+++ b/src/widgets/styles/qcleanlooksstyle.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qcleanlooksstyle.h b/src/widgets/styles/qcleanlooksstyle.h
index 1b35aa7969..94b3aa889c 100644
--- a/src/widgets/styles/qcleanlooksstyle.h
+++ b/src/widgets/styles/qcleanlooksstyle.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qcleanlooksstyle_p.h b/src/widgets/styles/qcleanlooksstyle_p.h
index 4df13c8a43..d9968bb531 100644
--- a/src/widgets/styles/qcleanlooksstyle_p.h
+++ b/src/widgets/styles/qcleanlooksstyle_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 31311a50f4..c874770fdb 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -44,6 +44,7 @@
#include <qfile.h>
#include <qapplication.h>
+#include <private/qguiapplication_p.h>
#include <qbitmap.h>
#include <qcache.h>
#include <qdockwidget.h>
@@ -72,6 +73,7 @@
#include <qfileinfo.h>
#include <qdir.h>
#include <qsettings.h>
+#include <qvariant.h>
#include <qpixmapcache.h>
#include <private/qguiplatformplugin_p.h>
@@ -4313,7 +4315,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
#endif
case PM_MaximumDragDistance:
- ret = -1;
+ ret = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::MaximumScrollBarDragDistance).toInt();
break;
#ifndef QT_NO_SLIDER
@@ -4550,7 +4552,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
}
break;
case PM_TextCursorWidth:
- ret = 1;
+ ret = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::TextCursorWidth).toInt();
break;
case PM_TabBar_ScrollButtonOverlap:
ret = 1;
diff --git a/src/widgets/styles/qcommonstyle.h b/src/widgets/styles/qcommonstyle.h
index a4a7ac11c5..e023c702da 100644
--- a/src/widgets/styles/qcommonstyle.h
+++ b/src/widgets/styles/qcommonstyle.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qcommonstyle_p.h b/src/widgets/styles/qcommonstyle_p.h
index 554a8130f6..10a9cd875a 100644
--- a/src/widgets/styles/qcommonstyle_p.h
+++ b/src/widgets/styles/qcommonstyle_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qcommonstylepixmaps_p.h b/src/widgets/styles/qcommonstylepixmaps_p.h
index 93cd837fb7..73c183d485 100644
--- a/src/widgets/styles/qcommonstylepixmaps_p.h
+++ b/src/widgets/styles/qcommonstylepixmaps_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qdrawutil.cpp b/src/widgets/styles/qdrawutil.cpp
index 5cd7bae658..fd8a272851 100644
--- a/src/widgets/styles/qdrawutil.cpp
+++ b/src/widgets/styles/qdrawutil.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qdrawutil.h b/src/widgets/styles/qdrawutil.h
index 2f35d236b7..74347b09c1 100644
--- a/src/widgets/styles/qdrawutil.h
+++ b/src/widgets/styles/qdrawutil.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qgtkpainter.cpp b/src/widgets/styles/qgtkpainter.cpp
index 373732f924..a9d1ed2281 100644
--- a/src/widgets/styles/qgtkpainter.cpp
+++ b/src/widgets/styles/qgtkpainter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qgtkpainter_p.h b/src/widgets/styles/qgtkpainter_p.h
index a9d4dc0dcd..b0874d2315 100644
--- a/src/widgets/styles/qgtkpainter_p.h
+++ b/src/widgets/styles/qgtkpainter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qgtkstyle.cpp b/src/widgets/styles/qgtkstyle.cpp
index da39c95a58..30e1371354 100644
--- a/src/widgets/styles/qgtkstyle.cpp
+++ b/src/widgets/styles/qgtkstyle.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qgtkstyle.h b/src/widgets/styles/qgtkstyle.h
index 1ca6e3cc85..26665dcd51 100644
--- a/src/widgets/styles/qgtkstyle.h
+++ b/src/widgets/styles/qgtkstyle.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp
index a2fabde736..f3b41e0ba1 100644
--- a/src/widgets/styles/qgtkstyle_p.cpp
+++ b/src/widgets/styles/qgtkstyle_p.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qgtkstyle_p.h b/src/widgets/styles/qgtkstyle_p.h
index 55089268b3..656a187ded 100644
--- a/src/widgets/styles/qgtkstyle_p.h
+++ b/src/widgets/styles/qgtkstyle_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qmacstyle.qdoc b/src/widgets/styles/qmacstyle.qdoc
index 709332aa1d..97baf80e9d 100644
--- a/src/widgets/styles/qmacstyle.qdoc
+++ b/src/widgets/styles/qmacstyle.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qmacstyle_mac.h b/src/widgets/styles/qmacstyle_mac.h
index bb9175cca8..7a3a4248b3 100644
--- a/src/widgets/styles/qmacstyle_mac.h
+++ b/src/widgets/styles/qmacstyle_mac.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
class QPalette;
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index f6eacd28dc..ca9b5cf234 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -45,17 +45,15 @@
*/
#include "qmacstyle_mac.h"
+#include "qmacstyle_mac_p.h"
+#include "qmacstylepixmaps_mac_p.h"
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
#define QMAC_QAQUASTYLE_SIZE_CONSTRAIN
//#define DEBUG_SIZE_CONSTRAINT
-#include <private/qapplication_p.h>
+#include <private/qcore_mac_p.h>
#include <private/qcombobox_p.h>
-#include <private/qmacstylepixmaps_mac_p.h>
-#include <private/qpaintengine_mac_p.h>
#include <private/qpainter_p.h>
-#include <private/qprintengine_mac_p.h>
#include <qapplication.h>
#include <qbitmap.h>
#include <qcheckbox.h>
@@ -97,11 +95,10 @@
#include <qlibrary.h>
#include <qdatetimeedit.h>
#include <qmath.h>
-#include <QtGui/qgraphicsproxywidget.h>
-#include <QtGui/qgraphicsview.h>
-#include <private/qt_cocoa_helpers_mac_p.h>
-#include "qmacstyle_mac_p.h"
+#include <QtWidgets/qgraphicsproxywidget.h>
+#include <QtWidgets/qgraphicsview.h>
#include <private/qstylehelper_p.h>
+#include <QtGui/QPlatformFontDatabase>
QT_BEGIN_NAMESPACE
@@ -138,9 +135,6 @@ typedef HIRect * (*PtrHIShapeGetBounds)(HIShapeRef, HIRect *);
static PtrHIShapeGetBounds ptrHIShapeGetBounds = 0;
static int closeButtonSize = 12;
-
-extern QRegion qt_mac_convert_mac_region(RgnHandle); //qregion_mac.cpp
-
static bool isVerticalTabs(const QTabBar::Shape shape) {
return (shape == QTabBar::RoundedEast
|| shape == QTabBar::TriangularEast
@@ -417,18 +411,247 @@ static inline ThemeTabDirection getTabDirection(QTabBar::Shape shape)
return ttd;
}
-QT_BEGIN_INCLUDE_NAMESPACE
-#include "moc_qmacstyle_mac.cpp"
-#include "moc_qmacstyle_mac_p.cpp"
-QT_END_INCLUDE_NAMESPACE
+static QString qt_mac_removeMnemonics(const QString &original)
+{
+ QString returnText(original.size(), 0);
+ int finalDest = 0;
+ int currPos = 0;
+ int l = original.length();
+ while (l) {
+ if (original.at(currPos) == QLatin1Char('&')
+ && (l == 1 || original.at(currPos + 1) != QLatin1Char('&'))) {
+ ++currPos;
+ --l;
+ if (l == 0)
+ break;
+ }
+ returnText[finalDest] = original.at(currPos);
+ ++currPos;
+ ++finalDest;
+ --l;
+ }
+ returnText.truncate(finalDest);
+ return returnText;
+}
-/*****************************************************************************
- External functions
- *****************************************************************************/
-extern CGContextRef qt_mac_cg_context(const QPaintDevice *); //qpaintdevice_mac.cpp
-extern QRegion qt_mac_convert_mac_region(HIShapeRef); //qregion_mac.cpp
-void qt_mac_dispose_rgn(RgnHandle r); //qregion_mac.cpp
-extern QPaintDevice *qt_mac_safe_pdev; //qapplication_mac.cpp
+class QMacCGContext
+{
+ CGContextRef context;
+public:
+ QMacCGContext(QPainter *p); //qpaintengine_mac.cpp
+ inline QMacCGContext() { context = 0; }
+ inline QMacCGContext(const QPaintDevice *pdev) {
+ extern CGContextRef qt_mac_cg_context(const QPaintDevice *);
+ context = qt_mac_cg_context(pdev);
+ }
+ inline QMacCGContext(CGContextRef cg, bool takeOwnership=false) {
+ context = cg;
+ if (!takeOwnership)
+ CGContextRetain(context);
+ }
+ inline QMacCGContext(const QMacCGContext &copy) : context(0) { *this = copy; }
+ inline ~QMacCGContext() {
+ if (context)
+ CGContextRelease(context);
+ }
+ inline bool isNull() const { return context; }
+ inline operator CGContextRef() { return context; }
+ inline QMacCGContext &operator=(const QMacCGContext &copy) {
+ if (context)
+ CGContextRelease(context);
+ context = copy.context;
+ CGContextRetain(context);
+ return *this;
+ }
+ inline QMacCGContext &operator=(CGContextRef cg) {
+ if (context)
+ CGContextRelease(context);
+ context = cg;
+ CGContextRetain(context); //we do not take ownership
+ return *this;
+ }
+};
+
+static QColor qcolorFromCGColor(CGColorRef cgcolor)
+{
+ QColor pc;
+ CGColorSpaceModel model = CGColorSpaceGetModel(CGColorGetColorSpace(cgcolor));
+ const CGFloat *components = CGColorGetComponents(cgcolor);
+ if (model == kCGColorSpaceModelRGB) {
+ pc.setRgbF(components[0], components[1], components[2], components[3]);
+ } else if (model == kCGColorSpaceModelCMYK) {
+ pc.setCmykF(components[0], components[1], components[2], components[3]);
+ } else if (model == kCGColorSpaceModelMonochrome) {
+ pc.setRgbF(components[0], components[0], components[0], components[1]);
+ } else {
+ // Colorspace we can't deal with.
+ qWarning("Qt: qcolorFromCGColor: cannot convert from colorspace model: %d", model);
+ Q_ASSERT(false);
+ }
+ return pc;
+}
+
+static inline QColor leopardBrush(ThemeBrush brush)
+{
+ QCFType<CGColorRef> cgClr = 0;
+ HIThemeBrushCreateCGColor(brush, &cgClr);
+ return qcolorFromCGColor(cgClr);
+}
+
+QColor qcolorForTheme(ThemeBrush brush)
+{
+ return leopardBrush(brush);
+}
+
+OSStatus qt_mac_shape2QRegionHelper(int inMessage, HIShapeRef, const CGRect *inRect, void *inRefcon)
+{
+ QRegion *region = static_cast<QRegion *>(inRefcon);
+ if (!region)
+ return paramErr;
+
+ switch (inMessage) {
+ case kHIShapeEnumerateRect:
+ *region += QRect(inRect->origin.x, inRect->origin.y,
+ inRect->size.width, inRect->size.height);
+ break;
+ case kHIShapeEnumerateInit:
+ // Assume the region is already setup correctly
+ case kHIShapeEnumerateTerminate:
+ default:
+ break;
+ }
+ return noErr;
+}
+
+
+/*!
+ \internal
+ Create's a mutable shape, it's the caller's responsibility to release.
+ WARNING: this function clamps the coordinates to SHRT_MIN/MAX on 10.4 and below.
+*/
+HIMutableShapeRef qt_mac_toHIMutableShape(const QRegion &region)
+{
+ HIMutableShapeRef shape = HIShapeCreateMutable();
+ if (region.rectCount() < 2 ) {
+ QRect qtRect = region.boundingRect();
+ CGRect cgRect = CGRectMake(qtRect.x(), qtRect.y(), qtRect.width(), qtRect.height());
+ HIShapeUnionWithRect(shape, &cgRect);
+ } else {
+ foreach (const QRect &qtRect, region.rects()) {
+ CGRect cgRect = CGRectMake(qtRect.x(), qtRect.y(), qtRect.width(), qtRect.height());
+ HIShapeUnionWithRect(shape, &cgRect);
+ }
+ }
+ return shape;
+}
+
+QRegion qt_mac_fromHIShapeRef(HIShapeRef shape)
+{
+ QRegion returnRegion;
+ //returnRegion.detach();
+ HIShapeEnumerate(shape, kHIShapeParseFromTopLeft, qt_mac_shape2QRegionHelper, &returnRegion);
+ return returnRegion;
+}
+
+CGColorSpaceRef m_genericColorSpace = 0;
+QHash<CGDirectDisplayID, CGColorSpaceRef> m_displayColorSpaceHash;
+bool m_postRoutineRegistered = false;
+
+CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget);
+CGColorSpaceRef qt_mac_genericColorSpace()
+{
+#if 0
+ if (!m_genericColorSpace) {
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
+ m_genericColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
+ } else
+#endif
+ {
+ m_genericColorSpace = CGColorSpaceCreateDeviceRGB();
+ }
+ if (!m_postRoutineRegistered) {
+ m_postRoutineRegistered = true;
+ qAddPostRoutine(QCoreGraphicsPaintEngine::cleanUpMacColorSpaces);
+ }
+ }
+ return m_genericColorSpace;
+#else
+ // Just return the main display colorspace for the moment.
+ return qt_mac_displayColorSpace(0);
+#endif
+}
+
+/*
+ Ideally, we should pass the widget in here, and use CGGetDisplaysWithRect() etc.
+ to support multiple displays correctly.
+*/
+CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget)
+{
+ CGColorSpaceRef colorSpace;
+
+ CGDirectDisplayID displayID;
+ CMProfileRef displayProfile = 0;
+ if (widget == 0) {
+ displayID = CGMainDisplayID();
+ } else {
+ displayID = CGMainDisplayID();
+ /*
+ ### get correct display
+ const QRect &qrect = widget->window()->geometry();
+ CGRect rect = CGRectMake(qrect.x(), qrect.y(), qrect.width(), qrect.height());
+ CGDisplayCount throwAway;
+ CGDisplayErr dErr = CGGetDisplaysWithRect(rect, 1, &displayID, &throwAway);
+ if (dErr != kCGErrorSuccess)
+ return macDisplayColorSpace(0); // fall back on main display
+ */
+ }
+ if ((colorSpace = m_displayColorSpaceHash.value(displayID)))
+ return colorSpace;
+
+ CMError err = CMGetProfileByAVID((CMDisplayIDType)displayID, &displayProfile);
+ if (err == noErr) {
+ colorSpace = CGColorSpaceCreateWithPlatformColorSpace(displayProfile);
+ } else if (widget) {
+ return qt_mac_displayColorSpace(0); // fall back on main display
+ }
+
+ if (colorSpace == 0)
+ colorSpace = CGColorSpaceCreateDeviceRGB();
+
+ m_displayColorSpaceHash.insert(displayID, colorSpace);
+ CMCloseProfile(displayProfile);
+ if (!m_postRoutineRegistered) {
+ m_postRoutineRegistered = true;
+ void qt_mac_cleanUpMacColorSpaces();
+ qAddPostRoutine(qt_mac_cleanUpMacColorSpaces);
+ }
+ return colorSpace;
+}
+
+void qt_mac_cleanUpMacColorSpaces()
+{
+ if (m_genericColorSpace) {
+ CFRelease(m_genericColorSpace);
+ m_genericColorSpace = 0;
+ }
+ QHash<CGDirectDisplayID, CGColorSpaceRef>::const_iterator it = m_displayColorSpaceHash.constBegin();
+ while (it != m_displayColorSpaceHash.constEnd()) {
+ if (it.value())
+ CFRelease(it.value());
+ ++it;
+ }
+ m_displayColorSpaceHash.clear();
+}
+
+bool qt_macWindowIsTextured(const QWidget *window)
+{
+ NSWindow *nswindow = static_cast<NSWindow*>(
+ QApplication::platformNativeInterface()->nativeResourceForWindow("NSWindow", window->windowHandle()));
+ if (!nswindow)
+ return false;
+ return ([nswindow styleMask] & NSTexturedBackgroundWindowMask) ? true : false;
+}
/*****************************************************************************
QMacCGStyle globals
@@ -467,7 +690,7 @@ inline bool qt_mac_is_metal(const QWidget *w)
if (w->testAttribute(Qt::WA_MacBrushedMetal))
return true;
if (w->isWindow() && w->testAttribute(Qt::WA_WState_Created)) { // If not created will fall through to the opaque check and be fine anyway.
- return macWindowIsTextured(qt_mac_window_for(w));
+ return qt_macWindowIsTextured(w);
}
if (w->d_func()->isOpaque)
break;
@@ -1382,7 +1605,6 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti
tdi->trackInfo.scrollbar.viewsize = slider->pageStep;
}
}
-#endif
QMacStylePrivate::QMacStylePrivate(QMacStyle *style)
: timerID(-1), progressFrame(0), q(style), mouseDown(false)
@@ -1750,8 +1972,9 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush
QPoint dummy;
const QPaintDevice *target = painter->device();
const QPaintDevice *redirected = QPainter::redirected(target, &dummy);
- const bool usePainter = redirected && redirected != target;
+ //const bool usePainter = redirected && redirected != target;
+#if 0
if (!usePainter && qt_mac_backgroundPattern
&& qt_mac_backgroundPattern->cacheKey() == brush.texture().cacheKey()) {
@@ -1772,10 +1995,11 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush
CGContextRestoreGState(cg);
} else {
+#endif
const QRect rect(rgn.boundingRect());
painter->setClipRegion(rgn);
painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
- }
+// }
}
void QMacStyle::polish(QPalette &pal)
@@ -1831,8 +2055,9 @@ void QMacStyle::polish(QWidget* w)
mtinfo.version = qt_mac_hitheme_version;
mtinfo.menuType = kThemeMenuTypePopUp;
HIRect rect = CGRectMake(0, 0, px.width(), px.height());
- HIThemeDrawMenuBackground(&rect, &mtinfo, QCFType<CGContextRef>(qt_mac_cg_context(&px)),
- kHIThemeOrientationNormal);
+ // ###
+ //HIThemeDrawMenuBackground(&rect, &mtinfo, QCFType<CGContextRef>(qt_mac_cg_context(&px)),
+ // kHIThemeOrientationNormal);
QPalette pal = w->palette();
QBrush background(px);
pal.setBrush(QPalette::All, QPalette::Window, background);
@@ -2309,11 +2534,12 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
ret = 100;
break;
case SH_ScrollBar_LeftClickAbsolutePosition: {
- extern bool qt_scrollbar_jump_to_pos; //qapplication_mac.cpp
if(QApplication::keyboardModifiers() & Qt::AltModifier)
- ret = !qt_scrollbar_jump_to_pos;
+ ret = false;
+ //ret = !qt_scrollbar_jump_to_pos;
else
- ret = qt_scrollbar_jump_to_pos;
+ ret = true;
+ //ret = qt_scrollbar_jump_to_pos;
break; }
case SH_TabBar_PreferNoArrows:
ret = true;
@@ -2547,7 +2773,8 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
mdi.menuType = kThemeMenuTypePopUp;
QCFType<HIShapeRef> shape;
HIThemeGetMenuBackgroundShape(&menuRect, &mdi, &shape);
- mask->region = QRegion::fromHIShapeRef(shape);
+
+ mask->region = qt_mac_fromHIShapeRef(shape);
}
}
break;
@@ -3404,7 +3631,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
QColor textColor = btn->palette.buttonText().color();
CGFloat colorComp[] = { textColor.redF(), textColor.greenF(),
textColor.blueF(), textColor.alphaF() };
- CGContextSetFillColorSpace(cg, QCoreGraphicsPaintEngine::macGenericColorSpace());
+ CGContextSetFillColorSpace(cg, qt_mac_genericColorSpace());
CGContextSetFillColor(cg, colorComp);
tti.fontID = themeId;
tti.horizontalFlushness = kHIThemeTextHorizontalFlushCenter;
@@ -3629,7 +3856,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
QColor textColor = myTab.palette.windowText().color();
CGFloat colorComp[] = { textColor.redF(), textColor.greenF(),
textColor.blueF(), textColor.alphaF() };
- CGContextSetFillColorSpace(cg, QCoreGraphicsPaintEngine::macGenericColorSpace());
+ CGContextSetFillColorSpace(cg, qt_mac_genericColorSpace());
CGContextSetFillColor(cg, colorComp);
switch (d->aquaSizeConstrain(opt, w)) {
default:
@@ -3810,7 +4037,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
QColor textColor = p->pen().color();
CGFloat colorComp[] = { textColor.redF(), textColor.greenF(),
textColor.blueF(), textColor.alphaF() };
- CGContextSetFillColorSpace(cg, QCoreGraphicsPaintEngine::macGenericColorSpace());
+ CGContextSetFillColorSpace(cg, qt_mac_genericColorSpace());
CGContextSetFillColor(cg, colorComp);
HIThemeTextInfo tti;
tti.version = qt_mac_hitheme_version;
@@ -4946,7 +5173,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
QColor textColor = groupBox->palette.windowText().color();
CGFloat colorComp[] = { textColor.redF(), textColor.greenF(),
textColor.blueF(), textColor.alphaF() };
- CGContextSetFillColorSpace(cg, QCoreGraphicsPaintEngine::macGenericColorSpace());
+ CGContextSetFillColorSpace(cg, qt_mac_genericColorSpace());
CGContextSetFillColor(cg, colorComp);
tti.fontID = checkable ? kThemeSystemFont : kThemeSmallSystemFont;
tti.horizontalFlushness = kHIThemeTextHorizontalFlushCenter;
@@ -6075,4 +6302,135 @@ int QMacStyle::layoutSpacingImplementation(QSizePolicy::ControlType control1,
return_SIZE(10, 8, 6); // guess
}
+void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform)
+{
+ CGAffineTransform old_xform = CGAffineTransformIdentity;
+ if (orig_xform) { //setup xforms
+ old_xform = CGContextGetCTM(hd);
+ CGContextConcatCTM(hd, CGAffineTransformInvert(old_xform));
+ CGContextConcatCTM(hd, *orig_xform);
+ }
+
+ //do the clipping
+ CGContextBeginPath(hd);
+ if (rgn.isEmpty()) {
+ CGContextAddRect(hd, CGRectMake(0, 0, 0, 0));
+ } else {
+ QCFType<HIMutableShapeRef> shape = qt_mac_toHIMutableShape(rgn);
+ Q_ASSERT(!HIShapeIsEmpty(shape));
+ HIShapeReplacePathInCGContext(shape, hd);
+ }
+ CGContextClip(hd);
+
+ if (orig_xform) {//reset xforms
+ CGContextConcatCTM(hd, CGAffineTransformInvert(CGContextGetCTM(hd)));
+ CGContextConcatCTM(hd, old_xform);
+ }
+}
+
+QMacCGContext::QMacCGContext(QPainter *p)
+{
+ QPaintEngine *pe = p->paintEngine();
+ pe->syncState();
+ context = 0;
+
+ int devType = p->device()->devType();
+ if (pe->type() == QPaintEngine::Raster
+ && (devType == QInternal::Widget ||
+ devType == QInternal::Pixmap ||
+ devType == QInternal::Image)) {
+
+ extern CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice);
+ CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pe->paintDevice());
+ uint flags = kCGImageAlphaPremultipliedFirst;
+ flags |= kCGBitmapByteOrder32Host;
+
+ const QImage *image = (const QImage *) pe->paintDevice();
+
+ context = CGBitmapContextCreate((void *) image->bits(), image->width(), image->height(),
+ 8, image->bytesPerLine(), colorspace, flags);
+
+ CGContextTranslateCTM(context, 0, image->height());
+ CGContextScaleCTM(context, 1, -1);
+
+ if (devType == QInternal::Widget) {
+ QRegion clip = p->paintEngine()->systemClip();
+ QTransform native = p->deviceTransform();
+ QTransform logical = p->combinedTransform();
+
+ if (p->hasClipping()) {
+ QRegion r = p->clipRegion();
+ r.translate(native.dx(), native.dy());
+ if (clip.isEmpty())
+ clip = r;
+ else
+ clip &= r;
+ }
+ qt_mac_clip_cg(context, clip, 0);
+
+ CGContextTranslateCTM(context, native.dx(), native.dy());
+ }
+ } else {
+ qDebug() << "QMacCGContext:: Unsupported painter devtype type" << devType;
+ }
+}
+
+CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice)
+{
+ bool isWidget = (paintDevice->devType() == QInternal::Widget);
+ return qt_mac_displayColorSpace(isWidget ? static_cast<const QWidget *>(paintDevice) : 0);
+}
+
+/*! \internal
+
+ Returns the CoreGraphics CGContextRef of the paint device. 0 is
+ returned if it can't be obtained. It is the caller's responsibility to
+ CGContextRelease the context when finished using it.
+
+ \warning This function is only available on Mac OS X.
+*/
+
+CGContextRef qt_mac_cg_context(const QPaintDevice *pdev)
+{
+ if (pdev->devType() == QInternal::Pixmap) {
+ const QPixmap *pm = static_cast<const QPixmap*>(pdev);
+ CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pdev);
+ uint flags = kCGImageAlphaPremultipliedFirst;
+ flags |= kCGBitmapByteOrder32Host;
+ CGContextRef ret = 0;
+
+ QPlatformPixmap *data = const_cast<QPixmap *>(pm)->data_ptr().data();
+ if (data->classId() == QPlatformPixmap::RasterClass) {
+ QImage *image = data->buffer();
+ ret = CGBitmapContextCreate(image->bits(), image->width(), image->height(),
+ 8, image->bytesPerLine(), colorspace, flags);
+ } else {
+ qDebug() << "qt_mac_cg_context: Unsupported pixmap class";
+ }
+
+ CGContextTranslateCTM(ret, 0, pm->height());
+ CGContextScaleCTM(ret, 1, -1);
+ return ret;
+ } else if (pdev->devType() == QInternal::Widget) {
+ //CGContextRef ret = static_cast<CGContextRef>(static_cast<const QWidget *>(pdev)->macCGHandle());
+ ///CGContextRetain(ret);
+ //return ret;
+ qDebug() << "qt_mac_cg_context: not implemented: Widget class";
+ return 0;
+ }
+ return 0;
+}
+
+/*
+FontHash::FontHash()
+{
+ QHash<QByteArray, QFont>::operator=(QGuiApplicationPrivate::platformIntegration()->fontDatabase()->defaultFonts());
+}
+
+Q_GLOBAL_STATIC(FontHash, app_fonts)
+FontHash *qt_app_fonts_hash()
+{
+ return app_fonts();
+}
+*/
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h
index 747779249c..1739a382f3 100644
--- a/src/widgets/styles/qmacstyle_mac_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -43,13 +43,13 @@
#ifndef QMACSTYLE_MAC_P_H
#define QMACSTYLE_MAC_P_H
-#include <qmacstyle_mac.h>
+#include <Carbon/Carbon.h>
+#undef check
+
+#include "qmacstyle_mac.h"
#include <private/qapplication_p.h>
#include <private/qcombobox_p.h>
-#include <private/qmacstylepixmaps_mac_p.h>
-#include <private/qpaintengine_mac_p.h>
#include <private/qpainter_p.h>
-#include <private/qprintengine_mac_p.h>
#include <private/qstylehelper_p.h>
#include <qapplication.h>
#include <qbitmap.h>
@@ -94,7 +94,8 @@
#include <qmath.h>
#include <QtWidgets/qgraphicsproxywidget.h>
#include <QtWidgets/qgraphicsview.h>
-#include <private/qt_cocoa_helpers_mac_p.h>
+
+
//
// W A R N I N G
@@ -109,21 +110,6 @@
QT_BEGIN_NAMESPACE
-#if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5)
-enum {
- kThemePushButtonTextured = 31,
- kThemePushButtonTexturedSmall = 32,
- kThemePushButtonTexturedMini = 33
-};
-
-/* Search fields */
-enum {
- kHIThemeFrameTextFieldRound = 1000,
- kHIThemeFrameTextFieldRoundSmall = 1001,
- kHIThemeFrameTextFieldRoundMini = 1002
-};
-#endif
-
/*
AHIG:
Apple Human Interface Guidelines
diff --git a/src/widgets/styles/qmacstylepixmaps_mac_p.h b/src/widgets/styles/qmacstylepixmaps_mac_p.h
index 7bd1a2b43e..3f852a63f3 100644
--- a/src/widgets/styles/qmacstylepixmaps_mac_p.h
+++ b/src/widgets/styles/qmacstylepixmaps_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qmotifstyle.cpp b/src/widgets/styles/qmotifstyle.cpp
index 46a64eb575..fc697454c1 100644
--- a/src/widgets/styles/qmotifstyle.cpp
+++ b/src/widgets/styles/qmotifstyle.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qmotifstyle.h b/src/widgets/styles/qmotifstyle.h
index 35b3448289..0aa506d2ac 100644
--- a/src/widgets/styles/qmotifstyle.h
+++ b/src/widgets/styles/qmotifstyle.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qmotifstyle_p.h b/src/widgets/styles/qmotifstyle_p.h
index 90e0c6d530..83394059e8 100644
--- a/src/widgets/styles/qmotifstyle_p.h
+++ b/src/widgets/styles/qmotifstyle_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qplastiquestyle.cpp b/src/widgets/styles/qplastiquestyle.cpp
index 65e269f800..750d0765ef 100644
--- a/src/widgets/styles/qplastiquestyle.cpp
+++ b/src/widgets/styles/qplastiquestyle.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qplastiquestyle.h b/src/widgets/styles/qplastiquestyle.h
index d0afce6cf0..837e07a75f 100644
--- a/src/widgets/styles/qplastiquestyle.h
+++ b/src/widgets/styles/qplastiquestyle.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qproxystyle.cpp b/src/widgets/styles/qproxystyle.cpp
index b41e85f31c..56e3dc56b4 100644
--- a/src/widgets/styles/qproxystyle.cpp
+++ b/src/widgets/styles/qproxystyle.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qproxystyle.h b/src/widgets/styles/qproxystyle.h
index 96c5c34f18..e5d05eb3e5 100644
--- a/src/widgets/styles/qproxystyle.h
+++ b/src/widgets/styles/qproxystyle.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qproxystyle_p.h b/src/widgets/styles/qproxystyle_p.h
index 9ccd382cd3..3dc960afcd 100644
--- a/src/widgets/styles/qproxystyle_p.h
+++ b/src/widgets/styles/qproxystyle_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index 44b8f3bc0f..e4000bef19 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h
index 6b296871d4..fcc8412414 100644
--- a/src/widgets/styles/qstyle.h
+++ b/src/widgets/styles/qstyle.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qstyle_p.h b/src/widgets/styles/qstyle_p.h
index dfb0e95731..3fd221938d 100644
--- a/src/widgets/styles/qstyle_p.h
+++ b/src/widgets/styles/qstyle_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp
index 8c1b9cb7e1..cc19a895d0 100644
--- a/src/widgets/styles/qstylefactory.cpp
+++ b/src/widgets/styles/qstylefactory.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -75,7 +75,7 @@
QT_BEGIN_NAMESPACE
-#if !defined(QT_NO_STYLE_MAC) && defined(Q_WS_MAC)
+#if !defined(QT_NO_STYLE_MAC) && defined(Q_OS_MAC)
QT_BEGIN_INCLUDE_NAMESPACE
# include "qmacstyle_mac.h"
QT_END_INCLUDE_NAMESPACE
diff --git a/src/widgets/styles/qstylefactory.h b/src/widgets/styles/qstylefactory.h
index b972c8e0e6..f98d37b26e 100644
--- a/src/widgets/styles/qstylefactory.h
+++ b/src/widgets/styles/qstylefactory.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp
index bf7cb49bcf..8f2d7364c1 100644
--- a/src/widgets/styles/qstylehelper.cpp
+++ b/src/widgets/styles/qstylehelper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -46,17 +46,13 @@
#include <private/qstyle_p.h>
#include <qmath.h>
-#if defined(Q_WS_WIN)
-#include "qt_windows.h"
-#elif defined(Q_WS_MAC)
-#include <private/qt_cocoa_helpers_mac_p.h>
-#endif
-
#include "qstylehelper_p.h"
#include <qstringbuilder.h>
QT_BEGIN_NAMESPACE
+Q_GUI_EXPORT int qt_defaultDpiX();
+
namespace QStyleHelper {
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
@@ -81,20 +77,7 @@ QString uniqueName(const QString &key, const QStyleOption *option, const QSize &
qreal dpiScaled(qreal value)
{
- static qreal scale = -1;
- if (scale < 0) {
- scale = 1.0;
-#if defined(Q_WS_WIN)
- {
- HDC hdcScreen = GetDC(0);
- int dpi = GetDeviceCaps(hdcScreen, LOGPIXELSX);
- ReleaseDC(0, hdcScreen);
- scale = dpi/96.0;
- }
-#elif defined(Q_WS_MAC)
- scale = qt_mac_get_scalefactor();
-#endif
- }
+ static const qreal scale = qreal(qt_defaultDpiX()) / 96.0;
return value * scale;
}
diff --git a/src/widgets/styles/qstylehelper_p.h b/src/widgets/styles/qstylehelper_p.h
index f2bb81929c..a193e2ec78 100644
--- a/src/widgets/styles/qstylehelper_p.h
+++ b/src/widgets/styles/qstylehelper_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index 01e3f0e384..0e4a1e98f8 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h
index 0640eef606..56203a6615 100644
--- a/src/widgets/styles/qstyleoption.h
+++ b/src/widgets/styles/qstyleoption.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qstylepainter.cpp b/src/widgets/styles/qstylepainter.cpp
index 3dc3f9dce7..9870f01dd0 100644
--- a/src/widgets/styles/qstylepainter.cpp
+++ b/src/widgets/styles/qstylepainter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qstylepainter.h b/src/widgets/styles/qstylepainter.h
index ccb591c0f9..56c6684507 100644
--- a/src/widgets/styles/qstylepainter.h
+++ b/src/widgets/styles/qstylepainter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qstyleplugin.cpp b/src/widgets/styles/qstyleplugin.cpp
index 836f388c23..8a169d9797 100644
--- a/src/widgets/styles/qstyleplugin.cpp
+++ b/src/widgets/styles/qstyleplugin.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qstyleplugin.h b/src/widgets/styles/qstyleplugin.h
index ab55cdf54c..c9a35caaa4 100644
--- a/src/widgets/styles/qstyleplugin.h
+++ b/src/widgets/styles/qstyleplugin.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index ab611aedde..b384ff7681 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qstylesheetstyle_default.cpp b/src/widgets/styles/qstylesheetstyle_default.cpp
index c9cfc435fa..580232f326 100644
--- a/src/widgets/styles/qstylesheetstyle_default.cpp
+++ b/src/widgets/styles/qstylesheetstyle_default.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qstylesheetstyle_p.h b/src/widgets/styles/qstylesheetstyle_p.h
index 1d38627edf..2d89f784d4 100644
--- a/src/widgets/styles/qstylesheetstyle_p.h
+++ b/src/widgets/styles/qstylesheetstyle_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qwindowscestyle.cpp b/src/widgets/styles/qwindowscestyle.cpp
index 39174f9855..fd3a391e54 100644
--- a/src/widgets/styles/qwindowscestyle.cpp
+++ b/src/widgets/styles/qwindowscestyle.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qwindowscestyle.h b/src/widgets/styles/qwindowscestyle.h
index 3db9be58e2..dbb83a910e 100644
--- a/src/widgets/styles/qwindowscestyle.h
+++ b/src/widgets/styles/qwindowscestyle.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qwindowscestyle_p.h b/src/widgets/styles/qwindowscestyle_p.h
index d32ac99d52..6b3b9a8bfe 100644
--- a/src/widgets/styles/qwindowscestyle_p.h
+++ b/src/widgets/styles/qwindowscestyle_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qwindowsmobilestyle.cpp b/src/widgets/styles/qwindowsmobilestyle.cpp
index 1e029a30e0..efba73fe80 100644
--- a/src/widgets/styles/qwindowsmobilestyle.cpp
+++ b/src/widgets/styles/qwindowsmobilestyle.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qwindowsmobilestyle.h b/src/widgets/styles/qwindowsmobilestyle.h
index 050f641888..65eb08707f 100644
--- a/src/widgets/styles/qwindowsmobilestyle.h
+++ b/src/widgets/styles/qwindowsmobilestyle.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qwindowsmobilestyle_p.h b/src/widgets/styles/qwindowsmobilestyle_p.h
index 32ebe911ef..23b395e3a6 100644
--- a/src/widgets/styles/qwindowsmobilestyle_p.h
+++ b/src/widgets/styles/qwindowsmobilestyle_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index f883ace67e..1029433fe6 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -392,16 +392,9 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
break;
#endif
case PM_MaximumDragDistance:
-#if defined(Q_OS_WIN)
- {
- HDC hdcScreen = GetDC(0);
- int dpi = GetDeviceCaps(hdcScreen, LOGPIXELSX);
- ReleaseDC(0, hdcScreen);
- ret = (int)(dpi * 1.375);
- }
-#else
- ret = 60;
-#endif
+ ret = QCommonStyle::pixelMetric(PM_MaximumDragDistance);
+ if (ret == -1)
+ ret = 60;
break;
#ifndef QT_NO_SLIDER
@@ -530,13 +523,6 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
ret = GetSystemMetrics(SM_CYFRAME);
#endif
break;
- case PM_TextCursorWidth: {
- DWORD caretWidth = 1;
-#if defined(SPI_GETCARETWIDTH)
- SystemParametersInfo(SPI_GETCARETWIDTH, 0, &caretWidth, 0);
-#endif
- ret = (int)caretWidth;
- break; }
#endif
case PM_ToolBarItemMargin:
ret = 1;
diff --git a/src/widgets/styles/qwindowsstyle.h b/src/widgets/styles/qwindowsstyle.h
index acecfa9140..5392409882 100644
--- a/src/widgets/styles/qwindowsstyle.h
+++ b/src/widgets/styles/qwindowsstyle.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qwindowsstyle_p.h b/src/widgets/styles/qwindowsstyle_p.h
index 1e517e9e79..9861172873 100644
--- a/src/widgets/styles/qwindowsstyle_p.h
+++ b/src/widgets/styles/qwindowsstyle_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index d83ad855c2..bbc07a5bd9 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qwindowsvistastyle.h b/src/widgets/styles/qwindowsvistastyle.h
index 68b489107e..dec8f16aee 100644
--- a/src/widgets/styles/qwindowsvistastyle.h
+++ b/src/widgets/styles/qwindowsvistastyle.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qwindowsvistastyle_p.h b/src/widgets/styles/qwindowsvistastyle_p.h
index 4167bc4d0f..8ed2ec421e 100644
--- a/src/widgets/styles/qwindowsvistastyle_p.h
+++ b/src/widgets/styles/qwindowsvistastyle_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index 8b13794d05..d8b33f3b0f 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qwindowsxpstyle.h b/src/widgets/styles/qwindowsxpstyle.h
index 1cfd16479b..87bccc2271 100644
--- a/src/widgets/styles/qwindowsxpstyle.h
+++ b/src/widgets/styles/qwindowsxpstyle.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/qwindowsxpstyle_p.h b/src/widgets/styles/qwindowsxpstyle_p.h
index 05ab2ec2e4..1fb89cb478 100644
--- a/src/widgets/styles/qwindowsxpstyle_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri
index cf7ee5a0a4..ef6827f74f 100644
--- a/src/widgets/styles/styles.pri
+++ b/src/widgets/styles/styles.pri
@@ -37,8 +37,7 @@ contains( styles, all ) {
styles = mac windows windowsxp windowsvista
}
-# TODO, re-enable qmacstyle in tests/auto/widgets/styles/sytles.pro when done
-styles -= mac
+!macx-*:styles -= mac
x11{
QMAKE_CXXFLAGS += $$QT_CFLAGS_QGTKSTYLE
diff --git a/src/widgets/util/qcolormap.h b/src/widgets/util/qcolormap.h
index ebb5142768..c0c3643985 100644
--- a/src/widgets/util/qcolormap.h
+++ b/src/widgets/util/qcolormap.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qcolormap.qdoc b/src/widgets/util/qcolormap.qdoc
index 88deabcfd6..fd6da862ec 100644
--- a/src/widgets/util/qcolormap.qdoc
+++ b/src/widgets/util/qcolormap.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qcolormap_qpa.cpp b/src/widgets/util/qcolormap_qpa.cpp
index 6ad3abb3aa..284809af24 100644
--- a/src/widgets/util/qcolormap_qpa.cpp
+++ b/src/widgets/util/qcolormap_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index e99dd9ffc5..aa38aba08e 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -147,7 +147,7 @@
#ifndef QT_NO_COMPLETER
#include "QtWidgets/qscrollbar.h"
-#include "QtWidgets/qstringlistmodel.h"
+#include "QtCore/qstringlistmodel.h"
#include "QtWidgets/qdirmodel.h"
#include "QtWidgets/qfilesystemmodel.h"
#include "QtWidgets/qheaderview.h"
diff --git a/src/widgets/util/qcompleter.h b/src/widgets/util/qcompleter.h
index c7e1b6e945..68fe22f88f 100644
--- a/src/widgets/util/qcompleter.h
+++ b/src/widgets/util/qcompleter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h
index 639c875568..94287c1ebf 100644
--- a/src/widgets/util/qcompleter_p.h
+++ b/src/widgets/util/qcompleter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -59,7 +59,7 @@
#ifndef QT_NO_COMPLETER
#include "QtWidgets/qtreeview.h"
-#include "QtWidgets/qabstractproxymodel.h"
+#include "QtCore/qabstractproxymodel.h"
#include "qcompleter.h"
#include "QtWidgets/qitemdelegate.h"
#include "QtGui/qpainter.h"
diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp
index fbbefcf89f..843a2fa95c 100644
--- a/src/widgets/util/qflickgesture.cpp
+++ b/src/widgets/util/qflickgesture.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qflickgesture_p.h b/src/widgets/util/qflickgesture_p.h
index 23c8b6e788..6a9630ede6 100644
--- a/src/widgets/util/qflickgesture_p.h
+++ b/src/widgets/util/qflickgesture_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp
index 2ab19c40ab..fac6809ac6 100644
--- a/src/widgets/util/qscroller.cpp
+++ b/src/widgets/util/qscroller.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1524,10 +1524,8 @@ void QScrollerPrivate::handleDrag(const QPointF &position, qint64 timestamp)
dragDistance += deltaPixel;
// }
//qScrollerDebug() << "######################" << deltaPixel << position.y() << lastPosition.y();
- if (canScrollX)
- lastPosition.setX(position.x());
- if (canScrollY)
- lastPosition.setY(position.y());
+
+ lastPosition = position;
lastTimestamp = timestamp;
}
diff --git a/src/widgets/util/qscroller.h b/src/widgets/util/qscroller.h
index 3484139cbb..01d45a908e 100644
--- a/src/widgets/util/qscroller.h
+++ b/src/widgets/util/qscroller.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qscroller_mac.mm b/src/widgets/util/qscroller_mac.mm
index 81d18aaf6b..495469a04b 100644
--- a/src/widgets/util/qscroller_mac.mm
+++ b/src/widgets/util/qscroller_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qscroller_p.h b/src/widgets/util/qscroller_p.h
index b4f4db5e34..3b9fa988fe 100644
--- a/src/widgets/util/qscroller_p.h
+++ b/src/widgets/util/qscroller_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qscrollerproperties.cpp b/src/widgets/util/qscrollerproperties.cpp
index dda83c2b33..3a41aa7eb9 100644
--- a/src/widgets/util/qscrollerproperties.cpp
+++ b/src/widgets/util/qscrollerproperties.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qscrollerproperties.h b/src/widgets/util/qscrollerproperties.h
index 73c1125fe0..e7bcdbebe3 100644
--- a/src/widgets/util/qscrollerproperties.h
+++ b/src/widgets/util/qscrollerproperties.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qscrollerproperties_p.h b/src/widgets/util/qscrollerproperties_p.h
index 2e57a3f7dd..8c51f7aa4b 100644
--- a/src/widgets/util/qscrollerproperties_p.h
+++ b/src/widgets/util/qscrollerproperties_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index 3ca5d459a7..5803c2fef4 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qsystemtrayicon.h b/src/widgets/util/qsystemtrayicon.h
index 3327ce4223..0f1e7d74ee 100644
--- a/src/widgets/util/qsystemtrayicon.h
+++ b/src/widgets/util/qsystemtrayicon.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qsystemtrayicon_mac.mm b/src/widgets/util/qsystemtrayicon_mac.mm
index 5553c63723..278fa72a1a 100644
--- a/src/widgets/util/qsystemtrayicon_mac.mm
+++ b/src/widgets/util/qsystemtrayicon_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qsystemtrayicon_p.h b/src/widgets/util/qsystemtrayicon_p.h
index ce2404ae8b..7b743021e0 100644
--- a/src/widgets/util/qsystemtrayicon_p.h
+++ b/src/widgets/util/qsystemtrayicon_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qsystemtrayicon_qpa.cpp b/src/widgets/util/qsystemtrayicon_qpa.cpp
index 9a4f12d02d..ce0e067648 100644
--- a/src/widgets/util/qsystemtrayicon_qpa.cpp
+++ b/src/widgets/util/qsystemtrayicon_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp
index 7a572849b0..6045116da5 100644
--- a/src/widgets/util/qsystemtrayicon_win.cpp
+++ b/src/widgets/util/qsystemtrayicon_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qsystemtrayicon_wince.cpp b/src/widgets/util/qsystemtrayicon_wince.cpp
index 7a403a3ee5..b1dbb8b85e 100644
--- a/src/widgets/util/qsystemtrayicon_wince.cpp
+++ b/src/widgets/util/qsystemtrayicon_wince.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp
index 86c27499b4..3ac3755f84 100644
--- a/src/widgets/util/qsystemtrayicon_x11.cpp
+++ b/src/widgets/util/qsystemtrayicon_x11.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qundogroup.cpp b/src/widgets/util/qundogroup.cpp
index 44c00afe98..fd063b7e9f 100644
--- a/src/widgets/util/qundogroup.cpp
+++ b/src/widgets/util/qundogroup.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qundogroup.h b/src/widgets/util/qundogroup.h
index ce2dac2503..fe06a678eb 100644
--- a/src/widgets/util/qundogroup.h
+++ b/src/widgets/util/qundogroup.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp
index 9841a09ce6..5f2ba870e0 100644
--- a/src/widgets/util/qundostack.cpp
+++ b/src/widgets/util/qundostack.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qundostack.h b/src/widgets/util/qundostack.h
index 493d11fdb7..fc2c82ecf4 100644
--- a/src/widgets/util/qundostack.h
+++ b/src/widgets/util/qundostack.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qundostack_p.h b/src/widgets/util/qundostack_p.h
index 1e5f99bc6c..31dff8452c 100644
--- a/src/widgets/util/qundostack_p.h
+++ b/src/widgets/util/qundostack_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qundoview.cpp b/src/widgets/util/qundoview.cpp
index c95e89f76e..c498355f1f 100644
--- a/src/widgets/util/qundoview.cpp
+++ b/src/widgets/util/qundoview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/util/qundoview.h b/src/widgets/util/qundoview.h
index 9df2995f9d..ee944dd259 100644
--- a/src/widgets/util/qundoview.h
+++ b/src/widgets/util/qundoview.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp
index ae5b06024a..efe0ff3389 100644
--- a/src/widgets/widgets/qabstractbutton.cpp
+++ b/src/widgets/widgets/qabstractbutton.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qabstractbutton.h b/src/widgets/widgets/qabstractbutton.h
index 6527c6cd32..9b3aa5642a 100644
--- a/src/widgets/widgets/qabstractbutton.h
+++ b/src/widgets/widgets/qabstractbutton.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qabstractbutton_p.h b/src/widgets/widgets/qabstractbutton_p.h
index d2d4c06bff..9688d27773 100644
--- a/src/widgets/widgets/qabstractbutton_p.h
+++ b/src/widgets/widgets/qabstractbutton_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp
index 801160d080..655ed83069 100644
--- a/src/widgets/widgets/qabstractscrollarea.cpp
+++ b/src/widgets/widgets/qabstractscrollarea.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -572,7 +572,7 @@ void QAbstractScrollArea::setViewport(QWidget *widget)
d->layoutChildren();
if (isVisible())
d->viewport->show();
- QMetaObject::invokeMethod(this, "setupViewport", Q_ARG(QWidget *, widget));
+ setupViewport(widget);
delete oldViewport;
}
}
diff --git a/src/widgets/widgets/qabstractscrollarea.h b/src/widgets/widgets/qabstractscrollarea.h
index 3f2a273297..fe602468f9 100644
--- a/src/widgets/widgets/qabstractscrollarea.h
+++ b/src/widgets/widgets/qabstractscrollarea.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -90,8 +90,7 @@ public:
QSize sizeHint() const;
-protected Q_SLOTS:
- void setupViewport(QWidget *viewport);
+ virtual void setupViewport(QWidget *viewport);
protected:
QAbstractScrollArea(QAbstractScrollAreaPrivate &dd, QWidget *parent = 0);
diff --git a/src/widgets/widgets/qabstractscrollarea_p.h b/src/widgets/widgets/qabstractscrollarea_p.h
index 5511d08f4e..2fe7e4423a 100644
--- a/src/widgets/widgets/qabstractscrollarea_p.h
+++ b/src/widgets/widgets/qabstractscrollarea_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp
index 694db0e125..d3dddde409 100644
--- a/src/widgets/widgets/qabstractslider.cpp
+++ b/src/widgets/widgets/qabstractslider.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -943,60 +943,4 @@ bool QAbstractSlider::event(QEvent *e)
return QWidget::event(e);
}
-/*! \fn int QAbstractSlider::minValue() const
-
- Use minimum() instead.
-*/
-
-/*! \fn int QAbstractSlider::maxValue() const
-
- Use maximum() instead.
-*/
-
-/*! \fn int QAbstractSlider::lineStep() const
-
- Use singleStep() instead.
-*/
-
-/*! \fn void QAbstractSlider::setMinValue(int v)
-
- Use setMinimum() instead.
-*/
-
-/*! \fn void QAbstractSlider::setMaxValue(int v)
-
- Use setMaximum() instead.
-*/
-
-/*! \fn void QAbstractSlider::setLineStep(int v)
-
- Use setSingleStep() instead.
-*/
-
-/*! \fn void QAbstractSlider::addPage()
-
- Use triggerAction(QAbstractSlider::SliderPageStepAdd) instead.
-*/
-
-/*! \fn void QAbstractSlider::subtractPage()
-
- Use triggerAction(QAbstractSlider::SliderPageStepSub) instead.
-*/
-
-/*! \fn void QAbstractSlider::addLine()
-
- Use triggerAction(QAbstractSlider::SliderSingleStepAdd) instead.
-*/
-
-/*! \fn void QAbstractSlider::subtractLine()
-
- Use triggerAction(QAbstractSlider::SliderSingleStepSub) instead.
-*/
-
-/*! \fn void QAbstractSlider::setSteps(int single, int page)
-
- Use setSingleStep(\a single) followed by setPageStep(\a page)
- instead.
-*/
-
QT_END_NAMESPACE
diff --git a/src/widgets/widgets/qabstractslider.h b/src/widgets/widgets/qabstractslider.h
index b1f63a2c89..a19fc37451 100644
--- a/src/widgets/widgets/qabstractslider.h
+++ b/src/widgets/widgets/qabstractslider.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qabstractslider_p.h b/src/widgets/widgets/qabstractslider_p.h
index fdbc0f9534..a4589c5d18 100644
--- a/src/widgets/widgets/qabstractslider_p.h
+++ b/src/widgets/widgets/qabstractslider_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index 82340d15ed..4f5a135842 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -48,6 +48,7 @@
#ifndef QT_NO_SPINBOX
#include <qapplication.h>
+#include <qstylehints.h>
#include <qclipboard.h>
#include <qdatetime.h>
#include <qdatetimeedit.h>
@@ -1169,15 +1170,6 @@ void QAbstractSpinBox::hideEvent(QHideEvent *event)
Remember that time value should be given in msecs.
*/
-static int getKeyboardAutoRepeatRate() {
- int ret = 30;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- DWORD time;
- if (SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &time, 0) != FALSE)
- ret = static_cast<int>(1000 / static_cast<int>(time)); // msecs
-#endif
- return ret; // msecs
-}
/*!
\reimp
@@ -1192,7 +1184,7 @@ void QAbstractSpinBox::timerEvent(QTimerEvent *event)
killTimer(d->spinClickThresholdTimerId);
d->spinClickThresholdTimerId = -1;
d->effectiveSpinRepeatRate = d->buttonState & Keyboard
- ? getKeyboardAutoRepeatRate()
+ ? qApp->styleHints()->keyboardAutoRepeatRate()
: d->spinClickTimerInterval;
d->spinClickTimerId = startTimer(d->effectiveSpinRepeatRate);
doStep = true;
diff --git a/src/widgets/widgets/qabstractspinbox.h b/src/widgets/widgets/qabstractspinbox.h
index fb3ae2f5ee..8f963dce0d 100644
--- a/src/widgets/widgets/qabstractspinbox.h
+++ b/src/widgets/widgets/qabstractspinbox.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qabstractspinbox_p.h b/src/widgets/widgets/qabstractspinbox_p.h
index 33d4e32875..67a09622a2 100644
--- a/src/widgets/widgets/qabstractspinbox_p.h
+++ b/src/widgets/widgets/qabstractspinbox_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp
index 101488a359..992c542674 100644
--- a/src/widgets/widgets/qbuttongroup.cpp
+++ b/src/widgets/widgets/qbuttongroup.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -258,13 +258,3 @@
\sa setId()
*/
-
-/*! \fn void QButtonGroup::insert(QAbstractButton *b)
-
- Use addButton() instead.
-*/
-
-/*! \fn void QButtonGroup::remove(QAbstractButton *b)
-
- Use removeButton() instead.
-*/
diff --git a/src/widgets/widgets/qbuttongroup.h b/src/widgets/widgets/qbuttongroup.h
index 56f93c0332..17c60e9609 100644
--- a/src/widgets/widgets/qbuttongroup.h
+++ b/src/widgets/widgets/qbuttongroup.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qcalendartextnavigator_p.h b/src/widgets/widgets/qcalendartextnavigator_p.h
index b602c6d51e..2ce5233cec 100644
--- a/src/widgets/widgets/qcalendartextnavigator_p.h
+++ b/src/widgets/widgets/qcalendartextnavigator_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index f16a594953..3bd1e3ec4f 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qcalendarwidget.h b/src/widgets/widgets/qcalendarwidget.h
index e73192c12d..1ab519386e 100644
--- a/src/widgets/widgets/qcalendarwidget.h
+++ b/src/widgets/widgets/qcalendarwidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp
index cd49747f8c..386bd2b169 100644
--- a/src/widgets/widgets/qcheckbox.cpp
+++ b/src/widgets/widgets/qcheckbox.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qcheckbox.h b/src/widgets/widgets/qcheckbox.h
index d9a1aaaf3d..37461f1f10 100644
--- a/src/widgets/widgets/qcheckbox.h
+++ b/src/widgets/widgets/qcheckbox.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qcocoatoolbardelegate_mac.mm b/src/widgets/widgets/qcocoatoolbardelegate_mac.mm
index c6be7f131c..1127d01b19 100644
--- a/src/widgets/widgets/qcocoatoolbardelegate_mac.mm
+++ b/src/widgets/widgets/qcocoatoolbardelegate_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qcocoatoolbardelegate_mac_p.h b/src/widgets/widgets/qcocoatoolbardelegate_mac_p.h
index 846c6933d8..56a4f4f062 100644
--- a/src/widgets/widgets/qcocoatoolbardelegate_mac_p.h
+++ b/src/widgets/widgets/qcocoatoolbardelegate_mac_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 2764833b48..4cbd7eab7d 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h
index e297dae1b5..4a5050b945 100644
--- a/src/widgets/widgets/qcombobox.h
+++ b/src/widgets/widgets/qcombobox.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h
index 2d3f261d6e..a9d792f07d 100644
--- a/src/widgets/widgets/qcombobox_p.h
+++ b/src/widgets/widgets/qcombobox_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qcommandlinkbutton.cpp b/src/widgets/widgets/qcommandlinkbutton.cpp
index afd14f63c5..d61eeb6131 100644
--- a/src/widgets/widgets/qcommandlinkbutton.cpp
+++ b/src/widgets/widgets/qcommandlinkbutton.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qcommandlinkbutton.h b/src/widgets/widgets/qcommandlinkbutton.h
index 9d01e37b1b..726e0360d2 100644
--- a/src/widgets/widgets/qcommandlinkbutton.h
+++ b/src/widgets/widgets/qcommandlinkbutton.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index f6b52658c7..871a394a80 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h
index a57a5f29e9..77c76c483e 100644
--- a/src/widgets/widgets/qdatetimeedit.h
+++ b/src/widgets/widgets/qdatetimeedit.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h
index 57799d5bc0..0669c7c330 100644
--- a/src/widgets/widgets/qdatetimeedit_p.h
+++ b/src/widgets/widgets/qdatetimeedit_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qdial.cpp b/src/widgets/widgets/qdial.cpp
index bc77faf993..26cea362c2 100644
--- a/src/widgets/widgets/qdial.cpp
+++ b/src/widgets/widgets/qdial.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -488,24 +488,6 @@ bool QDial::event(QEvent *e)
return QAbstractSlider::event(e);
}
-/*!
- \fn void QDial::dialPressed();
-
- Use QAbstractSlider::sliderPressed() instead.
-*/
-
-/*!
- \fn void QDial::dialMoved(int value);
-
- Use QAbstractSlider::sliderMoved() instead.
-*/
-
-/*!
- \fn void QDial::dialReleased();
-
- Use QAbstractSlider::sliderReleased() instead.
-*/
-
QT_END_NAMESPACE
#endif // QT_NO_DIAL
diff --git a/src/widgets/widgets/qdial.h b/src/widgets/widgets/qdial.h
index 317a50df35..724028d129 100644
--- a/src/widgets/widgets/qdial.h
+++ b/src/widgets/widgets/qdial.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index 8085369a3f..e53bd55129 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qdialogbuttonbox.h b/src/widgets/widgets/qdialogbuttonbox.h
index 0a6e231e3f..2fca5a5791 100644
--- a/src/widgets/widgets/qdialogbuttonbox.h
+++ b/src/widgets/widgets/qdialogbuttonbox.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index 1a1f16a493..1acd93ed60 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qdockarealayout_p.h b/src/widgets/widgets/qdockarealayout_p.h
index a341ad487b..46ac966798 100644
--- a/src/widgets/widgets/qdockarealayout_p.h
+++ b/src/widgets/widgets/qdockarealayout_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index c02c13fe1e..32a73c54ed 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qdockwidget.h b/src/widgets/widgets/qdockwidget.h
index cc81db2fc2..d6270e4a99 100644
--- a/src/widgets/widgets/qdockwidget.h
+++ b/src/widgets/widgets/qdockwidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qdockwidget_p.h b/src/widgets/widgets/qdockwidget_p.h
index 4d3c4f4d70..2bf50d8aa6 100644
--- a/src/widgets/widgets/qdockwidget_p.h
+++ b/src/widgets/widgets/qdockwidget_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp
index adf1cc1f87..ab04e2314f 100644
--- a/src/widgets/widgets/qeffects.cpp
+++ b/src/widgets/widgets/qeffects.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qeffects_p.h b/src/widgets/widgets/qeffects_p.h
index bae2bbf54a..e26810835e 100644
--- a/src/widgets/widgets/qeffects_p.h
+++ b/src/widgets/widgets/qeffects_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qfocusframe.cpp b/src/widgets/widgets/qfocusframe.cpp
index 86187c2c4a..62dc8b64f2 100644
--- a/src/widgets/widgets/qfocusframe.cpp
+++ b/src/widgets/widgets/qfocusframe.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -147,7 +147,7 @@ void QFocusFrame::initStyleOption(QStyleOption *option) const
The focus frame will not monitor \a parent for updates but rather
can be placed manually or by using QFocusFrame::setWidget. A
QFocusFrame sets Qt::WA_NoChildEventsForParent attribute; as a
- result the parent will not receive a QEvent::ChildInserted event,
+ result the parent will not receive a QEvent::ChildAdded event,
this will make it possible to manually set the geometry of the
QFocusFrame inside of a QSplitter or other child event monitoring
widget.
diff --git a/src/widgets/widgets/qfocusframe.h b/src/widgets/widgets/qfocusframe.h
index f4f1d1c854..ed117ddd6c 100644
--- a/src/widgets/widgets/qfocusframe.h
+++ b/src/widgets/widgets/qfocusframe.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp
index 9090230029..845f37ccf1 100644
--- a/src/widgets/widgets/qfontcombobox.cpp
+++ b/src/widgets/widgets/qfontcombobox.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qfontcombobox.h b/src/widgets/widgets/qfontcombobox.h
index b0007207da..33eec561af 100644
--- a/src/widgets/widgets/qfontcombobox.h
+++ b/src/widgets/widgets/qfontcombobox.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qframe.cpp b/src/widgets/widgets/qframe.cpp
index e017513541..d0de825467 100644
--- a/src/widgets/widgets/qframe.cpp
+++ b/src/widgets/widgets/qframe.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qframe.h b/src/widgets/widgets/qframe.h
index 4e11a6289b..51cd391185 100644
--- a/src/widgets/widgets/qframe.h
+++ b/src/widgets/widgets/qframe.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qframe_p.h b/src/widgets/widgets/qframe_p.h
index 8825abaf92..a74780fa60 100644
--- a/src/widgets/widgets/qframe_p.h
+++ b/src/widgets/widgets/qframe_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp
index c850021bdd..1bad9a5b56 100644
--- a/src/widgets/widgets/qgroupbox.cpp
+++ b/src/widgets/widgets/qgroupbox.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qgroupbox.h b/src/widgets/widgets/qgroupbox.h
index a4e2327267..70bc4cde38 100644
--- a/src/widgets/widgets/qgroupbox.h
+++ b/src/widgets/widgets/qgroupbox.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp
index 2f0f43fbf4..1503085661 100644
--- a/src/widgets/widgets/qlabel.cpp
+++ b/src/widgets/widgets/qlabel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qlabel.h b/src/widgets/widgets/qlabel.h
index e249c2d876..5d61cafab0 100644
--- a/src/widgets/widgets/qlabel.h
+++ b/src/widgets/widgets/qlabel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qlabel_p.h b/src/widgets/widgets/qlabel_p.h
index b6f2db6a25..8de0e301fd 100644
--- a/src/widgets/widgets/qlabel_p.h
+++ b/src/widgets/widgets/qlabel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp
index 1b5fbe3417..48836a52d7 100644
--- a/src/widgets/widgets/qlcdnumber.cpp
+++ b/src/widgets/widgets/qlcdnumber.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qlcdnumber.h b/src/widgets/widgets/qlcdnumber.h
index 6af2b185ea..fcea53ef28 100644
--- a/src/widgets/widgets/qlcdnumber.h
+++ b/src/widgets/widgets/qlcdnumber.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index 4dc30d6542..5714052059 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -68,10 +68,6 @@
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif
-#ifndef QT_NO_IM
-#include "qinputcontext.h"
-#include "qlist.h"
-#endif
#include "qabstractitemview.h"
#include "private/qstylesheetstyle_p.h"
@@ -490,9 +486,9 @@ void QLineEdit::setEchoMode(EchoMode mode)
imHints &= ~Qt::ImhHiddenText;
}
if (mode != Normal) {
- imHints |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
+ imHints |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
} else {
- imHints &= ~(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
+ imHints &= ~(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
}
setInputMethodHints(imHints);
d->control->setEchoMode(mode);
@@ -2062,15 +2058,6 @@ QMenu *QLineEdit::createStandardContextMenu()
d->selectAllAction = action;
connect(action, SIGNAL(triggered()), SLOT(selectAll()));
-#if !defined(QT_NO_IM)
- QInputContext *qic = inputContext();
- if (qic) {
- QList<QAction *> imActions = qic->actions();
- for (int i = 0; i < imActions.size(); ++i)
- popup->addAction(imActions.at(i));
- }
-#endif
-
#if defined(Q_WS_WIN) || defined(Q_WS_X11)
if (!d->control->isReadOnly() && qt_use_rtl_extensions) {
#else
diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h
index 107710eccc..2daa893b3b 100644
--- a/src/widgets/widgets/qlineedit.h
+++ b/src/widgets/widgets/qlineedit.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index b17651e1d3..c54f60f62e 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -51,7 +51,7 @@
#include "qaccessible.h"
#endif
#ifndef QT_NO_IM
-#include "qinputcontext.h"
+#include "qinputpanel.h"
#include "qlist.h"
#endif
@@ -249,23 +249,22 @@ void QLineEditPrivate::resetInputPanel()
/*!
This function is not intended as polymorphic usage. Just a shared code
- fragment that calls QInputContext::mouseHandler for this
+ fragment that calls QInputPanel::invokeAction for this
class.
*/
bool QLineEditPrivate::sendMouseEventToInputContext( QMouseEvent *e )
{
#if !defined QT_NO_IM
- Q_Q(QLineEdit);
if ( control->composeMode() ) {
int tmp_cursor = xToPos(e->pos().x());
int mousePos = tmp_cursor - control->cursor();
if ( mousePos < 0 || mousePos > control->preeditAreaText().length() )
mousePos = -1;
- QInputContext *qic = q->inputContext();
- if (qic && mousePos >= 0) {
- // may be causing reset() in some input methods
- qic->mouseHandler(mousePos, e);
+ if (mousePos >= 0) {
+ if (e->type() == QEvent::MouseButtonRelease)
+ qApp->inputPanel()->invokeAction(QInputPanel::Click, mousePos);
+
return true;
}
}
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h
index 076f2fcf11..206e835a74 100644
--- a/src/widgets/widgets/qlineedit_p.h
+++ b/src/widgets/widgets/qlineedit_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.h b/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
index 48eac4f490..8824fde912 100644
--- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
+++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
index b79ee3d4e0..8facb4db61 100644
--- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
+++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmacnativewidget_mac.h b/src/widgets/widgets/qmacnativewidget_mac.h
index 935feac58e..2b4d4fbdae 100644
--- a/src/widgets/widgets/qmacnativewidget_mac.h
+++ b/src/widgets/widgets/qmacnativewidget_mac.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmacnativewidget_mac.mm b/src/widgets/widgets/qmacnativewidget_mac.mm
index 08f78158ee..925ef3d8a9 100644
--- a/src/widgets/widgets/qmacnativewidget_mac.mm
+++ b/src/widgets/widgets/qmacnativewidget_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index 014700f389..ad1890a708 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmainwindow.h b/src/widgets/widgets/qmainwindow.h
index 88cff31841..43d269ef6f 100644
--- a/src/widgets/widgets/qmainwindow.h
+++ b/src/widgets/widgets/qmainwindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index ebabf2d93c..32d893630f 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmainwindowlayout_mac.mm b/src/widgets/widgets/qmainwindowlayout_mac.mm
index ba5d1d5673..b6fcca88fa 100644
--- a/src/widgets/widgets/qmainwindowlayout_mac.mm
+++ b/src/widgets/widgets/qmainwindowlayout_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h
index 9d3f127158..34d94119ad 100644
--- a/src/widgets/widgets/qmainwindowlayout_p.h
+++ b/src/widgets/widgets/qmainwindowlayout_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index f66c71315a..021af9be0b 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmdiarea.h b/src/widgets/widgets/qmdiarea.h
index f1ffb29e53..fbd07ad249 100644
--- a/src/widgets/widgets/qmdiarea.h
+++ b/src/widgets/widgets/qmdiarea.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmdiarea_p.h b/src/widgets/widgets/qmdiarea_p.h
index 18a022d7dd..e80c6b5ecb 100644
--- a/src/widgets/widgets/qmdiarea_p.h
+++ b/src/widgets/widgets/qmdiarea_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index 7fd2bd2a58..f2190313e9 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmdisubwindow.h b/src/widgets/widgets/qmdisubwindow.h
index 88074c7ca5..332619c3b4 100644
--- a/src/widgets/widgets/qmdisubwindow.h
+++ b/src/widgets/widgets/qmdisubwindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmdisubwindow_p.h b/src/widgets/widgets/qmdisubwindow_p.h
index d04a7d4b75..83a91fb39b 100644
--- a/src/widgets/widgets/qmdisubwindow_p.h
+++ b/src/widgets/widgets/qmdisubwindow_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index b8ba2cdf5d..a255b840dc 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -500,7 +500,7 @@ void QMenuPrivate::hideMenu(QMenu *menu, bool justRegister)
menu->blockSignals(false);
#endif // QT_NO_EFFECTS
if (!justRegister)
- menu->hide();
+ menu->close();
}
void QMenuPrivate::popupAction(QAction *action, int delay, bool activateFirst)
diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h
index 49bf8295ec..645a15bdc8 100644
--- a/src/widgets/widgets/qmenu.h
+++ b/src/widgets/widgets/qmenu.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index df15512b3e..a6e700b528 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmenu_wince.cpp b/src/widgets/widgets/qmenu_wince.cpp
index b0c6c1bd12..26a9302efb 100644
--- a/src/widgets/widgets/qmenu_wince.cpp
+++ b/src/widgets/widgets/qmenu_wince.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmenu_wince_resource_p.h b/src/widgets/widgets/qmenu_wince_resource_p.h
index 42de05f319..b40a9526e5 100644
--- a/src/widgets/widgets/qmenu_wince_resource_p.h
+++ b/src/widgets/widgets/qmenu_wince_resource_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index 1ceea3e78c..2908d4723e 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h
index 0eb668e373..84fb378064 100644
--- a/src/widgets/widgets/qmenubar.h
+++ b/src/widgets/widgets/qmenubar.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h
index e9201fc877..de1ab37a19 100644
--- a/src/widgets/widgets/qmenubar_p.h
+++ b/src/widgets/widgets/qmenubar_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index 98a8999a98..9f92406a04 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qplaintextedit.h b/src/widgets/widgets/qplaintextedit.h
index d5fa71bbb7..9860914b98 100644
--- a/src/widgets/widgets/qplaintextedit.h
+++ b/src/widgets/widgets/qplaintextedit.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qplaintextedit_p.h b/src/widgets/widgets/qplaintextedit_p.h
index 190156a684..8f880d9772 100644
--- a/src/widgets/widgets/qplaintextedit_p.h
+++ b/src/widgets/widgets/qplaintextedit_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qprogressbar.cpp b/src/widgets/widgets/qprogressbar.cpp
index 3db91a6b6e..e731b63c66 100644
--- a/src/widgets/widgets/qprogressbar.cpp
+++ b/src/widgets/widgets/qprogressbar.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -192,9 +192,8 @@ bool QProgressBarPrivate::repaintRequired() const
If minimum and maximum both are set to 0, the bar shows a busy
indicator instead of a percentage of steps. This is useful, for
- example, when using QFtp or QNetworkAccessManager to download
- items when they are unable to determine the size of the item being
- downloaded.
+ example, when using QNetworkAccessManager to download items when
+ they are unable to determine the size of the item being downloaded.
\table
\row \o \inlineimage macintosh-progressbar.png Screenshot of a Macintosh style progress bar
diff --git a/src/widgets/widgets/qprogressbar.h b/src/widgets/widgets/qprogressbar.h
index ac34f64a2e..cdb6d36dfd 100644
--- a/src/widgets/widgets/qprogressbar.h
+++ b/src/widgets/widgets/qprogressbar.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp
index e3993167ef..ff477ec1d7 100644
--- a/src/widgets/widgets/qpushbutton.cpp
+++ b/src/widgets/widgets/qpushbutton.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qpushbutton.h b/src/widgets/widgets/qpushbutton.h
index fefbd9e81f..1dc0a19542 100644
--- a/src/widgets/widgets/qpushbutton.h
+++ b/src/widgets/widgets/qpushbutton.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qpushbutton_p.h b/src/widgets/widgets/qpushbutton_p.h
index 0056288a98..d77b69a341 100644
--- a/src/widgets/widgets/qpushbutton_p.h
+++ b/src/widgets/widgets/qpushbutton_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp
index b9567a0a11..1cf321bd16 100644
--- a/src/widgets/widgets/qradiobutton.cpp
+++ b/src/widgets/widgets/qradiobutton.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qradiobutton.h b/src/widgets/widgets/qradiobutton.h
index f1d9f5500a..aa3458bf95 100644
--- a/src/widgets/widgets/qradiobutton.h
+++ b/src/widgets/widgets/qradiobutton.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qrubberband.cpp b/src/widgets/widgets/qrubberband.cpp
index d0ea05f5cd..bb67b292af 100644
--- a/src/widgets/widgets/qrubberband.cpp
+++ b/src/widgets/widgets/qrubberband.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qrubberband.h b/src/widgets/widgets/qrubberband.h
index 3d30004770..05b35a772b 100644
--- a/src/widgets/widgets/qrubberband.h
+++ b/src/widgets/widgets/qrubberband.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp
index 48c179a9ab..9912b5e211 100644
--- a/src/widgets/widgets/qscrollarea.cpp
+++ b/src/widgets/widgets/qscrollarea.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qscrollarea.h b/src/widgets/widgets/qscrollarea.h
index 2d62cc1bc4..0dcd280894 100644
--- a/src/widgets/widgets/qscrollarea.h
+++ b/src/widgets/widgets/qscrollarea.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qscrollarea_p.h b/src/widgets/widgets/qscrollarea_p.h
index 0e5e21b7c0..e36e99add2 100644
--- a/src/widgets/widgets/qscrollarea_p.h
+++ b/src/widgets/widgets/qscrollarea_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp
index b8cd81c6a7..47a10de702 100644
--- a/src/widgets/widgets/qscrollbar.cpp
+++ b/src/widgets/widgets/qscrollbar.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qscrollbar.h b/src/widgets/widgets/qscrollbar.h
index f51a000a12..ac6146cc3f 100644
--- a/src/widgets/widgets/qscrollbar.h
+++ b/src/widgets/widgets/qscrollbar.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qsizegrip.cpp b/src/widgets/widgets/qsizegrip.cpp
index d4cfce984d..9f02c131ea 100644
--- a/src/widgets/widgets/qsizegrip.cpp
+++ b/src/widgets/widgets/qsizegrip.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qsizegrip.h b/src/widgets/widgets/qsizegrip.h
index 144eb8e160..acac950b44 100644
--- a/src/widgets/widgets/qsizegrip.h
+++ b/src/widgets/widgets/qsizegrip.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qslider.cpp b/src/widgets/widgets/qslider.cpp
index 9dd73f8c96..0f646fc19d 100644
--- a/src/widgets/widgets/qslider.cpp
+++ b/src/widgets/widgets/qslider.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qslider.h b/src/widgets/widgets/qslider.h
index c6620d253b..a050f229fb 100644
--- a/src/widgets/widgets/qslider.h
+++ b/src/widgets/widgets/qslider.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp
index 47cc8bbcf3..89743740de 100644
--- a/src/widgets/widgets/qspinbox.cpp
+++ b/src/widgets/widgets/qspinbox.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1250,36 +1250,6 @@ QString QDoubleSpinBoxPrivate::textFromValue(const QVariant &f) const
return q->textFromValue(f.toDouble());
}
-/*!
- \fn void QSpinBox::setLineStep(int step)
-
- Use setSingleStep() instead.
-*/
-
-/*!
- \fn void QSpinBox::setMaxValue(int value)
-
- Use setMaximum() instead.
-*/
-
-/*!
- \fn void QSpinBox::setMinValue(int value)
-
- Use setMinimum() instead.
-*/
-
-/*!
- \fn int QSpinBox::maxValue() const
-
- Use maximum() instead.
-*/
-
-/*!
- \fn int QSpinBox::minValue() const
-
- Use minimum() instead.
-*/
-
/*! \reimp */
bool QSpinBox::event(QEvent *event)
{
diff --git a/src/widgets/widgets/qspinbox.h b/src/widgets/widgets/qspinbox.h
index 0846103cca..bfc91b1ecf 100644
--- a/src/widgets/widgets/qspinbox.h
+++ b/src/widgets/widgets/qspinbox.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qsplashscreen.cpp b/src/widgets/widgets/qsplashscreen.cpp
index 7140487463..4fb0f3fa76 100644
--- a/src/widgets/widgets/qsplashscreen.cpp
+++ b/src/widgets/widgets/qsplashscreen.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qsplashscreen.h b/src/widgets/widgets/qsplashscreen.h
index 133146943e..f58b78adcb 100644
--- a/src/widgets/widgets/qsplashscreen.h
+++ b/src/widgets/widgets/qsplashscreen.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp
index b725ee039a..ca22e0718a 100644
--- a/src/widgets/widgets/qsplitter.cpp
+++ b/src/widgets/widgets/qsplitter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1675,7 +1675,6 @@ void QSplitter::setStretchFactor(int index, int stretch)
}
-#ifndef QT_NO_TEXTSTREAM
/*!
\relates QSplitter
\obsolete
@@ -1706,7 +1705,6 @@ QTextStream& operator>>(QTextStream& ts, QSplitter& splitter)
splitter.restoreState(line.toAscii());
return ts;
}
-#endif // QT_NO_TEXTSTREAM
QT_END_NAMESPACE
diff --git a/src/widgets/widgets/qsplitter.h b/src/widgets/widgets/qsplitter.h
index 71252ede24..ee62ab76f2 100644
--- a/src/widgets/widgets/qsplitter.h
+++ b/src/widgets/widgets/qsplitter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -133,10 +133,8 @@ private:
friend class QSplitterHandle;
};
-#ifndef QT_NO_TEXTSTREAM
Q_WIDGETS_EXPORT QTextStream& operator<<(QTextStream&, const QSplitter&);
Q_WIDGETS_EXPORT QTextStream& operator>>(QTextStream&, QSplitter&);
-#endif
class QSplitterHandlePrivate;
class Q_WIDGETS_EXPORT QSplitterHandle : public QWidget
diff --git a/src/widgets/widgets/qsplitter_p.h b/src/widgets/widgets/qsplitter_p.h
index 05e7a35165..a06b65c5d3 100644
--- a/src/widgets/widgets/qsplitter_p.h
+++ b/src/widgets/widgets/qsplitter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qstackedwidget.cpp b/src/widgets/widgets/qstackedwidget.cpp
index 4e9349e348..5544f241a9 100644
--- a/src/widgets/widgets/qstackedwidget.cpp
+++ b/src/widgets/widgets/qstackedwidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qstackedwidget.h b/src/widgets/widgets/qstackedwidget.h
index e0275fe27f..8dc24dd56f 100644
--- a/src/widgets/widgets/qstackedwidget.h
+++ b/src/widgets/widgets/qstackedwidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qstatusbar.cpp b/src/widgets/widgets/qstatusbar.cpp
index 295d509444..357c3c72d1 100644
--- a/src/widgets/widgets/qstatusbar.cpp
+++ b/src/widgets/widgets/qstatusbar.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qstatusbar.h b/src/widgets/widgets/qstatusbar.h
index c983f6d199..e24e9da150 100644
--- a/src/widgets/widgets/qstatusbar.h
+++ b/src/widgets/widgets/qstatusbar.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index 4fd7a31c41..c939c4aa7c 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h
index d33e6bbb1b..cfe9a90b47 100644
--- a/src/widgets/widgets/qtabbar.h
+++ b/src/widgets/widgets/qtabbar.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h
index 69ca361967..2060e169f2 100644
--- a/src/widgets/widgets/qtabbar_p.h
+++ b/src/widgets/widgets/qtabbar_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp
index a01316145e..636a68994a 100644
--- a/src/widgets/widgets/qtabwidget.cpp
+++ b/src/widgets/widgets/qtabwidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -154,15 +154,6 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QTabWidget::selected(const QString &tabLabel)
-
- This signal is emitted whenever a tab is selected (raised),
- including during the first show().
-
- You can normally use currentChanged() instead.
-*/
-
-/*!
\fn void QTabWidget::currentChanged(int index)
This signal is emitted whenever the current page index changes.
@@ -1345,153 +1336,6 @@ void QTabWidget::clear()
removeTab(0);
}
-/*!
- \fn void QTabWidget::insertTab(QWidget *widget, const QString &label, int index)
-
- Use insertTab(index, widget, label) instead.
-*/
-
-/*!
- \fn void QTabWidget::insertTab(QWidget *widget, const QIcon& icon, const QString &label, int index)
-
- Use insertTab(index, widget, icon, label) instead.
-*/
-
-/*!
- \fn void QTabWidget::changeTab(QWidget *widget, const QString
- &label)
-
- Use setTabText() instead.
-
-*/
-
-/*!
- \fn void QTabWidget::changeTab(QWidget *widget, const QIcon& icon, const QString &label)
-
- Use setTabText() and setTabIcon() instead.
-*/
-
-/*!
- \fn bool QTabWidget::isTabEnabled( QWidget *widget) const
-
- Use isTabEnabled(tabWidget->indexOf(widget)) instead.
-*/
-
-/*!
- \fn void QTabWidget::setTabEnabled(QWidget *widget, bool b)
-
- Use setTabEnabled(tabWidget->indexOf(widget), b) instead.
-*/
-
-/*!
- \fn QString QTabWidget::tabLabel(QWidget *widget) const
-
- Use tabText(tabWidget->indexOf(widget)) instead.
-*/
-
-/*!
- \fn void QTabWidget::setTabLabel(QWidget *widget, const QString
- &label)
-
- Use setTabText(tabWidget->indexOf(widget), label) instead.
-*/
-
-/*!
- \fn QIcon QTabWidget::tabIconSet(QWidget * widget) const
-
- Use tabIcon(tabWidget->indexOf(widget)) instead.
-*/
-
-/*!
- \fn void QTabWidget::setTabIconSet(QWidget * widget, const QIcon & icon)
-
- Use setTabIcon(tabWidget->indexOf(widget), icon) instead.
-*/
-
-/*!
- \fn void QTabWidget::removeTabToolTip(QWidget * widget)
-
- Use setTabToolTip(tabWidget->indexOf(widget), QString()) instead.
-*/
-
-/*!
- \fn void QTabWidget::setTabToolTip(QWidget * widget, const QString & tip)
-
- Use setTabToolTip(tabWidget->indexOf(widget), tip) instead.
-*/
-
-/*!
- \fn QString QTabWidget::tabToolTip(QWidget * widget) const
-
- Use tabToolTip(tabWidget->indexOf(widget)) instead.
-*/
-
-/*!
- \fn QWidget * QTabWidget::currentPage() const
-
- Use currentWidget() instead.
-*/
-
-/*!
- \fn QWidget *QTabWidget::page(int index) const
-
- Use widget() instead.
-*/
-
-/*!
- \fn QString QTabWidget::label(int index) const
-
- Use tabText() instead.
-*/
-
-/*!
- \fn int QTabWidget::currentPageIndex() const
-
- Use currentIndex() instead.
-*/
-
-/*!
- \fn int QTabWidget::margin() const
-
- This function is kept only to make old code compile.
- This functionality is no longer supported by QTabWidget.
-
- \sa contentsRect(), setContentsMargins()
-*/
-
-/*!
- \fn void QTabWidget::setMargin(int margin)
-
- This function is kept only to make old code compile.
- This functionality is no longer supported by QTabWidget.
-
- \sa contentsRect(), setContentsMargins()
-*/
-
-/*!
- \fn void QTabWidget::setCurrentPage(int index)
-
- Use setCurrentIndex() instead.
-*/
-
-/*!
- \fn void QTabWidget::showPage(QWidget *widget)
-
- Use setCurrentIndex(indexOf(widget)) instead.
-*/
-
-/*!
- \fn void QTabWidget::removePage(QWidget *widget)
-
- Use removeTab(indexOf(widget)) instead.
-*/
-
-/*!
- \fn void QTabWidget::currentChanged(QWidget *widget)
-
- Use currentChanged(int) instead.
-*/
-
QT_END_NAMESPACE
#include "moc_qtabwidget.cpp"
diff --git a/src/widgets/widgets/qtabwidget.h b/src/widgets/widgets/qtabwidget.h
index ff734ed722..432870df25 100644
--- a/src/widgets/widgets/qtabwidget.h
+++ b/src/widgets/widgets/qtabwidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp
index e8fad6cebc..dbda9e3b94 100644
--- a/src/widgets/widgets/qtextbrowser.cpp
+++ b/src/widgets/widgets/qtextbrowser.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtextbrowser.h b/src/widgets/widgets/qtextbrowser.h
index b7ec942753..ee977be23b 100644
--- a/src/widgets/widgets/qtextbrowser.h
+++ b/src/widgets/widgets/qtextbrowser.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index cd55716daf..acd663eb8c 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -179,7 +179,6 @@ void QTextEditPrivate::init(const QString &html)
q->setFocusPolicy(Qt::WheelFocus);
q->setAttribute(Qt::WA_KeyCompression);
q->setAttribute(Qt::WA_InputMethodEnabled);
- q->setInputMethodHints(Qt::ImhMultiLine);
#ifndef QT_NO_CURSOR
viewport->setCursor(Qt::IBeamCursor);
diff --git a/src/widgets/widgets/qtextedit.h b/src/widgets/widgets/qtextedit.h
index ae9865977f..b86c0e0999 100644
--- a/src/widgets/widgets/qtextedit.h
+++ b/src/widgets/widgets/qtextedit.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtextedit_p.h b/src/widgets/widgets/qtextedit_p.h
index 3512c80ac4..e7f172ec0f 100644
--- a/src/widgets/widgets/qtextedit_p.h
+++ b/src/widgets/widgets/qtextedit_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index 3d3ef4f7b5..6b1d414830 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -435,7 +435,7 @@ void QToolBarPrivate::plug(const QRect &r)
pop up a menu containing the items that does not currently fit in
the toolbar.
- When a QToolBar is not a child of a QMainWindow, it looses the ability
+ When a QToolBar is not a child of a QMainWindow, it loses the ability
to populate the extension pop up with widgets added to the toolbar using
addWidget(). Please use widget actions created by inheriting QWidgetAction
and implementing QWidgetAction::createWidget() instead.
diff --git a/src/widgets/widgets/qtoolbar.h b/src/widgets/widgets/qtoolbar.h
index 3e85d74e49..4f51cf045d 100644
--- a/src/widgets/widgets/qtoolbar.h
+++ b/src/widgets/widgets/qtoolbar.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtoolbar_p.h b/src/widgets/widgets/qtoolbar_p.h
index 70f1b6dca1..14ec575dc5 100644
--- a/src/widgets/widgets/qtoolbar_p.h
+++ b/src/widgets/widgets/qtoolbar_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp
index fbd5ef2cd7..2650f7676e 100644
--- a/src/widgets/widgets/qtoolbararealayout.cpp
+++ b/src/widgets/widgets/qtoolbararealayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtoolbararealayout_p.h b/src/widgets/widgets/qtoolbararealayout_p.h
index 940901df96..b61b2c76c9 100644
--- a/src/widgets/widgets/qtoolbararealayout_p.h
+++ b/src/widgets/widgets/qtoolbararealayout_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtoolbarextension.cpp b/src/widgets/widgets/qtoolbarextension.cpp
index c522b416f2..341bd9cbb3 100644
--- a/src/widgets/widgets/qtoolbarextension.cpp
+++ b/src/widgets/widgets/qtoolbarextension.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtoolbarextension_p.h b/src/widgets/widgets/qtoolbarextension_p.h
index d7f28bf0f3..a60584f755 100644
--- a/src/widgets/widgets/qtoolbarextension_p.h
+++ b/src/widgets/widgets/qtoolbarextension_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp
index ac9be12ee2..2e5aaa61f2 100644
--- a/src/widgets/widgets/qtoolbarlayout.cpp
+++ b/src/widgets/widgets/qtoolbarlayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtoolbarlayout_p.h b/src/widgets/widgets/qtoolbarlayout_p.h
index 4e4a8eab84..7c2a60d51a 100644
--- a/src/widgets/widgets/qtoolbarlayout_p.h
+++ b/src/widgets/widgets/qtoolbarlayout_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtoolbarseparator.cpp b/src/widgets/widgets/qtoolbarseparator.cpp
index bd0ed9854f..4dd11679fa 100644
--- a/src/widgets/widgets/qtoolbarseparator.cpp
+++ b/src/widgets/widgets/qtoolbarseparator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtoolbarseparator_p.h b/src/widgets/widgets/qtoolbarseparator_p.h
index 0f1eb05abc..5807c9f0b8 100644
--- a/src/widgets/widgets/qtoolbarseparator_p.h
+++ b/src/widgets/widgets/qtoolbarseparator_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtoolbox.cpp b/src/widgets/widgets/qtoolbox.cpp
index a0bd1708fe..2bf0dc0d9d 100644
--- a/src/widgets/widgets/qtoolbox.cpp
+++ b/src/widgets/widgets/qtoolbox.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtoolbox.h b/src/widgets/widgets/qtoolbox.h
index ac4125229c..8e7ac52646 100644
--- a/src/widgets/widgets/qtoolbox.h
+++ b/src/widgets/widgets/qtoolbox.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index ba0db96272..5b3a328dcc 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qtoolbutton.h b/src/widgets/widgets/qtoolbutton.h
index 5ec507904a..c451e2cc13 100644
--- a/src/widgets/widgets/qtoolbutton.h
+++ b/src/widgets/widgets/qtoolbutton.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qwidgetanimator.cpp b/src/widgets/widgets/qwidgetanimator.cpp
index 9df7dfc0eb..de92a53257 100644
--- a/src/widgets/widgets/qwidgetanimator.cpp
+++ b/src/widgets/widgets/qwidgetanimator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qwidgetanimator_p.h b/src/widgets/widgets/qwidgetanimator_p.h
index 40a2f274eb..d6e7a86e7b 100644
--- a/src/widgets/widgets/qwidgetanimator_p.h
+++ b/src/widgets/widgets/qwidgetanimator_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index 027512b6ae..e52193e20c 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -56,6 +56,22 @@
QT_BEGIN_NAMESPACE
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+static const int qt_passwordEchoDelay = QT_GUI_PASSWORD_ECHO_DELAY;
+#endif
+
+/*!
+ \macro QT_GUI_PASSWORD_ECHO_DELAY
+
+ \internal
+
+ Defines the amount of time in milliseconds the last entered character
+ should be displayed unmasked in the Password echo mode.
+
+ If not defined in qplatformdefs.h there will be no delay in masking
+ password characters.
+*/
+
/*!
\internal
@@ -93,9 +109,25 @@ void QWidgetLineControl::updateDisplayText(bool forceUpdate)
else
str = m_text;
- if (m_echoMode == QLineEdit::Password || (m_echoMode == QLineEdit::PasswordEchoOnEdit
- && !m_passwordEchoEditing))
+ if (m_echoMode == QLineEdit::Password) {
str.fill(m_passwordCharacter);
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+ if (m_passwordEchoTimer != 0 && m_cursor > 0 && m_cursor <= m_text.length()) {
+ int cursor = m_cursor - 1;
+ QChar uc = m_text.at(cursor);
+ str[cursor] = uc;
+ if (cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) {
+ // second half of a surrogate, check if we have the first half as well,
+ // if yes restore both at once
+ uc = m_text.at(cursor - 1);
+ if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00)
+ str[cursor - 1] = uc;
+ }
+ }
+#endif
+ } else if (m_echoMode == QLineEdit::PasswordEchoOnEdit && !m_passwordEchoEditing) {
+ str.fill(m_passwordCharacter);
+ }
// replace certain non-printable characters with spaces (to avoid
// drawing boxes when using fonts that don't have glyphs for such
@@ -354,6 +386,7 @@ void QWidgetLineControl::init(const QString &txt)
*/
void QWidgetLineControl::updatePasswordEchoEditing(bool editing)
{
+ cancelPasswordEchoTimer();
m_passwordEchoEditing = editing;
updateDisplayText();
}
@@ -694,6 +727,8 @@ bool QWidgetLineControl::finishChange(int validateFromState, bool update, bool e
m_selDirty = false;
emit selectionChanged();
}
+ if (m_cursor == m_lastCursorPos)
+ updateMicroFocus();
emitCursorPositionChanged();
return true;
}
@@ -705,6 +740,7 @@ bool QWidgetLineControl::finishChange(int validateFromState, bool update, bool e
*/
void QWidgetLineControl::internalSetText(const QString &txt, int pos, bool edited)
{
+ cancelPasswordEchoTimer();
internalDeselect();
emit resetInputContext();
QString oldText = m_text;
@@ -757,6 +793,13 @@ void QWidgetLineControl::addCommand(const Command &cmd)
*/
void QWidgetLineControl::internalInsert(const QString &s)
{
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+ if (m_echoMode == QLineEdit::Password) {
+ if (m_passwordEchoTimer != 0)
+ killTimer(m_passwordEchoTimer);
+ m_passwordEchoTimer = startTimer(qt_passwordEchoDelay);
+ }
+#endif
if (hasSelectedText())
addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend));
if (m_maskData) {
@@ -794,6 +837,7 @@ void QWidgetLineControl::internalInsert(const QString &s)
void QWidgetLineControl::internalDelete(bool wasBackspace)
{
if (m_cursor < (int) m_text.length()) {
+ cancelPasswordEchoTimer();
if (hasSelectedText())
addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend));
addCommand(Command((CommandType)((m_maskData ? 2 : 0) + (wasBackspace ? Remove : Delete)),
@@ -820,6 +864,7 @@ void QWidgetLineControl::internalDelete(bool wasBackspace)
void QWidgetLineControl::removeSelectedText()
{
if (m_selstart < m_selend && m_selend <= (int) m_text.length()) {
+ cancelPasswordEchoTimer();
separate();
int i ;
addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend));
@@ -1218,6 +1263,7 @@ void QWidgetLineControl::internalUndo(int until)
{
if (!isUndoAvailable())
return;
+ cancelPasswordEchoTimer();
internalDeselect();
while (m_undoState && m_undoState > until) {
Command& cmd = m_history[--m_undoState];
@@ -1422,6 +1468,12 @@ void QWidgetLineControl::timerEvent(QTimerEvent *event)
} else if (event->timerId() == m_tripleClickTimer) {
killTimer(m_tripleClickTimer);
m_tripleClickTimer = 0;
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+ } else if (event->timerId() == m_passwordEchoTimer) {
+ killTimer(m_passwordEchoTimer);
+ m_passwordEchoTimer = 0;
+ updateDisplayText();
+#endif
}
}
diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h
index e0c304279e..d8f27a4003 100644
--- a/src/widgets/widgets/qwidgetlinecontrol_p.h
+++ b/src/widgets/widgets/qwidgetlinecontrol_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -62,12 +62,15 @@
#include "QtWidgets/qstyleoption.h"
#include "QtCore/qpointer.h"
#include "QtGui/qclipboard.h"
+#include "QtGui/qinputpanel.h"
#include "QtCore/qpoint.h"
#include "QtWidgets/qcompleter.h"
#include "QtCore/qthread.h"
#include "qplatformdefs.h"
+#include "qplatformdefs.h"
+
QT_BEGIN_HEADER
#ifdef DrawText
@@ -252,6 +255,7 @@ public:
uint echoMode() const { return m_echoMode; }
void setEchoMode(uint mode)
{
+ cancelPasswordEchoTimer();
m_echoMode = mode;
m_passwordEchoEditing = false;
updateDisplayText();
@@ -301,7 +305,13 @@ public:
QString preeditAreaText() const { return m_textLayout.preeditAreaText(); }
void updatePasswordEchoEditing(bool editing);
- bool passwordEchoEditing() const { return m_passwordEchoEditing; }
+ bool passwordEchoEditing() const {
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+ if (m_passwordEchoTimer != 0)
+ return true;
+#endif
+ return m_passwordEchoEditing ;
+ }
QChar passwordCharacter() const { return m_passwordCharacter; }
void setPasswordCharacter(const QChar &character) { m_passwordCharacter = character; updateDisplayText(); }
@@ -309,7 +319,7 @@ public:
Qt::LayoutDirection layoutDirection() const {
if (m_layoutDirection == Qt::LayoutDirectionAuto) {
if (m_text.isEmpty())
- return QApplication::keyboardInputDirection();
+ return qApp->inputPanel()->inputDirection();
return m_text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight;
}
return m_layoutDirection;
@@ -474,6 +484,18 @@ private:
bool m_passwordEchoEditing;
QChar m_passwordCharacter;
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+ int m_passwordEchoTimer;
+#endif
+ void cancelPasswordEchoTimer()
+ {
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+ if (m_passwordEchoTimer != 0) {
+ killTimer(m_passwordEchoTimer);
+ m_passwordEchoTimer = 0;
+ }
+#endif
+ }
int redoTextLayout() const;
#if defined(Q_WS_MAC)
diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp
index f43e0f7dfa..5881d2360d 100644
--- a/src/widgets/widgets/qwidgetresizehandler.cpp
+++ b/src/widgets/widgets/qwidgetresizehandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qwidgetresizehandler_p.h b/src/widgets/widgets/qwidgetresizehandler_p.h
index 9d09d63967..5a355611fd 100644
--- a/src/widgets/widgets/qwidgetresizehandler_p.h
+++ b/src/widgets/widgets/qwidgetresizehandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index a55e001fc4..628848b0d7 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -75,7 +75,7 @@
#include <qvariant.h>
#include <qurl.h>
#include <qdesktopservices.h>
-#include <qinputcontext.h>
+#include <qinputpanel.h>
#include <qtooltip.h>
#include <qstyleoption.h>
#include <QtWidgets/qlineedit.h>
@@ -691,20 +691,30 @@ void QWidgetTextControlPrivate::extendWordwiseSelection(int suggestedNewPosition
if (!wordSelectionEnabled && (mouseXPosition < wordStartX || mouseXPosition > wordEndX))
return;
- // keep the already selected word even when moving to the left
- // (#39164)
- if (suggestedNewPosition < selectedWordOnDoubleClick.position())
- cursor.setPosition(selectedWordOnDoubleClick.selectionEnd());
- else
- cursor.setPosition(selectedWordOnDoubleClick.selectionStart());
+ if (wordSelectionEnabled) {
+ if (suggestedNewPosition < selectedWordOnDoubleClick.position()) {
+ cursor.setPosition(selectedWordOnDoubleClick.selectionEnd());
+ setCursorPosition(wordStartPos, QTextCursor::KeepAnchor);
+ } else {
+ cursor.setPosition(selectedWordOnDoubleClick.selectionStart());
+ setCursorPosition(wordEndPos, QTextCursor::KeepAnchor);
+ }
+ } else {
+ // keep the already selected word even when moving to the left
+ // (#39164)
+ if (suggestedNewPosition < selectedWordOnDoubleClick.position())
+ cursor.setPosition(selectedWordOnDoubleClick.selectionEnd());
+ else
+ cursor.setPosition(selectedWordOnDoubleClick.selectionStart());
- const qreal differenceToStart = mouseXPosition - wordStartX;
- const qreal differenceToEnd = wordEndX - mouseXPosition;
+ const qreal differenceToStart = mouseXPosition - wordStartX;
+ const qreal differenceToEnd = wordEndX - mouseXPosition;
- if (differenceToStart < differenceToEnd)
- setCursorPosition(wordStartPos, QTextCursor::KeepAnchor);
- else
- setCursorPosition(wordEndPos, QTextCursor::KeepAnchor);
+ if (differenceToStart < differenceToEnd)
+ setCursorPosition(wordStartPos, QTextCursor::KeepAnchor);
+ else
+ setCursorPosition(wordEndPos, QTextCursor::KeepAnchor);
+ }
if (interactionFlags & Qt::TextSelectableByMouse) {
#ifndef QT_NO_CLIPBOARD
@@ -1678,16 +1688,15 @@ void QWidgetTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button
emit q->cursorPositionChanged();
_q_updateCurrentCharFormatAndSelection();
#ifndef QT_NO_IM
- if (contextWidget) {
- if (QInputContext *ic = qApp->inputContext()) {
- ic->update();
- }
- }
+ if (contextWidget)
+ qApp->inputPanel()->update(Qt::ImQueryInput);
#endif //QT_NO_IM
} else {
//emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1)));
- if (cursor.position() != oldCursorPos)
+ if (cursor.position() != oldCursorPos) {
emit q->cursorPositionChanged();
+ emit q->microFocusChanged();
+ }
}
selectionChanged(true);
repaintOldAndNewSelection(oldSelection);
@@ -1734,8 +1743,10 @@ void QWidgetTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton but
repaintOldAndNewSelection(oldSelection);
- if (cursor.position() != oldCursorPos)
+ if (cursor.position() != oldCursorPos) {
emit q->cursorPositionChanged();
+ emit q->microFocusChanged();
+ }
if (interactionFlags & Qt::LinksAccessibleByMouse) {
if (!(button & Qt::LeftButton))
@@ -1807,34 +1818,32 @@ bool QWidgetTextControlPrivate::sendMouseEventToInputContext(
QEvent *e, QEvent::Type eventType, Qt::MouseButton button, const QPointF &pos,
Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons, const QPoint &globalPos)
{
+ Q_UNUSED(eventType);
+ Q_UNUSED(button);
+ Q_UNUSED(pos);
+ Q_UNUSED(modifiers);
+ Q_UNUSED(buttons);
+ Q_UNUSED(globalPos);
#if !defined(QT_NO_IM)
Q_Q(QWidgetTextControl);
if (contextWidget && isPreediting()) {
QTextLayout *layout = cursor.block().layout();
- QInputContext *ctx = qApp->inputContext();
int cursorPos = q->hitTest(pos, Qt::FuzzyHit) - cursor.position();
if (cursorPos < 0 || cursorPos > layout->preeditAreaText().length())
cursorPos = -1;
- if (ctx && cursorPos >= 0) {
- QMouseEvent ev(eventType, contextWidget->mapFromGlobal(globalPos),
- contextWidget->topLevelWidget()->mapFromGlobal(globalPos), globalPos,
- button, buttons, modifiers);
- ctx->mouseHandler(cursorPos, &ev);
- e->setAccepted(ev.isAccepted());
+ if (cursorPos >= 0) {
+ if (e->type() == QEvent::MouseButtonRelease)
+ qApp->inputPanel()->invokeAction(QInputPanel::Click, cursorPos);
+
+ e->setAccepted(true);
return true;
}
}
#else
Q_UNUSED(e);
- Q_UNUSED(eventType);
- Q_UNUSED(button);
- Q_UNUSED(pos);
- Q_UNUSED(modifiers);
- Q_UNUSED(buttons);
- Q_UNUSED(globalPos);
#endif
return false;
}
@@ -2157,17 +2166,6 @@ QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget
a->setEnabled(!d->doc->isEmpty());
}
-#if !defined(QT_NO_IM)
- if (d->contextWidget) {
- QInputContext *qic = qApp->inputContext();
- if (qic) {
- QList<QAction *> imActions = qic->actions();
- for (int i = 0; i < imActions.size(); ++i)
- menu->addAction(imActions.at(i));
- }
- }
-#endif
-
#if defined(Q_WS_WIN) || defined(Q_WS_X11)
if ((d->interactionFlags & Qt::TextEditable) && qt_use_rtl_extensions) {
#else
diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h
index 1550959ebe..7425a7d878 100644
--- a/src/widgets/widgets/qwidgettextcontrol_p.h
+++ b/src/widgets/widgets/qwidgettextcontrol_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qwidgettextcontrol_p_p.h b/src/widgets/widgets/qwidgettextcontrol_p_p.h
index cf493aff71..7e49be7f7b 100644
--- a/src/widgets/widgets/qwidgettextcontrol_p_p.h
+++ b/src/widgets/widgets/qwidgettextcontrol_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qworkspace.cpp b/src/widgets/widgets/qworkspace.cpp
index 0d74635881..7aaeeb7282 100644
--- a/src/widgets/widgets/qworkspace.cpp
+++ b/src/widgets/widgets/qworkspace.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/widgets/widgets/qworkspace.h b/src/widgets/widgets/qworkspace.h
index 843879a8e7..66fa57f5a4 100644
--- a/src/widgets/widgets/qworkspace.h
+++ b/src/widgets/widgets/qworkspace.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/winmain/qtmain_win.cpp b/src/winmain/qtmain_win.cpp
index 2c0091bd89..439f5b859f 100644
--- a/src/winmain/qtmain_win.cpp
+++ b/src/winmain/qtmain_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 5aa7311e6c..3b1e2a8bb7 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -7457,6 +7457,7 @@ bool QDomHandler::characters(const QString& ch)
QScopedPointer<QDomEntityPrivate> e(new QDomEntityPrivate(doc, 0, entityName,
QString(), QString(), QString()));
e->value = ch;
+ e->ref.deref();
doc->doctype()->appendChild(e.data());
e.take();
n.reset(doc->createEntityReference(entityName));
@@ -7541,6 +7542,8 @@ bool QDomHandler::unparsedEntityDecl(const QString &name, const QString &publicI
{
QDomEntityPrivate* e = new QDomEntityPrivate(doc, 0, name,
publicId, systemId, notationName);
+ // keep the refcount balanced: appendChild() does a ref anyway.
+ e->ref.deref();
doc->doctype()->appendChild(e);
return true;
}
@@ -7553,6 +7556,8 @@ bool QDomHandler::externalEntityDecl(const QString &name, const QString &publicI
bool QDomHandler::notationDecl(const QString & name, const QString & publicId, const QString & systemId)
{
QDomNotationPrivate* n = new QDomNotationPrivate(doc, 0, name, publicId, systemId);
+ // keep the refcount balanced: appendChild() does a ref anyway.
+ n->ref.deref();
doc->doctype()->appendChild(n);
return true;
}
diff --git a/src/xml/dom/qdom.h b/src/xml/dom/qdom.h
index 87ccee21aa..d2ff10469d 100644
--- a/src/xml/dom/qdom.h
+++ b/src/xml/dom/qdom.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp
index 067731bb67..bd13cca4ad 100644
--- a/src/xml/sax/qxml.cpp
+++ b/src/xml/sax/qxml.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h
index 52eea6ce76..7e0ef10d86 100644
--- a/src/xml/sax/qxml.h
+++ b/src/xml/sax/qxml.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**